1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED Test)
find_package(GTest CONFIG REQUIRED)
enable_testing()
set(UNITTEST_SRC
annotations/core/AnnotationAreaTest.cpp
annotations/core/AnnotationItemFactoryTest.cpp
annotations/core/AnnotationPropertiesFactoryTest.cpp
annotations/modifiers/AnnotationItemResizerTest.cpp
annotations/modifiers/AnnotationMultiItemResizerTest.cpp
annotations/modifiers/AnnotationItemSelectorTest.cpp
annotations/modifiers/AnnotationItemModifierTest.cpp
annotations/modifiers/AnnotationItemArrangerTest.cpp
annotations/modifiers/AnnotationItemMoverTest.cpp
annotations/modifiers/resizeHandles/LineResizeHandlesTest.cpp
annotations/modifiers/resizeHandles/RectResizeHandlesTest.cpp
annotations/modifiers/resizeHandles/PointerRectResizeHandlesTest.cpp
annotations/undo/AddCommandTest.cpp
annotations/undo/DeleteCommandTest.cpp
annotations/undo/ModifyCanvasCommandTest.cpp
annotations/undo/MoveCommandTest.cpp
annotations/undo/ResizeCommandTest.cpp
annotations/undo/ArrangeCommandTest.cpp
annotations/undo/CropCommandTest.cpp
annotations/undo/ScaleCommandTest.cpp
annotations/undo/PasteCommandTest.cpp
annotations/undo/RotateCommandTest.cpp
annotations/items/helper/KeyInputHelperTest.cpp
annotations/items/helper/TextCursorTest.cpp
annotations/misc/AnnotationItemClipboardTest.cpp
annotations/misc/NumberManagerTest.cpp
backend/ConfigTest.cpp
common/helper/KeyHelperTest.cpp
common/helper/MathHelperTest.cpp
common/helper/ItemHelperTest.cpp
common/helper/ShapeHelperTest.cpp
common/helper/PathHelperTest.cpp
gui/cropper/CropSelectionRestrictorTest.cpp
gui/canvasModifier/ModifyCanvasSelectionRestrictorTest.cpp
gui/selection/SelectionMoveHelperTest.cpp
gui/selection/SelectionHandlerTest.cpp
gui/selection/SelectionHandlesAllTest.cpp
gui/scaler/ScaleSizeHandlerTest.cpp
gui/annotator/tabs/AnnotationTabCloserTest.cpp
gui/annotator/tabs/AnnotationTabContextMenuTest.cpp
widgets/CustomSpinBoxTest.cpp
widgets/misc/AttachedSeparatorTest.cpp
widgets/settingsPicker/ToolPickerTest.cpp
widgets/settingsPicker/ColorPickerTest.cpp
widgets/settingsPicker/NumberPickerTest.cpp
widgets/settingsPicker/FillModePickerTest.cpp
widgets/settingsPicker/ImageEffectPickerTest.cpp
widgets/settingsPicker/StickerPickerTest.cpp
widgets/settingsPicker/ZoomPickerTest.cpp
)
set(TESTUTILS_SRC
utils/TestRunner.h
mocks/gui/selection/SelectionHandlesMock.h
mocks/backend/SettingsMock.h
mocks/MockZoomValueProvider.cpp
mocks/MockSettingsProvider.cpp
mocks/MockDevicePixelRatioScaler.cpp
mocks/MockDefaultParameters.h
mocks/MockSelectionRestrictor.cpp
)
add_library(KIMAGEANNOTATOR_STATIC STATIC ${KIMAGEANNOTATOR_SRCS})
target_link_libraries(KIMAGEANNOTATOR_STATIC
Qt${QT_MAJOR_VERSION}::Widgets
kImageAnnotator::kImageAnnotator
kColorPicker::kColorPicker
Qt${QT_MAJOR_VERSION}::Svg)
if (UNIX AND NOT APPLE)
# X11::X11 imported target only available with sufficiently new CMake
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.14.0)
target_link_libraries(KIMAGEANNOTATOR_STATIC X11::X11)
else()
target_link_libraries(KIMAGEANNOTATOR_STATIC X11)
endif()
endif ()
target_compile_definitions(KIMAGEANNOTATOR_STATIC PRIVATE KIMAGEANNOTATOR_LANG_INSTALL_DIR="${KIMAGEANNOTATOR_LANG_INSTALL_DIR}")
foreach (UnitTest ${UNITTEST_SRC})
get_filename_component(UnitTestName ${UnitTest} NAME_WE)
add_executable(${UnitTestName} ${UnitTest} ${TESTUTILS_SRC})
target_link_libraries(${UnitTestName} KIMAGEANNOTATOR_STATIC GTest::gmock Qt${QT_MAJOR_VERSION}::Test)
add_test(${UnitTestName} ${UnitTestName})
endforeach (UnitTest)
|