commit 589f49ff366f88e3f3be9424397d9d99ebf44dfe
Author: Enrico Forestieri <[email protected]>
Date: Sat Aug 20 00:41:04 2016 +0200
Use only one file for dummy implementations
---
src/Makefile.am | 16 ++++----
src/support/tests/dummy_functions.cpp | 20 +++++++++--
src/tests/CMakeLists.txt | 8 ++--
src/tests/dummy_functions.cpp | 61 ---------------------------------
4 files changed, 28 insertions(+), 77 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 02f0781..dd51584 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -744,9 +744,9 @@ check_layout_SOURCES = \
ModuleList.cpp \
Spacing.cpp \
TextClass.cpp \
+ support/tests/dummy_functions.cpp \
tests/check_layout.cpp \
- tests/boost.cpp \
- tests/dummy_functions.cpp
+ tests/boost.cpp
check_ExternalTransforms_CPPFLAGS = $(AM_CPPFLAGS)
check_ExternalTransforms_LDADD = support/liblyxsupport.a $(LIBICONV)
$(BOOST_LIBS) @LIBS@ \
@@ -757,9 +757,9 @@ check_ExternalTransforms_SOURCES = \
insets/ExternalTransforms.cpp \
Length.cpp \
lengthcommon.cpp \
+ support/tests/dummy_functions.cpp \
tests/check_ExternalTransforms.cpp \
- tests/boost.cpp \
- tests/dummy_functions.cpp
+ tests/boost.cpp
check_Length_CPPFLAGS = $(AM_CPPFLAGS)
check_Length_LDADD = support/liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) @LIBS@ \
@@ -768,17 +768,17 @@ check_Length_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS)
check_Length_SOURCES = \
Length.cpp \
lengthcommon.cpp \
+ support/tests/dummy_functions.cpp \
tests/check_Length.cpp \
- tests/boost.cpp \
- tests/dummy_functions.cpp
+ tests/boost.cpp
check_ListingsCaption_CPPFLAGS = $(AM_CPPFLAGS)
check_ListingsCaption_LDADD = support/liblyxsupport.a $(LIBICONV)
$(BOOST_LIBS) @LIBS@ \
$(ICONV_LIBS) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI)
check_ListingsCaption_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS)
check_ListingsCaption_SOURCES = \
+ support/tests/dummy_functions.cpp \
tests/check_ListingsCaption.cpp \
- tests/boost.cpp \
- tests/dummy_functions.cpp
+ tests/boost.cpp
.PHONY: alltests alltests-recursive updatetests
diff --git a/src/support/tests/dummy_functions.cpp
b/src/support/tests/dummy_functions.cpp
index 6b10660..63ff0c0 100644
--- a/src/support/tests/dummy_functions.cpp
+++ b/src/support/tests/dummy_functions.cpp
@@ -1,10 +1,13 @@
#include <config.h>
-#include "../Messages.h"
+#include "support/Messages.h"
using namespace std;
namespace lyx {
+ // Dummy verbose support
+ bool verbose = false;
+
// Dummy LyXRC support
class LyXRC { string icon_set; } lyxrc;
@@ -34,11 +37,20 @@ namespace lyx {
{
return string();
}
+
//
- // Dummy verbose support
+ // Dummy FontMetrics (needed by Length)
//
+ namespace frontend {
+ class FontMetrics {
+ int em() const { return 0; };
+ };
+ }
- bool verbose = false;
-
+ class FontInfo;
+ frontend::FontMetrics const & theFontMetrics(FontInfo const &) {
+ static frontend::FontMetrics dummy;
+ return dummy;
+ }
}
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index af420d3..0bd05b4 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -8,7 +8,7 @@ set(check_layout_SOURCES)
foreach(_f insets/InsetLayout.cpp Color.cpp Counters.cpp Floating.cpp
FloatList.cpp FontInfo.cpp Layout.cpp LayoutFile.cpp Lexer.cpp
ModuleList.cpp Spacing.cpp TextClass.cpp tests/check_layout.cpp
- tests/boost.cpp tests/dummy_functions.cpp)
+ tests/boost.cpp support/tests/dummy_functions.cpp)
list(APPEND check_layout_SOURCES "${TOP_SRC_DIR}/src/${_f}")
endforeach()
@@ -53,7 +53,7 @@ endforeach()
set(check_ExternalTransforms_SOURCES)
foreach(_f graphics/GraphicsParams.cpp insets/ExternalTransforms.cpp
Length.cpp lengthcommon.cpp tests/check_ExternalTransforms.cpp
- tests/boost.cpp tests/dummy_functions.cpp)
+ tests/boost.cpp support/tests/dummy_functions.cpp)
list(APPEND check_ExternalTransforms_SOURCES ${TOP_SRC_DIR}/src/${_f})
endforeach()
@@ -76,7 +76,7 @@ add_test(NAME "check_ExternalTransforms"
add_dependencies(lyx_run_tests check_ExternalTransforms)
set(check_Length_SOURCES)
-foreach(_f Length.cpp lengthcommon.cpp tests/check_Length.cpp tests/boost.cpp
tests/dummy_functions.cpp)
+foreach(_f Length.cpp lengthcommon.cpp tests/check_Length.cpp tests/boost.cpp
support/tests/dummy_functions.cpp)
list(APPEND check_Length_SOURCES ${TOP_SRC_DIR}/src/${_f})
endforeach()
add_executable(check_Length ${check_Length_SOURCES})
@@ -98,7 +98,7 @@ add_dependencies(lyx_run_tests check_Length)
include_directories(${TOP_SRC_DIR}/src/tests)
set(check_ListingsCaption_SOURCES)
-foreach(_f tests/check_ListingsCaption.cpp tests/boost.cpp
tests/dummy_functions.cpp)
+foreach(_f tests/check_ListingsCaption.cpp tests/boost.cpp
support/tests/dummy_functions.cpp)
list(APPEND check_ListingsCaption_SOURCES ${TOP_SRC_DIR}/src/${_f})
endforeach()
add_executable(check_ListingsCaption ${check_ListingsCaption_SOURCES})
diff --git a/src/tests/dummy_functions.cpp b/src/tests/dummy_functions.cpp
deleted file mode 100644
index 074e229..0000000
--- a/src/tests/dummy_functions.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-#include <config.h>
-
-#include "../support/Messages.h"
-
-using namespace std;
-
-namespace lyx {
- // Dummy LyXRC support
- class LyXRC { string icon_set; } lyxrc;
-
- // Dummy LyXAlignment support
- enum LyXAlignment {
- DUMMY
- };
-
- // Keep the linker happy on Windows
- void lyx_exit(int) {}
-
- // Dummy language support
- Messages const & getGuiMessages()
- {
- static Messages lyx_messages;
-
- return lyx_messages;
- }
- Messages const & getMessages(string const &)
- {
- static Messages lyx_messages;
-
- return lyx_messages;
- }
-
- string alignmentToCSS(LyXAlignment)
- {
- return string();
- }
-
- //
- // Dummy FontMetrics (needed by Length)
- //
-
-
- namespace frontend {
- class FontMetrics {
- int em() const { return 0; };
- };
- }
-
- class FontInfo;
-
- frontend::FontMetrics const & theFontMetrics(FontInfo const &) {
- static frontend::FontMetrics dummy;
- return dummy;
- }
- //
- // Dummy verbose support
- //
-
- bool verbose = false;
-
-}