Commit Graph

56 Commits

Author SHA1 Message Date
Kornel Benko
6093a3a9b1 Cmake build: Use test/dummy_functions.cpp instead of support/tests/dummy_functions.cpp
Test-programms in src/tests are now handled the same as in autoconf.
2018-01-08 12:58:28 +01:00
Jean-Marc Lasgouttes
d77b05db80 Move the inPixels(MetricsBase) help from Length to MetricsBase.
A basic class like Length should not depend on something from
frontend.

This change allows to remove several dummy implementations of
theFontMetrics().
2018-01-05 20:14:04 +01:00
Jean-Marc Lasgouttes
39a8000589 Do not use Application for a 'cancel export' boolean
It is not good for a support function to depend of anything outside of
it, especially Application.

Here the boolean that indicates that export should be canceled is put
in Systemcall. This allows to remove all the dummy theApp() function
that have been added here and there for linking needs.
2018-01-02 16:01:07 +01:00
Jean-Marc Lasgouttes
9428ad56b9 Fix 'make check' 2018-01-01 23:55:34 +01:00
Christian Ridderström
e30f3d76d2 Bulk cleanup/fix incorrect annotation at the end of namespaces.
This commit does a bulk fix of incorrect annotations (comments) at the
end of namespaces.

The commit was generated by initially running clang-format, and then
from the diff of the result extracting the hunks corresponding to
fixes of namespace comments. The changes being applied and all the
results have been manually reviewed. The source code successfully
builds on macOS.

Further details on the steps below, in case they're of interest to
someone else in the future.

1. Checkout a fresh and up to date version of src/

    git pull && git checkout -- src && git status src

2. Ensure there's a suitable .clang-format in place, i.e. with options
   to fix the comment at the end of namespaces, including:

    FixNamespaceComments:                           true
    SpacesBeforeTrailingComments:                   1

and that clang-format is >= 5.0.0, by doing e.g.:

    clang-format -dump-config | grep Comments:
    clang-format --version

3. Apply clang-format to the source:

    clang-format -i $(find src -name "*.cpp" -or -name "*.h")

4. Create and filter out hunks related to fixing the namespace

    git diff -U0 src > tmp.patch
    grepdiff '^} // namespace' --output-matching=hunk tmp.patch  > fix_namespace.patch

5. Filter out hunks corresponding to simple fixes into to a separate patch:

    pcregrep -M -e '^diff[^\n]+\nindex[^\n]+\n--- [^\n]+\n\+\+\+ [^\n]+\n'  \
        -e '^@@ -[0-9]+ \+[0-9]+ @@[^\n]*\n-\}[^\n]*\n\+\}[^\n]*\n'         \
        fix_namespace.patch > fix_namespace_simple.patch

6. Manually review the simple patch and then apply it, after first
   restoring the source.

    git checkout -- src
    patch -p1 < fix_namespace_simple.path

7. Manually review the (simple) changes and then stage the changes

    git diff src
    git add src

8. Again apply clang-format and filter out hunks related to any
   remaining fixes to the namespace, this time filter with more
   context. There will be fewer hunks as all the simple cases have
   already been handled:

    clang-format -i $(find src -name "*.cpp" -or -name "*.h")
    git diff src > tmp.patch
    grepdiff '^} // namespace' --output-matching=hunk tmp.patch  > fix_namespace2.patch

9. Manually review/edit the resulting patch file to remove hunks for files
   which need to be dealt with manually, noting the file names and
   line numbers. Then restore files to as before applying clang-format
   and apply the patch:

    git checkout src
    patch -p1 < fix_namespace2.patch

10. Manually fix the files noted in the previous step. Stage files,
    review changes and commit.
2017-07-23 13:11:54 +02:00
Daniel Ramöller
4183a9f4dc Preferences shows current zoom instead of preference's default zoom (#10455)
- Adds a currentZoom variable which holds the current zoom level.

- The zoom stored in preferences is used as default zoom level (default binding:
  M+0).

- The currentZoom is saved and restored via QSettings.

- Adds LFUN buffer-zoom for (re)setting zoom.
2017-05-07 14:17:54 +02:00
Kornel Benko
fab6ee2f4d Check_layout tests: Check also stderr
1.) The command check_layout exits with "0", even if the module contains errors.
  The new module check_layout.cmake tries to compensate.
