Skip to content
Permalink
Browse files

Added unit test for GDAL_SKIP stuff

  • Loading branch information
timlinux committed Sep 13, 2011
1 parent 9561c3d commit 28319682f392787f6f58f2035f44fc4b112a0938
Showing with 15 additions and 2 deletions.
  1. +3 −0 tests/src/core/CMakeLists.txt
  2. +12 −2 tests/src/core/testqgsapplication.cpp
@@ -61,6 +61,9 @@ MACRO (ADD_QGIS_TEST testname testsrc)
ADD_DEPENDENCIES(qgis_${testname} qgis_${testname}moc)
TARGET_LINK_LIBRARIES(qgis_${testname} ${QT_LIBRARIES} qgis_core)
ADD_TEST(qgis_${testname} qgis_${testname})
SET_TARGET_PROPERTIES(qgis_${testname} PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${QGIS_LIB_DIR}
INSTALL_RPATH_USE_LINK_PATH true )
ENDMACRO (ADD_QGIS_TEST)

#############################################################
@@ -17,7 +17,8 @@ Email : sherman at mrcc dot com

#include <QPixmap>

#include <qgsapplication.h>
#define CPL_SUPRESS_CPLUSPLUS
#include <gdal.h>

//header for class being tested
#include <qgsapplication.h>
@@ -27,6 +28,7 @@ class TestQgsApplication: public QObject
Q_OBJECT;
private slots:
void checkTheme();
void checkGdalSkip();
void initTestCase();
private:
QString getQgisPath();
@@ -48,13 +50,21 @@ void TestQgsApplication::checkTheme()
{
QString myIconPath = QgsApplication::defaultThemePath();
QPixmap myPixmap;
myPixmap.load( myIconPath + "/mIconProjectionDisabled.png" );
myPixmap.load( myIconPath + "mActionFileNew.png" );
qDebug( "Checking if a theme icon exists:" );
qDebug( "%s/mIconProjectionDisabled.png", myIconPath.toLocal8Bit().constData() );
QVERIFY( !myPixmap.isNull() );

};

void TestQgsApplication::checkGdalSkip()
{
GDALAllRegister();
QgsApplication::skipGdalDriver( "GTiff" );
QVERIFY( QgsApplication::skippedGdalDrivers( ).contains( "GTiff" ) );
QgsApplication::restoreGdalDriver( "GTiff" );
QVERIFY( !QgsApplication::skippedGdalDrivers( ).contains( "GTiff" ) );
}

QTEST_MAIN( TestQgsApplication )
#include "moc_testqgsapplication.cxx"

0 comments on commit 2831968

Please sign in to comment.
You can’t perform that action at this time.