##// END OF EJS Templates
Inits unit test
Alexandre Leroux -
r686:79898921a450
parent child
Show More
@@ -0,0 +1,50
1 #include "CosinusProvider.h"
2
3 #include <SqpApplication.h>
4
5 #include <QObject>
6 #include <QtTest>
7
8 namespace {
9
10 /// Path for the tests
11 const auto TESTS_RESOURCES_PATH = QFileInfo{
12 QString{MOCKPLUGIN_TESTS_RESOURCES_DIR},
13 "TestCosinusAcquisition"}.absoluteFilePath();
14
15 } // namespace
16
17 /**
18 * @brief The TestCosinusAcquisition class tests acquisition in SciQlop (operations like zooms in,
19 * zooms out, pans) of data from CosinusProvider
20 * @sa CosinusProvider
21 */
22 class TestCosinusAcquisition : public QObject {
23 Q_OBJECT
24
25 private slots:
26 /// Input data for @sa testAcquisition()
27 void testAcquisition_data();
28 void testAcquisition();
29 };
30
31 void TestCosinusAcquisition::testAcquisition_data()
32 {
33 /// @todo
34 }
35
36 void TestCosinusAcquisition::testAcquisition()
37 {
38 /// @todo
39 }
40
41 int main(int argc, char *argv[])
42 {
43 SqpApplication app{argc, argv};
44 app.setAttribute(Qt::AA_Use96Dpi, true);
45 TestCosinusAcquisition testObject{};
46 QTEST_SET_MAIN_SOURCE_PATH
47 return QTest::qExec(&testObject, argc, argv);
48 }
49
50 #include "TestCosinusAcquisition.moc"
@@ -1,157 +1,160
1 1 ## mockplugin - CMakeLists.txt
2 2 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
3 3 SET(SQPMOCKPLUGIN_LIBRARY_NAME "${LIBRARY_PREFFIX}_mockplugin${DEBUG_SUFFIX}")
4 4 SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
5 5 SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
6 6 SET(RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/resources")
7 SET(TESTS_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests-resources")
7 8
8 9 # Include mockplugin directory
9 10 INCLUDE_DIRECTORIES(${INCLUDES_DIR})
10 11 INCLUDE_DIRECTORIES(${RESOURCES_DIR})
11 12
12 13 #
13 14 # Find Qt modules
14 15 #
15 16 SCIQLOP_FIND_QT(Core Widgets)
16 17
17 18 #
18 19 # Find dependent libraries
19 20 # ========================
20 21
21 22 # sciqlop plugin
22 23 find_package(sciqlop-plugin)
23 24 INCLUDE_DIRECTORIES(${SCIQLOP-PLUGIN_INCLUDE_DIR})
24 25
25 26 # sciqlop core
26 27 find_package(sciqlop-core)
27 28 INCLUDE_DIRECTORIES(${SCIQLOP-CORE_INCLUDE_DIR})
28 29 list(APPEND LIBRARIES ${SCIQLOP-CORE_LIBRARIES})
29 30
30 31 # sciqlop gui
31 32 find_package(sciqlop-gui)
32 33 INCLUDE_DIRECTORIES(${SCIQLOP-GUI_INCLUDE_DIR})
33 34 list(APPEND LIBRARIES ${SCIQLOP-GUI_LIBRARIES})
34 35
35 36 # Description file
36 37 FILE (GLOB_RECURSE PLUGIN_FILE ${RESOURCES_DIR}/mockplugin.json)
37 38
38 39 #
39 40 # Compile the library
40 41 #
41 42
42 43 ADD_DEFINITIONS(-DMOCKPLUGIN_LIB)
43 44
44 45 FILE (GLOB_RECURSE MODULE_SOURCES
45 46 ${INCLUDES_DIR}/*.h
46 47 ${SOURCES_DIR}/*.c
47 48 ${SOURCES_DIR}/*.cpp
48 49 ${SOURCES_DIR}/*.h
49 50 ${PLUGIN_FILE})
50 51
51 52 ADD_LIBRARY(${SQPMOCKPLUGIN_LIBRARY_NAME} ${MODULE_SOURCES})
52 53 set_property(TARGET ${SQPMOCKPLUGIN_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
53 54 set_property(TARGET ${SQPMOCKPLUGIN_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
54 55
55 56 INSTALL(TARGETS ${SQPMOCKPLUGIN_LIBRARY_NAME}
56 57 RUNTIME DESTINATION ${INSTALL_BINARY_DIR}
57 58 LIBRARY DESTINATION ${INSTALL_PLUGINS_LIBRARY_DIR}
58 59 ARCHIVE DESTINATION ${INSTALL_PLUGINS_LIBRARY_DIR}
59 60 )
60 61
61 62
62 63 TARGET_LINK_LIBRARIES(${SQPMOCKPLUGIN_LIBRARY_NAME} ${LIBRARIES})
63 64 qt5_use_modules(${SQPMOCKPLUGIN_LIBRARY_NAME} Core Widgets)
64 65
65 66 add_dependencies(${SQPMOCKPLUGIN_LIBRARY_NAME} ${SQPPLUGIN_LIBRARY_NAME} ${SQPGUI_LIBRARY_NAME} ${SQPCORE_LIBRARY_NAME})
66 67
67 68 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
68 69 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
69 70 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
70 71 IF(BUILD_SHARED_LIBS)
71 72 SET_TARGET_PROPERTIES(${SQPMOCKPLUGIN_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
72 73 ELSE()
73 74 TARGET_COMPILE_DEFINITIONS(${SQPMOCKPLUGIN_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
74 75 ENDIF()
75 76
76 77 # Set the variable to parent scope so that the other projects can copy the
77 78 # dependent shared libraries
78 79 SCIQLOP_SET_TO_PARENT_SCOPE(SQPMOCKPLUGIN_LIBRARY_NAME)
79 80
80 81 # Copy extern shared libraries to the lib folder
81 82 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPMOCKPLUGIN_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES})
82 83
83 84 # Add the files to the list of files to be analyzed
84 85 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
85 86 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
86 87 # Vera++ exclusion files
87 88 #LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
88 89 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
89 90
90 91 #
91 92 # Compile the tests
92 93 #
93 94 IF(BUILD_TESTS)
94 95 INCLUDE_DIRECTORIES(${SOURCES_DIR})
95 96 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
96 97 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
97 SET( TEST_LIBRARIES ${SQPGUI_LIBRARY_NAME})
98 SET( TEST_LIBRARIES ${SQPMOCKPLUGIN_LIBRARY_NAME})
98 99
99 100 FOREACH( testFile ${TESTS_SOURCES} )
100 101 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
101 102 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
102 103
103 104 # Add to the list of sources files all the sources in the same
104 105 # directory that aren't another test
105 106 FILE (GLOB currentTestSources
106 107 ${testDirectory}/*.c
107 108 ${testDirectory}/*.cpp
108 109 ${testDirectory}/*.h)
109 110 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
110 111 # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
111 112
112 113 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
113 114 set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
114 115 set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
115 116 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
116 117 qt5_use_modules(${testName} Test)
117 118
118 119 ADD_TEST( NAME ${testName} COMMAND ${testName} )
119 120
120 121 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
121 122 ENDFOREACH( testFile )
122 123
123 124 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
124 125 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
125 126 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
126 127 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
128
129 ADD_DEFINITIONS(-DMOCKPLUGIN_TESTS_RESOURCES_DIR="${TESTS_RESOURCES_DIR}")
127 130 ENDIF(BUILD_TESTS)
128 131
129 132 #
130 133 # Set the files that must be formatted by clang-format.
131 134 #
132 135 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
133 136 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
134 137
135 138 #
136 139 # Set the directories that doxygen must browse to generate the
137 140 # documentation.
138 141 #
139 142 # Source directories:
140 143 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
141 144 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
142 145 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
143 146 # Source directories to exclude from the documentation generation
144 147 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
145 148 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
146 149
147 150 #
148 151 # Set the directories with the sources to analyze and propagate the
149 152 # modification to the parent scope
150 153 #
151 154 # Source directories to analyze:
152 155 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
153 156 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
154 157 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
155 158 # Source directories to exclude from the analysis
156 159 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
157 160 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
General Comments 0
You need to be logged in to leave comments. Login now