Skip to content

Commit

Permalink
Initiate QGIS as part of QML tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Jun 29, 2024
1 parent 3ac3219 commit 8ac17bc
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/test_qml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -27,6 +29,7 @@
#include <QQmlFileSelector>
#include <QtQuickTest>
#include <qgis.h>
#include <qgsapplication.h>
#include <qgscoordinatereferencesystem.h>
#include <qgsfeature.h>
#include <qgsgeometry.h>
Expand Down Expand Up @@ -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()
Expand All @@ -170,6 +185,8 @@ class Setup : public QObject
mNmeaServerHappy.kill();
mNmeaServerHappyWithIMU.kill();
mNmeaServerHappyMonch2WithIMU.kill();

QgsApplication::exitQgis();
}

void qmlEngineAvailable( QQmlEngine *engine )
Expand Down

1 comment on commit 8ac17bc

@qfield-fairy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.