2.) Added default style to the test layouts when checking single modules.
2017-04-13 11:18:05 +02:00
Enrico Forestieri
ee0cc3cec1 Fix tests after 031748d9 2017-04-13 09:38:46 +02:00
Kornel Benko
560ebc1d50 Make output of check_Length.cpp more human readable. 2017-04-10 09:57:40 +02:00
Jean-Marc Lasgouttes
86ae7dad3f Require automake 1.14 and autoconf 2.65
This allows to fix distclean properly, since we know that
subdir-objects is used. When it is the case, it is not a good idea for
a Makefile to use a source file which is under the control of another
one. This could not be made to work work with old automake versions
(<1.14).

Therefore we refer directly to object files in Makefile.am instead of
source files. The actually leads to less compilation in tex2lyx.

Update the code here and there to remove compatibility hacks. Update
documentation.

Re-enable the layout test and fix the Length test, which was ovewriting
memory in test_inPixels() because lyxrc did not had a correct layout.
2017-04-06 14:56:30 +02:00
Kornel Benko
cf3f4814d9 Adapt the cmake-build-system to the reworked biblatex handling 2017-01-13 13:17:12 +01:00
Enrico Forestieri
589f49ff36 Use only one file for dummy implementations 2016-08-20 00:41:04 +02:00
Kornel Benko
3c9d5d3cda Cmake build: Add verbose variable to some dummy_functions.cpp 2016-08-19 11:15:10 +02:00
Pavel Sanda
d13048c7f5 fix make check. 2016-07-04 14:10:30 -07:00
Kornel Benko
af5ec069c7 Removed doubled code in CMakeLists.txt 2015-11-22 19:20:32 +01:00
Georg Baum
dfe3a7d9fc Fix InsetListings::getCaption() for std::regex
Back references in the format string of regex_replace use the syntax $n both
in std::regex and in boost::regex for the default format. Boost seems to
support the syntax \n in addition, but it is not documented at
http://www.boost.org/doc/libs/master/libs/regex/doc/html/boost_regex/format.html.
Therefore it is a good idea to use $n also for boost.
2015-11-22 17:43:10 +01:00
Georg Baum
3b842d5a62 Add unit test for InsetListings::getCaption()
The regex in InsetListings::getCaption() does not work with C++11 and
std::regex. This can now be checked easily by this new unit test.
2015-11-22 17:36:32 +01:00
Kornel Benko
e430586ec3 Cmake tests: Get rid of use of command 'env', which is not available under Windows. 2015-10-28 17:59:28 +01:00
Kornel Benko
789e7f7ed9 Cmake tests: Add missing definition for check_Length_SOURCES
This was forgotten in previous commit ccbac353ea
2015-07-12 18:59:24 +02:00
Georg Baum
ccbac353ea Fix Length::inBP()
Length::inBP() returned the wrong values for most units. I guess that this was
caused by the default case in the switch statement: It did probably exist
before the other units were added.
inBP() is now correct for all units except the font dependent ones em, ex and
mu and the percent units: For these only approximate values are returned,
since not all needed information is available.
2015-07-12 18:36:19 +02:00
Georg Baum
7910502b8e Add unit test for the Length class
I noticed that inBP() is wrong for several units and want to fix it.
The unit test will help me to find regressions.
2015-07-12 18:10:43 +02:00
Kornel Benko
b5ce8989bf Cmake tests: cheating check_layout to accept module files as layouts 2015-05-19 13:42:33 +02:00
Georg Baum
84cca2dd94 Fix indentation 2015-05-17 17:27:27 +02:00
Georg Baum
1e4700b277 Remove bash construct
Now it should work with any sh compatible shell
2015-05-16 11:11:08 +02:00
Enrico Forestieri
194e8bb4ac Fix layout tests. 2015-05-15 01:19:50 +02:00
Kornel Benko
01bacfd060 Cmake build: New libmagic dependency after commit 93b0f9c080
The command check_ExternalTransforms was no longer linked.
2015-05-06 18:59:26 +02:00
Kornel Benko
f2e759d499 Cmake build: Enable debug output for check_layouts. 2015-04-24 11:20:33 +02:00
Jean-Marc Lasgouttes
13c60bfa78 Fix potential link error in tests.
This is a followup of d4718b18, which itself fixes a problem introduced in 66fa801e.
2015-04-09 11:59:12 +02:00
Kornel Benko
27844f580e Expand dummy_functions.cpp with needed class for check_ExternalTransforms. 2015-03-27 10:53:12 +01:00
Kornel Benko
fcf8d1a746 make build: Make it compilable for Qt4 too. 2015-03-15 20:12:55 +01:00
Vincent van Ravesteijn
1950152b39 cmake: Put check_ExternalTransforms in tests folder 2015-01-13 21:21:12 +01:00
Stephan Witt
a88e6e1ea5 Add icon library to link target - needed on Mac OS X - thanks Kornel 2014-12-29 11:33:47 +01:00
Georg Baum
dae8555234 Get rid of regex_constants::match_partial
As shown by the unit test this is not needed at all, even not for really
awkward input.
2014-12-28 17:46:33 +01:00
Georg Baum
449c766e03 Test invalid sanitizeLatexOption() input as well 2014-12-28 17:34:46 +01:00
Kornel Benko
a50c0f2ab3 Add ExternalTransforms test also to cmake build 2014-12-28 14:20:17 +01:00
Georg Baum
1db9224cff Add unit test for sanitizeLatexOption()
This is a prerequisite for safe removal of regex::match_partial.
2014-12-28 13:23:35 +01:00
Enrico Forestieri
1b0cbb6932 Fix building with cmake on cygwin.
Add required libraries for the link stage.
2014-12-26 17:00:23 +01:00
Peter Kümmel
6407d45a69 fix coding style
(should have read ml first)
2014-08-16 07:27:00 +02:00
Peter Kümmel
39911dfe2b build test_Layout test 2014-08-16 06:55:32 +02:00
Kornel Benko
3b14de740d Cmake build: Symplify use of linking optional libraries found via find_package 2014-06-12 19:02:29 +02:00
Kornel Benko
2b0511510a Cmake build: Added magic library to some link commands.
Needed due to the use of magic_(open|load|error|file|close) after recent changes.
2014-06-12 07:49:17 +02:00
Georg Baum
53f8d6d6d3 Make layout test compile 2014-05-29 15:07:07 +02:00
Kornel Benko
f3a96fb833 Cmake build: Add include path for src/tests/dummy_functions.cpp
Othervise the statement '#include "../Messages.h"' results in error.
2014-04-21 19:14:25 +02:00
Jean-Marc Lasgouttes
6c8a775c73 Use subdir-objects for automake 1.14 or newer
This option is going to be mandatory starting with automake 2.0.
LyX is able to use this since version 2.1, but it turns out that it is
badly implemented in versions of automake older than 1.14.

