status-desktop/ui/StatusQ/tests/CMakeLists.txt
Michał Cieślak e51667911d StatusQ: MovableModel proxy for setting custom order over source model
Proxy decorating source mode with additional method move(from, to, count)
similar to that available in ListModel. The custom order is stored within
a proxy, not altering the original model. May be useful whenever UI needs
to allow user to set custom order. Temporary state can be held in the
proxy, and send to the backend when changes are accepted.

Closes: #12686
2024-01-22 16:36:41 +01:00

94 lines
3.4 KiB
CMake

cmake_minimum_required(VERSION 3.5)
project(TestStatusQ LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
find_package(Qt5 COMPONENTS QuickTest Qml Quick WebEngine REQUIRED)
##############
# Test Library
##############
add_library(StatusQTestLib
src/TestHelpers/MonitorQtOutput.cpp
src/TestHelpers/MonitorQtOutput.h
src/TestHelpers/listmodelwrapper.cpp
src/TestHelpers/listmodelwrapper.h
src/TestHelpers/modelaccessobserverproxy.cpp
src/TestHelpers/modelaccessobserverproxy.h
src/TestHelpers/modelsignalsspy.cpp
src/TestHelpers/modelsignalsspy.h
src/TestHelpers/modeltestutils.cpp
src/TestHelpers/modeltestutils.h
src/TestHelpers/snapshotmodel.cpp
src/TestHelpers/snapshotmodel.h
src/TestHelpers/testmodel.cpp
src/TestHelpers/testmodel.h
)
target_link_libraries(StatusQTestLib PUBLIC Qt5::Core Qt5::Quick Qt5::Test)
target_include_directories(StatusQTestLib PUBLIC src)
enable_testing()
###########
# QML Tests
###########
file(GLOB_RECURSE TEST_QML_FILES "*.qml")
add_executable(QmlTests main.cpp "${TEST_QML_FILES}")
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}"
)
###########
# C++ Tests
###########
add_executable(RolesRenamingModelTest tst_RolesRenamingModel.cpp)
target_link_libraries(RolesRenamingModelTest PRIVATE StatusQ StatusQTestLib)
add_test(NAME RolesRenamingModelTest COMMAND RolesRenamingModelTest)
add_executable(LeftJoinModelTest tst_LeftJoinModel.cpp)
target_link_libraries(LeftJoinModelTest PRIVATE StatusQ StatusQTestLib)
add_test(NAME LeftJoinModelTest COMMAND LeftJoinModelTest)
add_executable(SubmodelProxyModelTest tst_SubmodelProxyModel.cpp)
target_link_libraries(SubmodelProxyModelTest PRIVATE StatusQ StatusQTestLib)
add_test(NAME SubmodelProxyModelTest COMMAND SubmodelProxyModelTest)
add_executable(AggregatorTest tst_Aggregator.cpp)
target_link_libraries(AggregatorTest PRIVATE StatusQ StatusQTestLib)
add_test(NAME AggregatorTest COMMAND AggregatorTest)
add_executable(SingleRoleAggregatorTest tst_SingleRoleAggregator.cpp)
target_link_libraries(SingleRoleAggregatorTest PRIVATE StatusQ StatusQTestLib)
add_test(NAME SingleRoleAggregatorTest COMMAND SingleRoleAggregatorTest)
add_executable(SumAggregatorTest tst_SumAggregator.cpp)
target_link_libraries(SumAggregatorTest PRIVATE StatusQ StatusQTestLib)
add_test(NAME SumAggregatorTest COMMAND SumAggregatorTest)
add_executable(ConcatModelTest tst_ConcatModel.cpp)
target_link_libraries(ConcatModelTest PRIVATE StatusQ StatusQTestLib)
add_test(NAME ConcatModelTest COMMAND ConcatModelTest)
add_executable(WritableProxyModelTest tst_WritableProxyModel.cpp)
target_link_libraries(WritableProxyModelTest PRIVATE StatusQ StatusQTestLib)
add_test(NAME WritableProxyModelTest COMMAND WritableProxyModelTest)
add_executable(MovableModelTest tst_MovableModel.cpp)
target_link_libraries(MovableModelTest PRIVATE StatusQ StatusQTestLib)
add_test(NAME MovableModelTest COMMAND MovableModelTest)