Skip to content

Commit

Permalink
wcs test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Jan 3, 2013
1 parent a575711 commit 93e0526
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions tests/src/providers/testqgswcsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,22 @@ void TestQgsWcsProvider::read( )
identifiers << "band3_float32_noct_epsg4326";

// How to reasonably log multiple fails within this loop?
QTemporaryFile* tmpFile = new QTemporaryFile( "qgis-wcs-test-XXXXXX.tif" );
tmpFile->open();
QString tmpFilePath = tmpFile->fileName();
delete tmpFile; // removes the file
foreach ( QString version, versions )
{
foreach ( QString identifier, identifiers )
{
foreach ( QString ext, QStringList() << ".tif" << ".tif.aux.xml" )
// copy to temporary to avoid creation/changes/use of GDAL .aux.xml files
QString testFilePath = mTestDataDir + "/" + identifier + ".tif";
qDebug() << "copy " << testFilePath << " to " << tmpFilePath;
if ( !QFile::copy( testFilePath, tmpFilePath ) )
{
QFile::remove( QDir::tempPath() + "/" + identifier + ext );
QVERIFY( QFile::copy( mTestDataDir + "/" + identifier + ext, QDir::tempPath() + "/" + identifier + ext ) );
mReport += QString( "Cannot copy %1 to %2" ).arg( testFilePath ).arg( tmpFilePath );
ok = false;
continue;
}

QgsDataSourceURI uri;
Expand All @@ -126,10 +134,11 @@ void TestQgsWcsProvider::read( )
uri.setParam( "version", version );
uri.setParam( "cache", "AlwaysNetwork" );

if ( !read( identifier, uri.encodedUri(), QDir::tempPath() + "/" + identifier + ".tif", mReport ) )
if ( !read( identifier, uri.encodedUri(), tmpFilePath, mReport ) )
{
ok = false;
}
QFile::remove( tmpFilePath );
}
}
QVERIFY2( ok, "Reading data failed. See report for details." );
Expand Down

0 comments on commit 93e0526

Please sign in to comment.