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 <jani@apache.org>
This commit is contained in:
jan Iversen 2018-07-12 18:24:38 +02:00
parent f354592050
commit d7fed0bcb7
2 changed files with 5 additions and 7 deletions

View file

@ -77,7 +77,8 @@ add_definitions(-g)
add_definitions(-DSUBSURFACE_TEST_DATA="${SUBSURFACE_TEST_DATA}") add_definitions(-DSUBSURFACE_TEST_DATA="${SUBSURFACE_TEST_DATA}")
# Build QML test runner # 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( target_link_libraries(
TestQML TestQML
subsurface_corelib subsurface_corelib

View file

@ -6,7 +6,7 @@
#include <QQmlContext> #include <QQmlContext>
#include "core/settings/qPref.h" #include "core/settings/qPref.h"
#include "core/qt-gui.h"
// this is the content of QUICK_TEST_MAIN amended with // this is the content of QUICK_TEST_MAIN amended with
// registration of ssrf classes // registration of ssrf classes
@ -33,12 +33,9 @@ int main(int argc, char **argv)
argc--; argc--;
// Register types // Register types
auto rc = qmlRegisterType<qPref>("org.subsurfacedivelog.mobile", 1, 0, "SsrfPrefs"); register_qml_types();
if (rc < 0) {
qDebug() << "ERROR: cannot register qPref";
return -1;
}
// Run all tst_*.qml files
return quick_test_main(argc, argv, "TestQML", tst_dir); return quick_test_main(argc, argv, "TestQML", tst_dir);
#else #else
return 0; return 0;