Skip to content

Commit

Permalink
Path fix for renderer test
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@7938 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann committed Jan 12, 2008
1 parent d509554 commit a36aef0
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions tests/src/core/testqgsrenderers.cpp
Expand Up @@ -42,6 +42,7 @@ class TestQgsRenderers: 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.
Expand All @@ -62,14 +63,24 @@ class TestQgsRenderers: public QObject
QString mReport;
};

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

void TestQgsRenderers::initTestCase()
{
// init QGIS's paths - true means that all path will be inited from prefix
QString qgisPath = QCoreApplication::applicationDirPath ();
QgsApplication::setPrefixPath(qgisPath, TRUE);
//QString qgisPath = QCoreApplication::applicationDirPath ();
QgsApplication::setPrefixPath(getQgisPath(), TRUE);
#ifdef Q_OS_LINUX
QgsApplication::setPkgDataPath(qgisPath + "/../share/qgis");
QgsApplication::setPluginPath(qgisPath + "/../lib/qgis");
// QgsApplication::setPkgDataPath(qgisPath + "/../share/qgis");
// QgsApplication::setPluginPath(qgisPath + "/../lib/qgis");
#endif
// Instantiate the plugin directory so that providers are loaded
QgsProviderRegistry::instance(QgsApplication::pluginPath());
Expand Down

0 comments on commit a36aef0

Please sign in to comment.