From d7fed0bcb76cc1742f73577b70df048032f70a61 Mon Sep 17 00:00:00 2001 From: jan Iversen Date: Thu, 12 Jul 2018 18:24:38 +0200 Subject: [PATCH] tests: update testqml to use shared register_qml_types() add subsurface-helper.cpp to TestQML target remove local qmlRegisterType() and add register_qml_types() instead Signed-off-by: Jan Iversen --- tests/CMakeLists.txt | 3 ++- tests/testqml.cpp | 9 +++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d0e82e97f..863e9dd8e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -77,7 +77,8 @@ add_definitions(-g) add_definitions(-DSUBSURFACE_TEST_DATA="${SUBSURFACE_TEST_DATA}") # Build QML test runner -add_executable(TestQML testqml.cpp ) +# add_executable demands relative path, therefore ../ +add_executable(TestQML testqml.cpp ../subsurface-helper.cpp ) target_link_libraries( TestQML subsurface_corelib diff --git a/tests/testqml.cpp b/tests/testqml.cpp index fe411f0bb..8ba04da90 100644 --- a/tests/testqml.cpp +++ b/tests/testqml.cpp @@ -6,7 +6,7 @@ #include #include "core/settings/qPref.h" - +#include "core/qt-gui.h" // this is the content of QUICK_TEST_MAIN amended with // registration of ssrf classes @@ -33,12 +33,9 @@ int main(int argc, char **argv) argc--; // Register types - auto rc = qmlRegisterType("org.subsurfacedivelog.mobile", 1, 0, "SsrfPrefs"); - if (rc < 0) { - qDebug() << "ERROR: cannot register qPref"; - return -1; - } + register_qml_types(); + // Run all tst_*.qml files return quick_test_main(argc, argv, "TestQML", tst_dir); #else return 0;