Added unit test for GDAL_SKIP stuff

This commit is contained in:
Tim Sutton 2011-09-13 11:39:16 +02:00
parent 9561c3d696
commit 28319682f3
2 changed files with 15 additions and 2 deletions

View File

@ -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)
#############################################################

View File

@ -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"