Skip to content

Commit 3da051b

Browse files
committedJan 13, 2016
More debugging output for raster layer test
1 parent 76f3bc1 commit 3da051b

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed
 

‎tests/src/core/testqgsrasterlayer.cpp

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class TestQgsRasterLayer : public QObject
8282
void setRenderer();
8383
private:
8484
bool render( const QString& theFileName );
85-
bool setQml( const QString& theType );
85+
bool setQml( const QString& theType, QString& msg );
8686
void populateColorRampShader( QgsColorRampShader* colorRampShader,
8787
QgsVectorColorRampV2* colorRamp,
8888
int numberOfEntries );
@@ -115,6 +115,7 @@ class TestSignalReceiver : public QObject
115115
//runs before all tests
116116
void TestQgsRasterLayer::initTestCase()
117117
{
118+
std::cout << "CTEST_FULL_OUTPUT" << std::endl;
118119
// init QGIS's paths - true means that all path will be inited from prefix
119120
QgsApplication::init();
120121
QgsApplication::initQgis();
@@ -322,6 +323,7 @@ void TestQgsRasterLayer::colorRamp4()
322323

323324
void TestQgsRasterLayer::landsatBasic()
324325
{
326+
QVERIFY2( mpLandsatRasterLayer->isValid(), "landsat.tif layer is not valid!" );
325327
mpLandsatRasterLayer->setContrastEnhancement( QgsContrastEnhancement::StretchToMinimumMaximum, QgsRaster::ContrastEnhancementMinMax );
326328
mMapSettings->setLayers( QStringList() << mpLandsatRasterLayer->id() );
327329
mMapSettings->setExtent( mpLandsatRasterLayer->extent() );
@@ -330,10 +332,13 @@ void TestQgsRasterLayer::landsatBasic()
330332

331333
void TestQgsRasterLayer::landsatBasic875Qml()
332334
{
335+
QVERIFY2( mpLandsatRasterLayer->isValid(), "landsat.tif layer is not valid!" );
333336
//a qml that orders the rgb bands as 8,7,5
334337
mMapSettings->setLayers( QStringList() << mpLandsatRasterLayer->id() );
335338
mMapSettings->setExtent( mpLandsatRasterLayer->extent() );
336-
QVERIFY( setQml( "875" ) );
339+
QString msg;
340+
bool result = setQml( "875", msg );
341+
QVERIFY2( result, msg.toLocal8Bit().constData() );
337342
QVERIFY( render( "landsat_875" ) );
338343
}
339344
void TestQgsRasterLayer::checkDimensions()
@@ -535,24 +540,25 @@ bool TestQgsRasterLayer::render( const QString& theTestType )
535540
return myResultFlag;
536541
}
537542

538-
bool TestQgsRasterLayer::setQml( const QString& theType )
543+
bool TestQgsRasterLayer::setQml( const QString& theType, QString& msg )
539544
{
540545
//load a qml style and apply to our layer
541-
// huh? this is failing but shouldnt!
542-
//if (! mpLandsatRasterLayer->isValid() )
543-
//{
544-
// qDebug(" **** setQml -> mpLandsatRasterLayer is invalid");
545-
// return false;
546-
//}
546+
if ( !mpLandsatRasterLayer->isValid() )
547+
{
548+
msg = " **** setQml -> mpLandsatRasterLayer is invalid";
549+
return false;
550+
}
551+
547552
QString myFileName = mTestDataDir + "landsat_" + theType + ".qml";
548553
bool myStyleFlag = false;
549-
mpLandsatRasterLayer->loadNamedStyle( myFileName, myStyleFlag );
554+
QString loadStyleMsg;
555+
loadStyleMsg = mpLandsatRasterLayer->loadNamedStyle( myFileName, myStyleFlag );
550556
if ( !myStyleFlag )
551557
{
552-
qDebug( " **** setQml -> mpLandsatRasterLayer is invalid" );
553-
qDebug( "Qml File :%s", myFileName.toLocal8Bit().constData() );
558+
msg = QString( "Loading QML %1 failed: %2" ).arg( myFileName, loadStyleMsg );
559+
return false;
554560
}
555-
return myStyleFlag;
561+
return true;
556562
}
557563

558564
void TestQgsRasterLayer::transparency()

0 commit comments

Comments
 (0)