diff --git a/tests/src/core/testqgsapplication.cpp b/tests/src/core/testqgsapplication.cpp index bb9ac9e2906..af3d2794833 100644 --- a/tests/src/core/testqgsapplication.cpp +++ b/tests/src/core/testqgsapplication.cpp @@ -26,42 +26,27 @@ class TestQgsApplication: public QObject { Q_OBJECT; private slots: - void getPaths(); void checkTheme(); + void initTestCase(); private: QString getQgisPath(); }; -QString TestQgsApplication::getQgisPath() -{ -#ifdef Q_OS_LINUX - QString qgisPath = QCoreApplication::applicationDirPath () + "/../"; -#else //mac and win - QString qgisPath = QCoreApplication::applicationDirPath () ; -#endif - return qgisPath; -} -void TestQgsApplication::getPaths() +void TestQgsGeometry::initTestCase() { + // + // Runs once before any tests are run + // // init QGIS's paths - true means that all path will be inited from prefix - QgsApplication::setPrefixPath(getQgisPath(), TRUE); - - std::cout << "Prefix PATH: " << QgsApplication::prefixPath().toLocal8Bit().data() << std::endl; - std::cout << "Plugin PATH: " << QgsApplication::pluginPath().toLocal8Bit().data() << std::endl; - std::cout << "PkgData PATH: " << QgsApplication::pkgDataPath().toLocal8Bit().data() << std::endl; - std::cout << "User DB PATH: " << QgsApplication::qgisUserDbFilePath().toLocal8Bit().data() << std::endl; - + QString qgisPath = QCoreApplication::applicationDirPath (); + QgsApplication::setPrefixPath(INSTALL_PREFIX, true); + QgsApplication::showSettings(); }; void TestQgsApplication::checkTheme() { QgsApplication::setPrefixPath(getQgisPath(), TRUE); - - std::cout << "Prefix PATH: " << QgsApplication::prefixPath().toLocal8Bit().data() << std::endl; - std::cout << "Plugin PATH: " << QgsApplication::pluginPath().toLocal8Bit().data() << std::endl; - std::cout << "PkgData PATH: " << QgsApplication::pkgDataPath().toLocal8Bit().data() << std::endl; - std::cout << "User DB PATH: " << QgsApplication::qgisUserDbFilePath().toLocal8Bit().data() << std::endl; QString myIconPath = QgsApplication::themePath(); QPixmap myPixmap; myPixmap.load(myIconPath+"/mIconProjectionDisabled.png"); diff --git a/tests/src/core/testqgsgeometry.cpp b/tests/src/core/testqgsgeometry.cpp index f455f6d81f6..8151df304ac 100644 --- a/tests/src/core/testqgsgeometry.cpp +++ b/tests/src/core/testqgsgeometry.cpp @@ -35,7 +35,6 @@ class TestQgsGeometry: public QObject { Q_OBJECT; private slots: - QString getQgisPath(); // Gets the path to QGIS installation void initTestCase();// will be called before the first testfunction is executed. void cleanupTestCase();// will be called after the last testfunction was executed. void init();// will be called before each testfunction is executed. @@ -64,15 +63,6 @@ class TestQgsGeometry: public QObject QString mTestDataDir; }; -QString TestQgsGeometry::getQgisPath() -{ -#ifdef Q_OS_LINUX - QString qgisPath = QCoreApplication::applicationDirPath () + "/../"; -#else //mac and win - QString qgisPath = QCoreApplication::applicationDirPath () ; -#endif - return qgisPath; -} void TestQgsGeometry::init() { @@ -118,19 +108,11 @@ void TestQgsGeometry::initTestCase() // Runs once before any tests are run // // init QGIS's paths - true means that all path will be inited from prefix - //QString qgisPath = QCoreApplication::applicationDirPath (); - QgsApplication::setPrefixPath(getQgisPath(), TRUE); -#ifdef Q_OS_LINUX -// QgsApplication::setPkgDataPath(qgisPath + "/../share/qgis"); -// QgsApplication::setPluginPath(qgisPath + "/../lib/qgis"); -#endif - - std::cout << "Prefix PATH: " << QgsApplication::prefixPath().toLocal8Bit().data() << std::endl; - std::cout << "Plugin PATH: " << QgsApplication::pluginPath().toLocal8Bit().data() << std::endl; - std::cout << "PkgData PATH: " << QgsApplication::pkgDataPath().toLocal8Bit().data() << std::endl; - std::cout << "User DB PATH: " << QgsApplication::qgisUserDbFilePath().toLocal8Bit().data() << std::endl; - + QString qgisPath = QCoreApplication::applicationDirPath (); + QgsApplication::setPrefixPath(INSTALL_PREFIX, true); + QgsApplication::showSettings(); } + void TestQgsGeometry::cleanupTestCase() { // diff --git a/tests/src/core/testqgsmaplayer.cpp b/tests/src/core/testqgsmaplayer.cpp index d718f970f72..18124eef8b1 100644 --- a/tests/src/core/testqgsmaplayer.cpp +++ b/tests/src/core/testqgsmaplayer.cpp @@ -47,23 +47,17 @@ class TestQgsMapLayer: public QObject void TestQgsMapLayer::initTestCase() { + // + // Runs once before any tests are run + // // init QGIS's paths - true means that all path will be inited from prefix QString qgisPath = QCoreApplication::applicationDirPath (); - QgsApplication::setPrefixPath(qgisPath, TRUE); -#ifdef Q_OS_LINUX - QgsApplication::setPkgDataPath(qgisPath + "/../share/qgis"); - QgsApplication::setPluginPath(qgisPath + "/../lib/qgis"); -#endif + QgsApplication::setPrefixPath(INSTALL_PREFIX, true); + QgsApplication::showSettings(); // Instantiate the plugin directory so that providers are loaded QgsProviderRegistry::instance(QgsApplication::pluginPath()); //create some objects that will be used in all tests... - - std::cout << "Prefix PATH: " << QgsApplication::prefixPath().toLocal8Bit().data() << std::endl; - std::cout << "Plugin PATH: " << QgsApplication::pluginPath().toLocal8Bit().data() << std::endl; - std::cout << "PkgData PATH: " << QgsApplication::pkgDataPath().toLocal8Bit().data() << std::endl; - std::cout << "User DB PATH: " << QgsApplication::qgisUserDbFilePath().toLocal8Bit().data() << std::endl; - //create a map layer that will be used in all tests... QString myFileName (TEST_DATA_DIR); //defined in CmakeLists.txt myFileName = myFileName + QDir::separator() + "points.shp";