Skip to content

Commit acdd97b

Browse files
committedApr 23, 2012
more test fixes on windows
1 parent 6e9454d commit acdd97b

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed
 

‎tests/src/core/testqgsmaprenderer.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include <QDesktopServices>
2727

2828
//qgis includes...
29-
#include <qgsvectorlayer.h> //defines QgsFieldMap
29+
#include <qgsvectorlayer.h> //defines QgsFieldMap
3030
#include <qgsvectorfilewriter.h> //logic for writing shpfiles
3131
#include <qgsfeature.h> //we will need to pass a bunch of these for each rec
3232
#include <qgsgeometry.h> //each feature needs a geometry
@@ -95,7 +95,7 @@ void TestQgsMapRenderer::initTestCase()
9595
QString myFileName = myTmpDir + "maprender_testdata.shp";
9696
//copy over the default qml for our generated layer
9797
QString myQmlFileName = myTestDataDir + "maprender_testdata.qml";
98-
QFile::copy( myQmlFileName, myTmpDir + "maprender_testdata.qml" );
98+
QVERIFY( QFile::copy( myQmlFileName, myTmpDir + "maprender_testdata.qml" ) );
9999
qDebug( "Checking test dataset exists...\n%s", myFileName.toLocal8Bit().constData() );
100100
if ( !QFile::exists( myFileName ) )
101101
{
@@ -161,14 +161,12 @@ void TestQgsMapRenderer::initTestCase()
161161
QFileInfo myPolyFileInfo( myFileName );
162162
mpPolysLayer = new QgsVectorLayer( myPolyFileInfo.filePath(),
163163
myPolyFileInfo.completeBaseName(), "ogr" );
164+
QVERIFY( mpPolysLayer->isValid() );
164165
// Register the layer with the registry
165-
QgsMapLayerRegistry::instance()->addMapLayers(
166-
QList<QgsMapLayer *>() << mpPolysLayer );
166+
QgsMapLayerRegistry::instance()->addMapLayers( QList<QgsMapLayer *>() << mpPolysLayer );
167167
// add the test layer to the maprender
168168
mpMapRenderer = new QgsMapRenderer();
169-
QStringList myLayers;
170-
myLayers << mpPolysLayer->id();
171-
mpMapRenderer->setLayerSet( myLayers );
169+
mpMapRenderer->setLayerSet( QStringList( mpPolysLayer->id() ) );
172170
mReport += "<h1>Map Render Tests</h1>\n";
173171
}
174172

‎tests/src/core/testqgsrasterlayer.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,13 @@ void TestQgsRasterLayer::buildExternalOverviews()
185185
//and make a copy of the landsat raster into the temp dir
186186
QString myTempPath = QDir::tempPath() + QDir::separator();
187187
QFile::remove( myTempPath + "landsat.tif.ovr" );
188-
QFile::copy( mTestDataDir + "landsat.tif", myTempPath + "landsat.tif" );
188+
QFile::remove( myTempPath + "landsat.tif" );
189+
QVERIFY( QFile::copy( mTestDataDir + "landsat.tif", myTempPath + "landsat.tif" ) );
189190
QFileInfo myRasterFileInfo( myTempPath + "landsat.tif" );
190191
QgsRasterLayer * mypLayer = new QgsRasterLayer( myRasterFileInfo.filePath(),
191192
myRasterFileInfo.completeBaseName() );
192193

194+
QVERIFY( mypLayer->isValid() );
193195

194196
//
195197
// Ok now we can go on to test
@@ -234,17 +236,17 @@ void TestQgsRasterLayer::registry()
234236
{
235237
QString myTempPath = QDir::tempPath() + QDir::separator();
236238
QFile::remove( myTempPath + "landsat.tif.ovr" );
237-
QFile::copy( mTestDataDir + "landsat.tif", myTempPath + "landsat.tif" );
239+
QFile::remove( myTempPath + "landsat.tif" );
240+
QVERIFY( QFile::copy( mTestDataDir + "landsat.tif", myTempPath + "landsat.tif" ) );
238241
QFileInfo myRasterFileInfo( myTempPath + "landsat.tif" );
239242
QgsRasterLayer * mypLayer = new QgsRasterLayer( myRasterFileInfo.filePath(),
240243
myRasterFileInfo.completeBaseName() );
244+
QVERIFY( mypLayer->isValid() );
241245

242246
QgsMapLayerRegistry::instance()->addMapLayers(
243247
QList<QgsMapLayer *>() << mypLayer, false );
244248
QgsMapLayerRegistry::instance()->removeMapLayers(
245249
QStringList() << mypLayer->id() );
246-
//cleanup
247-
//delete mypLayer;
248250
}
249251

250252
//
@@ -285,4 +287,3 @@ bool TestQgsRasterLayer::setQml( QString theType )
285287

286288
QTEST_MAIN( TestQgsRasterLayer )
287289
#include "moc_testqgsrasterlayer.cxx"
288-

0 commit comments

Comments
 (0)
Please sign in to comment.