Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
More debugging output for raster layer test
  • Loading branch information
nyalldawson committed Jan 13, 2016
1 parent 76f3bc1 commit 3da051b
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions tests/src/core/testqgsrasterlayer.cpp
Expand Up @@ -82,7 +82,7 @@ class TestQgsRasterLayer : public QObject
void setRenderer();
private:
bool render( const QString& theFileName );
bool setQml( const QString& theType );
bool setQml( const QString& theType, QString& msg );
void populateColorRampShader( QgsColorRampShader* colorRampShader,
QgsVectorColorRampV2* colorRamp,
int numberOfEntries );
Expand Down Expand Up @@ -115,6 +115,7 @@ class TestSignalReceiver : public QObject
//runs before all tests
void TestQgsRasterLayer::initTestCase()
{
std::cout << "CTEST_FULL_OUTPUT" << std::endl;
// init QGIS's paths - true means that all path will be inited from prefix
QgsApplication::init();
QgsApplication::initQgis();
Expand Down Expand Up @@ -322,6 +323,7 @@ void TestQgsRasterLayer::colorRamp4()

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

void TestQgsRasterLayer::landsatBasic875Qml()
{
QVERIFY2( mpLandsatRasterLayer->isValid(), "landsat.tif layer is not valid!" );
//a qml that orders the rgb bands as 8,7,5
mMapSettings->setLayers( QStringList() << mpLandsatRasterLayer->id() );
mMapSettings->setExtent( mpLandsatRasterLayer->extent() );
QVERIFY( setQml( "875" ) );
QString msg;
bool result = setQml( "875", msg );
QVERIFY2( result, msg.toLocal8Bit().constData() );
QVERIFY( render( "landsat_875" ) );
}
void TestQgsRasterLayer::checkDimensions()
Expand Down Expand Up @@ -535,24 +540,25 @@ bool TestQgsRasterLayer::render( const QString& theTestType )
return myResultFlag;
}

bool TestQgsRasterLayer::setQml( const QString& theType )
bool TestQgsRasterLayer::setQml( const QString& theType, QString& msg )
{
//load a qml style and apply to our layer
// huh? this is failing but shouldnt!
//if (! mpLandsatRasterLayer->isValid() )
//{
// qDebug(" **** setQml -> mpLandsatRasterLayer is invalid");
// return false;
//}
if ( !mpLandsatRasterLayer->isValid() )
{
msg = " **** setQml -> mpLandsatRasterLayer is invalid";
return false;
}

QString myFileName = mTestDataDir + "landsat_" + theType + ".qml";
bool myStyleFlag = false;
mpLandsatRasterLayer->loadNamedStyle( myFileName, myStyleFlag );
QString loadStyleMsg;
loadStyleMsg = mpLandsatRasterLayer->loadNamedStyle( myFileName, myStyleFlag );
if ( !myStyleFlag )
{
qDebug( " **** setQml -> mpLandsatRasterLayer is invalid" );
qDebug( "Qml File :%s", myFileName.toLocal8Bit().constData() );
msg = QString( "Loading QML %1 failed: %2" ).arg( myFileName, loadStyleMsg );
return false;
}
return myStyleFlag;
return true;
}

void TestQgsRasterLayer::transparency()
Expand Down

0 comments on commit 3da051b

Please sign in to comment.