Skip to content

Commit

Permalink
Added unit test for GDAL_SKIP stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
timlinux committed Sep 13, 2011
1 parent 9561c3d commit 2831968
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions tests/src/core/CMakeLists.txt
Expand Up @@ -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)

#############################################################
Expand Down
14 changes: 12 additions & 2 deletions tests/src/core/testqgsapplication.cpp
Expand Up @@ -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>
Expand All @@ -27,6 +28,7 @@ class TestQgsApplication: public QObject
Q_OBJECT;
private slots:
void checkTheme();
void checkGdalSkip();
void initTestCase();
private:
QString getQgisPath();
Expand All @@ -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"
Expand Down

0 comments on commit 2831968

Please sign in to comment.