[QGIS Commit] r8715 - trunk/qgis/tests/src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Jul 6 18:04:29 EDT 2008


Author: timlinux
Date: 2008-07-06 18:04:28 -0400 (Sun, 06 Jul 2008)
New Revision: 8715

Modified:
   trunk/qgis/tests/src/core/testqgsapplication.cpp
   trunk/qgis/tests/src/core/testqgsgeometry.cpp
   trunk/qgis/tests/src/core/testqgsmaplayer.cpp
Log:
Updates so that paths are correctly set based on changes in 
qgisapplication



Modified: trunk/qgis/tests/src/core/testqgsapplication.cpp
===================================================================
--- trunk/qgis/tests/src/core/testqgsapplication.cpp	2008-07-06 11:46:51 UTC (rev 8714)
+++ trunk/qgis/tests/src/core/testqgsapplication.cpp	2008-07-06 22:04:28 UTC (rev 8715)
@@ -26,42 +26,27 @@
 {
   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");

Modified: trunk/qgis/tests/src/core/testqgsgeometry.cpp
===================================================================
--- trunk/qgis/tests/src/core/testqgsgeometry.cpp	2008-07-06 11:46:51 UTC (rev 8714)
+++ trunk/qgis/tests/src/core/testqgsgeometry.cpp	2008-07-06 22:04:28 UTC (rev 8715)
@@ -35,7 +35,6 @@
 {
   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 @@
     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 @@
   // 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()
 {
   //

Modified: trunk/qgis/tests/src/core/testqgsmaplayer.cpp
===================================================================
--- trunk/qgis/tests/src/core/testqgsmaplayer.cpp	2008-07-06 11:46:51 UTC (rev 8714)
+++ trunk/qgis/tests/src/core/testqgsmaplayer.cpp	2008-07-06 22:04:28 UTC (rev 8715)
@@ -47,23 +47,17 @@
 
 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";



More information about the QGIS-commit mailing list