Skip to content

Commit

Permalink
Use qgisapp path properly for quickprint test too
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8718 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Jul 6, 2008
1 parent 3019d8c commit 4daf025
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 24 deletions.
1 change: 1 addition & 0 deletions tests/src/gui/CMakeLists.txt
Expand Up @@ -43,6 +43,7 @@ ENDIF (WIN32)
# the TEST_DATA_DIR variable is set in the top level CMakeLists.txt
ADD_DEFINITIONS(-DTEST_DATA_DIR="\\"${TEST_DATA_DIR}\\"")

ADD_DEFINITIONS(-DINSTALL_PREFIX="\\"${CMAKE_INSTALL_PREFIX}\\"")
#############################################################
# libraries

Expand Down
30 changes: 6 additions & 24 deletions tests/src/gui/testqgsquickprint.cpp
Expand Up @@ -46,7 +46,6 @@ class TestQgsQuickPrint: public QObject
void cleanup(){};// will be called after every testfunction.

void basicMapTest();
QString getQgisPath(); // Gets the path to QGIS installation
private:
bool imageCheck(QString theType); //as above
QgsMapRender * mpMapRenderer;
Expand All @@ -57,35 +56,18 @@ class TestQgsQuickPrint: public QObject
QString mReport;
};

QString TestQgsQuickPrint::getQgisPath()
{
#ifdef Q_OS_LINUX
QString qgisPath = QCoreApplication::applicationDirPath () + "/../";
#else //mac and win
QString qgisPath = QCoreApplication::applicationDirPath () ;
#endif
return qgisPath;
}

void TestQgsQuickPrint::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
QString qgisPath = QCoreApplication::applicationDirPath ();
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 point layer that will be used in all tests...
//
Expand Down

0 comments on commit 4daf025

Please sign in to comment.