Skip to content

Commit 797ff2c

Browse files
author
timlinux
committed
Use qgisapp path properly for quickprint test too
git-svn-id: http://svn.osgeo.org/qgis/trunk@8718 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 786ca98 commit 797ff2c

File tree

2 files changed

+7
-24
lines changed

2 files changed

+7
-24
lines changed

tests/src/gui/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ ENDIF (WIN32)
4343
# the TEST_DATA_DIR variable is set in the top level CMakeLists.txt
4444
ADD_DEFINITIONS(-DTEST_DATA_DIR="\\"${TEST_DATA_DIR}\\"")
4545
46+
ADD_DEFINITIONS(-DINSTALL_PREFIX="\\"${CMAKE_INSTALL_PREFIX}\\"")
4647
#############################################################
4748
# libraries
4849

tests/src/gui/testqgsquickprint.cpp

+6-24
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class TestQgsQuickPrint: public QObject
4646
void cleanup(){};// will be called after every testfunction.
4747

4848
void basicMapTest();
49-
QString getQgisPath(); // Gets the path to QGIS installation
5049
private:
5150
bool imageCheck(QString theType); //as above
5251
QgsMapRender * mpMapRenderer;
@@ -57,35 +56,18 @@ class TestQgsQuickPrint: public QObject
5756
QString mReport;
5857
};
5958

60-
QString TestQgsQuickPrint::getQgisPath()
61-
{
62-
#ifdef Q_OS_LINUX
63-
QString qgisPath = QCoreApplication::applicationDirPath () + "/../";
64-
#else //mac and win
65-
QString qgisPath = QCoreApplication::applicationDirPath () ;
66-
#endif
67-
return qgisPath;
68-
}
69-
7059
void TestQgsQuickPrint::initTestCase()
7160
{
61+
//
62+
// Runs once before any tests are run
63+
//
7264
// init QGIS's paths - true means that all path will be inited from prefix
73-
//QString qgisPath = QCoreApplication::applicationDirPath ();
74-
QgsApplication::setPrefixPath(getQgisPath(), TRUE);
75-
#ifdef Q_OS_LINUX
76-
// QgsApplication::setPkgDataPath(qgisPath + "/../share/qgis");
77-
// QgsApplication::setPluginPath(qgisPath + "/../lib/qgis");
78-
#endif
65+
QString qgisPath = QCoreApplication::applicationDirPath ();
66+
QgsApplication::setPrefixPath(INSTALL_PREFIX, true);
67+
QgsApplication::showSettings();
7968
// Instantiate the plugin directory so that providers are loaded
8069
QgsProviderRegistry::instance(QgsApplication::pluginPath());
8170

82-
//create some objects that will be used in all tests...
83-
84-
std::cout << "Prefix PATH: " << QgsApplication::prefixPath().toLocal8Bit().data() << std::endl;
85-
std::cout << "Plugin PATH: " << QgsApplication::pluginPath().toLocal8Bit().data() << std::endl;
86-
std::cout << "PkgData PATH: " << QgsApplication::pkgDataPath().toLocal8Bit().data() << std::endl;
87-
std::cout << "User DB PATH: " << QgsApplication::qgisUserDbFilePath().toLocal8Bit().data() << std::endl;
88-
8971
//
9072
//create a point layer that will be used in all tests...
9173
//

0 commit comments

Comments
 (0)