2022-03-10 18:49:42 +00:00
|
|
|
cmake_minimum_required(VERSION 3.5)
|
|
|
|
|
2022-04-19 17:45:26 +00:00
|
|
|
project(TestStatusQ LANGUAGES CXX)
|
2022-03-10 18:49:42 +00:00
|
|
|
|
2022-08-08 09:31:24 +00:00
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
|
2023-12-18 21:28:04 +00:00
|
|
|
find_package(Qt5 COMPONENTS QuickTest Qml Quick WebEngine REQUIRED)
|
2022-03-10 18:49:42 +00:00
|
|
|
|
2023-12-18 21:28:04 +00:00
|
|
|
##############
|
|
|
|
# Test Library
|
|
|
|
##############
|
2022-03-10 18:49:42 +00:00
|
|
|
|
2023-12-18 21:28:04 +00:00
|
|
|
add_library(StatusQTestLib
|
|
|
|
src/TestHelpers/MonitorQtOutput.cpp
|
|
|
|
src/TestHelpers/MonitorQtOutput.h
|
2023-12-21 13:46:09 +00:00
|
|
|
src/TestHelpers/listmodelwrapper.cpp
|
|
|
|
src/TestHelpers/listmodelwrapper.h
|
2023-12-19 15:24:31 +00:00
|
|
|
src/TestHelpers/modelaccessobserverproxy.cpp
|
|
|
|
src/TestHelpers/modelaccessobserverproxy.h
|
2024-01-16 09:31:24 +00:00
|
|
|
src/TestHelpers/modelsignalsspy.cpp
|
|
|
|
src/TestHelpers/modelsignalsspy.h
|
2024-01-16 09:49:52 +00:00
|
|
|
src/TestHelpers/modeltestutils.cpp
|
|
|
|
src/TestHelpers/modeltestutils.h
|
2024-02-21 13:29:57 +00:00
|
|
|
src/TestHelpers/persistentindexestester.cpp
|
|
|
|
src/TestHelpers/persistentindexestester.h
|
2024-01-16 09:49:52 +00:00
|
|
|
src/TestHelpers/snapshotmodel.cpp
|
|
|
|
src/TestHelpers/snapshotmodel.h
|
2023-12-21 15:06:52 +00:00
|
|
|
src/TestHelpers/testmodel.cpp
|
|
|
|
src/TestHelpers/testmodel.h
|
2023-12-18 21:28:04 +00:00
|
|
|
)
|
2022-03-10 18:49:42 +00:00
|
|
|
|
2024-01-16 09:31:24 +00:00
|
|
|
target_link_libraries(StatusQTestLib PUBLIC Qt5::Core Qt5::Quick Qt5::Test)
|
2023-12-18 21:28:04 +00:00
|
|
|
target_include_directories(StatusQTestLib PUBLIC src)
|
2022-04-19 17:45:26 +00:00
|
|
|
|
2023-12-18 21:28:04 +00:00
|
|
|
enable_testing()
|
2022-03-10 18:49:42 +00:00
|
|
|
|
2023-12-18 21:28:04 +00:00
|
|
|
###########
|
|
|
|
# QML Tests
|
|
|
|
###########
|
2022-03-21 11:04:11 +00:00
|
|
|
|
2023-12-18 21:28:04 +00:00
|
|
|
file(GLOB_RECURSE TEST_QML_FILES "*.qml")
|
|
|
|
add_executable(QmlTests main.cpp "${TEST_QML_FILES}")
|
2022-03-21 11:04:11 +00:00
|
|
|
|
2023-12-18 21:28:04 +00:00
|
|
|
target_compile_definitions(QmlTests PRIVATE
|
|
|
|
STATUSQ_MODULE_PATH="${STATUSQ_MODULE_PATH}"
|
|
|
|
STATUSQ_MODULE_IMPORT_PATH="${STATUSQ_MODULE_IMPORT_PATH}"
|
|
|
|
# no need to copy around qml test files for shadow builds - just set the respective define
|
|
|
|
QUICK_TEST_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
|
|
|
|
)
|
|
|
|
target_link_libraries(QmlTests PRIVATE Qt5::QuickTest Qt5::Qml Qt5::Quick
|
|
|
|
Qt5::WebEngine StatusQ StatusQTestLib
|
|
|
|
)
|
|
|
|
add_test(NAME QmlTests WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
COMMAND QmlTests -input "${CMAKE_CURRENT_SOURCE_DIR}"
|
2022-03-21 11:04:11 +00:00
|
|
|
)
|
2023-04-14 08:18:56 +00:00
|
|
|
|
2023-12-18 21:28:04 +00:00
|
|
|
###########
|
|
|
|
# C++ Tests
|
|
|
|
###########
|
2023-10-24 08:55:25 +00:00
|
|
|
|
|
|
|
add_executable(RolesRenamingModelTest tst_RolesRenamingModel.cpp)
|
2024-01-16 09:31:24 +00:00
|
|
|
target_link_libraries(RolesRenamingModelTest PRIVATE StatusQ StatusQTestLib)
|
2023-11-23 11:38:09 +00:00
|
|
|
add_test(NAME RolesRenamingModelTest COMMAND RolesRenamingModelTest)
|
2023-10-24 09:08:30 +00:00
|
|
|
|
|
|
|
add_executable(LeftJoinModelTest tst_LeftJoinModel.cpp)
|
2024-01-16 09:31:24 +00:00
|
|
|
target_link_libraries(LeftJoinModelTest PRIVATE StatusQ StatusQTestLib)
|
2023-11-23 11:38:09 +00:00
|
|
|
add_test(NAME LeftJoinModelTest COMMAND LeftJoinModelTest)
|
2023-11-04 20:32:54 +00:00
|
|
|
|
|
|
|
add_executable(SubmodelProxyModelTest tst_SubmodelProxyModel.cpp)
|
2024-01-16 09:31:24 +00:00
|
|
|
target_link_libraries(SubmodelProxyModelTest PRIVATE StatusQ StatusQTestLib)
|
2023-11-23 11:38:09 +00:00
|
|
|
add_test(NAME SubmodelProxyModelTest COMMAND SubmodelProxyModelTest)
|
2023-11-30 12:50:04 +00:00
|
|
|
|
|
|
|
add_executable(AggregatorTest tst_Aggregator.cpp)
|
2024-01-16 09:31:24 +00:00
|
|
|
target_link_libraries(AggregatorTest PRIVATE StatusQ StatusQTestLib)
|
2023-11-30 12:50:04 +00:00
|
|
|
add_test(NAME AggregatorTest COMMAND AggregatorTest)
|
|
|
|
|
|
|
|
add_executable(SingleRoleAggregatorTest tst_SingleRoleAggregator.cpp)
|
2024-01-16 09:31:24 +00:00
|
|
|
target_link_libraries(SingleRoleAggregatorTest PRIVATE StatusQ StatusQTestLib)
|
2023-11-30 12:50:04 +00:00
|
|
|
add_test(NAME SingleRoleAggregatorTest COMMAND SingleRoleAggregatorTest)
|
|
|
|
|
|
|
|
add_executable(SumAggregatorTest tst_SumAggregator.cpp)
|
2024-01-16 09:31:24 +00:00
|
|
|
target_link_libraries(SumAggregatorTest PRIVATE StatusQ StatusQTestLib)
|
2023-11-30 12:50:04 +00:00
|
|
|
add_test(NAME SumAggregatorTest COMMAND SumAggregatorTest)
|
2023-11-22 09:28:53 +00:00
|
|
|
|
|
|
|
add_executable(ConcatModelTest tst_ConcatModel.cpp)
|
2024-01-16 09:31:24 +00:00
|
|
|
target_link_libraries(ConcatModelTest PRIVATE StatusQ StatusQTestLib)
|
2023-11-22 09:28:53 +00:00
|
|
|
add_test(NAME ConcatModelTest COMMAND ConcatModelTest)
|
2023-11-28 16:35:09 +00:00
|
|
|
|
|
|
|
add_executable(WritableProxyModelTest tst_WritableProxyModel.cpp)
|
2024-01-16 10:18:49 +00:00
|
|
|
target_link_libraries(WritableProxyModelTest PRIVATE StatusQ StatusQTestLib)
|
2023-11-28 16:35:09 +00:00
|
|
|
add_test(NAME WritableProxyModelTest COMMAND WritableProxyModelTest)
|
2024-01-16 10:18:49 +00:00
|
|
|
|
|
|
|
add_executable(MovableModelTest tst_MovableModel.cpp)
|
|
|
|
target_link_libraries(MovableModelTest PRIVATE StatusQ StatusQTestLib)
|
|
|
|
add_test(NAME MovableModelTest COMMAND MovableModelTest)
|