From 8ac17bcea77d1a2d3c7e712029f52e58f420e5cc Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Sat, 29 Jun 2024 16:05:31 +0700 Subject: [PATCH] Initiate QGIS as part of QML tests --- test/test_qml.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/test_qml.cpp b/test/test_qml.cpp index e73829d889..93e4da58b6 100644 --- a/test/test_qml.cpp +++ b/test/test_qml.cpp @@ -16,7 +16,9 @@ ***************************************************************************/ #include "coordinatereferencesystemutils.h" +#include "platformutilities.h" #include "positioning.h" +#include "qfield.h" #include "qfield_qml_init.h" #include "qgsquickcoordinatetransformer.h" #include "valuemapmodel.h" @@ -27,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -162,6 +165,18 @@ class Setup : public QObject mNmeaServerHappy.start( nmeaServerLocation ); mNmeaServerHappyWithIMU.start( nmeaServerLocation ); mNmeaServerHappyMonch2WithIMU.start( nmeaServerLocation ); + + QCoreApplication::setOrganizationName( "OPENGIS.ch" ); + QCoreApplication::setOrganizationDomain( "opengis.ch" ); + QCoreApplication::setApplicationName( qfield::appName ); + + QgsApplication::setPrefixPath( QGIS_PREFIX_PATH, true ); + + QgsApplication::initQgis(); +#ifdef RELATIVE_PREFIX_PATH + QgsApplication::setPkgDataPath( PlatformUtilities::instance()->systemSharedDataLocation() + QStringLiteral( "/qgis" ) ); +#endif + QgsApplication::createDatabase(); } void cleanupTestCase() @@ -170,6 +185,8 @@ class Setup : public QObject mNmeaServerHappy.kill(); mNmeaServerHappyWithIMU.kill(); mNmeaServerHappyMonch2WithIMU.kill(); + + QgsApplication::exitQgis(); } void qmlEngineAvailable( QQmlEngine *engine )