@@ -82,7 +82,7 @@ class TestQgsRasterLayer : public QObject
82
82
void setRenderer ();
83
83
private:
84
84
bool render ( const QString& theFileName );
85
- bool setQml ( const QString& theType );
85
+ bool setQml ( const QString& theType, QString& msg );
86
86
void populateColorRampShader ( QgsColorRampShader* colorRampShader,
87
87
QgsVectorColorRampV2* colorRamp,
88
88
int numberOfEntries );
@@ -115,6 +115,7 @@ class TestSignalReceiver : public QObject
115
115
// runs before all tests
116
116
void TestQgsRasterLayer::initTestCase ()
117
117
{
118
+ std::cout << " CTEST_FULL_OUTPUT" << std::endl;
118
119
// init QGIS's paths - true means that all path will be inited from prefix
119
120
QgsApplication::init ();
120
121
QgsApplication::initQgis ();
@@ -322,6 +323,7 @@ void TestQgsRasterLayer::colorRamp4()
322
323
323
324
void TestQgsRasterLayer::landsatBasic ()
324
325
{
326
+ QVERIFY2 ( mpLandsatRasterLayer->isValid (), " landsat.tif layer is not valid!" );
325
327
mpLandsatRasterLayer->setContrastEnhancement ( QgsContrastEnhancement::StretchToMinimumMaximum, QgsRaster::ContrastEnhancementMinMax );
326
328
mMapSettings ->setLayers ( QStringList () << mpLandsatRasterLayer->id () );
327
329
mMapSettings ->setExtent ( mpLandsatRasterLayer->extent () );
@@ -330,10 +332,13 @@ void TestQgsRasterLayer::landsatBasic()
330
332
331
333
void TestQgsRasterLayer::landsatBasic875Qml ()
332
334
{
335
+ QVERIFY2 ( mpLandsatRasterLayer->isValid (), " landsat.tif layer is not valid!" );
333
336
// a qml that orders the rgb bands as 8,7,5
334
337
mMapSettings ->setLayers ( QStringList () << mpLandsatRasterLayer->id () );
335
338
mMapSettings ->setExtent ( mpLandsatRasterLayer->extent () );
336
- QVERIFY ( setQml ( " 875" ) );
339
+ QString msg;
340
+ bool result = setQml ( " 875" , msg );
341
+ QVERIFY2 ( result, msg.toLocal8Bit ().constData () );
337
342
QVERIFY ( render ( " landsat_875" ) );
338
343
}
339
344
void TestQgsRasterLayer::checkDimensions ()
@@ -535,24 +540,25 @@ bool TestQgsRasterLayer::render( const QString& theTestType )
535
540
return myResultFlag;
536
541
}
537
542
538
- bool TestQgsRasterLayer::setQml ( const QString& theType )
543
+ bool TestQgsRasterLayer::setQml ( const QString& theType, QString& msg )
539
544
{
540
545
// 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
+
547
552
QString myFileName = mTestDataDir + " landsat_" + theType + " .qml" ;
548
553
bool myStyleFlag = false ;
549
- mpLandsatRasterLayer->loadNamedStyle ( myFileName, myStyleFlag );
554
+ QString loadStyleMsg;
555
+ loadStyleMsg = mpLandsatRasterLayer->loadNamedStyle ( myFileName, myStyleFlag );
550
556
if ( !myStyleFlag )
551
557
{
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 ;
554
560
}
555
- return myStyleFlag ;
561
+ return true ;
556
562
}
557
563
558
564
void TestQgsRasterLayer::transparency ()
0 commit comments