2022-03-10 19:49:42 +01:00
|
|
|
cmake_minimum_required(VERSION 3.5)
|
|
|
|
|
2022-04-19 21:45:26 +04:00
|
|
|
project(TestStatusQ LANGUAGES CXX)
|
2022-03-10 19:49:42 +01:00
|
|
|
|
2022-08-08 11:31:24 +02:00
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
|
2023-12-18 22:28:04 +01:00
|
|
|
find_package(Qt5 COMPONENTS QuickTest Qml Quick WebEngine REQUIRED)
|
2022-03-10 19:49:42 +01:00
|
|
|
|
2023-12-18 22:28:04 +01:00
|
|
|
##############
|
|
|
|
# Test Library
|
|
|
|
##############
|
2022-03-10 19:49:42 +01:00
|
|
|
|
2023-12-18 22:28:04 +01:00
|
|
|
add_library(StatusQTestLib
|
|
|
|
src/TestHelpers/MonitorQtOutput.cpp
|
|
|
|
src/TestHelpers/MonitorQtOutput.h
|
2023-12-21 14:46:09 +01:00
|
|
|
src/TestHelpers/listmodelwrapper.cpp
|
|
|
|
src/TestHelpers/listmodelwrapper.h
|
2023-12-19 16:24:31 +01:00
|
|
|
src/TestHelpers/modelaccessobserverproxy.cpp
|
|
|
|
src/TestHelpers/modelaccessobserverproxy.h
|
2023-12-21 16:06:52 +01:00
|
|
|
src/TestHelpers/testmodel.cpp
|
|
|
|
src/TestHelpers/testmodel.h
|
2023-12-18 22:28:04 +01:00
|
|
|
)
|
2022-03-10 19:49:42 +01:00
|
|
|
|
2023-12-18 22:28:04 +01:00
|
|
|
target_link_libraries(StatusQTestLib PUBLIC Qt5::Core Qt5::Quick)
|
|
|
|
target_include_directories(StatusQTestLib PUBLIC src)
|
2022-04-19 21:45:26 +04:00
|
|
|
|
2023-12-18 22:28:04 +01:00
|
|
|
enable_testing()
|
2022-03-10 19:49:42 +01:00
|
|
|
|
2023-12-18 22:28:04 +01:00
|
|
|
###########
|
|
|
|
# QML Tests
|
|
|
|
###########
|
2022-03-21 13:04:11 +02:00
|
|
|
|
2023-12-18 22:28:04 +01:00
|
|
|
file(GLOB_RECURSE TEST_QML_FILES "*.qml")
|
|
|
|
add_executable(QmlTests main.cpp "${TEST_QML_FILES}")
|
2022-03-21 13:04:11 +02:00
|
|
|
|
2023-12-18 22:28:04 +01: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 13:04:11 +02:00
|
|
|
)
|
2023-04-14 11:18:56 +03:00
|
|
|
|
2023-12-18 22:28:04 +01:00
|
|
|
###########
|
|
|
|
# C++ Tests
|
|
|
|
###########
|
2023-10-24 10:55:25 +02:00
|
|
|
|
|
|
|
add_executable(RolesRenamingModelTest tst_RolesRenamingModel.cpp)
|
2023-12-21 16:06:52 +01:00
|
|
|
target_link_libraries(RolesRenamingModelTest PRIVATE Qt5::Test StatusQ StatusQTestLib)
|
2023-11-23 12:38:09 +01:00
|
|
|
add_test(NAME RolesRenamingModelTest COMMAND RolesRenamingModelTest)
|
2023-10-24 11:08:30 +02:00
|
|
|
|
|
|
|
add_executable(LeftJoinModelTest tst_LeftJoinModel.cpp)
|
2023-12-21 16:06:52 +01:00
|
|
|
target_link_libraries(LeftJoinModelTest PRIVATE Qt5::Test StatusQ StatusQTestLib)
|
2023-11-23 12:38:09 +01:00
|
|
|
add_test(NAME LeftJoinModelTest COMMAND LeftJoinModelTest)
|
2023-11-04 21:32:54 +01:00
|
|
|
|
|
|
|
add_executable(SubmodelProxyModelTest tst_SubmodelProxyModel.cpp)
|
2023-12-21 16:06:52 +01:00
|
|
|
target_link_libraries(SubmodelProxyModelTest PRIVATE Qt5::Test StatusQ StatusQTestLib)
|
2023-11-23 12:38:09 +01:00
|
|
|
add_test(NAME SubmodelProxyModelTest COMMAND SubmodelProxyModelTest)
|
2023-11-30 13:50:04 +01:00
|
|
|
|
|
|
|
add_executable(AggregatorTest tst_Aggregator.cpp)
|
2023-12-21 16:06:52 +01:00
|
|
|
target_link_libraries(AggregatorTest PRIVATE Qt5::Test StatusQ StatusQTestLib)
|
2023-11-30 13:50:04 +01:00
|
|
|
add_test(NAME AggregatorTest COMMAND AggregatorTest)
|
|
|
|
|
|
|
|
add_executable(SingleRoleAggregatorTest tst_SingleRoleAggregator.cpp)
|
2023-12-21 16:06:52 +01:00
|
|
|
target_link_libraries(SingleRoleAggregatorTest PRIVATE Qt5::Test StatusQ StatusQTestLib)
|
2023-11-30 13:50:04 +01:00
|
|
|
add_test(NAME SingleRoleAggregatorTest COMMAND SingleRoleAggregatorTest)
|
|
|
|
|
|
|
|
add_executable(SumAggregatorTest tst_SumAggregator.cpp)
|
2023-12-21 16:06:52 +01:00
|
|
|
target_link_libraries(SumAggregatorTest PRIVATE Qt5::Test StatusQ StatusQTestLib)
|
2023-11-30 13:50:04 +01:00
|
|
|
add_test(NAME SumAggregatorTest COMMAND SumAggregatorTest)
|
2023-11-22 10:28:53 +01:00
|
|
|
|
|
|
|
add_executable(ConcatModelTest tst_ConcatModel.cpp)
|
2023-12-21 16:06:52 +01:00
|
|
|
target_link_libraries(ConcatModelTest PRIVATE Qt5::Test StatusQ StatusQTestLib)
|
2023-11-22 10:28:53 +01:00
|
|
|
add_test(NAME ConcatModelTest COMMAND ConcatModelTest)
|
2023-11-28 18:35:09 +02:00
|
|
|
|
|
|
|
add_executable(WritableProxyModelTest tst_WritableProxyModel.cpp)
|
|
|
|
target_link_libraries(WritableProxyModelTest PRIVATE Qt5::Qml Qt5::Test StatusQ)
|
|
|
|
add_test(NAME WritableProxyModelTest COMMAND WritableProxyModelTest)
|