We rely on some (undocumented) symbol to detect automake 1.14 and
use the subdirs-objects option in this case.

For more details, see:
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg181023.html

Making everything work with autotools required making a copy of two
files from support/tests. It seems that we should not point to source files
that are handled by another Makefile.am.
2014-04-21 11:52:00 -04:00
Jean-Marc Lasgouttes
72c13323d8 Remove dependency on NO_LAYOUT_CSS #define in Layout.cpp
Remove all traces of this #define.
2013-09-29 15:26:15 +02:00
Kornel Benko
f57e8b98ea Cmake build tests: Label also layoyt tests 2013-09-07 09:27:40 +02:00
Georg Baum
12554c93d8 Remove ugly multiple definition hack
Since 00387b2a38 it is possible to construct a dummy Messages object
which does not translate at all. With the old gettext implementation, a
Messages object without a defined language would have used a language from
an environment variable. Therefore, the duplicate definition of _() is no
longer needed. This gettext removal was really a good idea!
2013-05-31 22:07:14 +02:00
Vincent van Ravesteijn
a3c864102a CMake: Remove libintl 2013-05-30 22:10:01 +02:00
Georg Baum
952853eb23 Fix layout tests for autotools
This part was forgotten in 6f16814d3b.
2013-05-23 22:00:56 +02:00
Kornel Benko
6e992e3544 cmake:
1.) Do not include layout tests on MAC, since the
  linker-option which allows multiple definitions is
  no longer supported.
2.) Indenting made consistent
2013-05-15 11:28:04 +02:00