Skip to content

Commit

Permalink
more test fixes on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Apr 23, 2012
1 parent 6e9454d commit acdd97b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
12 changes: 5 additions & 7 deletions tests/src/core/testqgsmaprenderer.cpp
Expand Up @@ -26,7 +26,7 @@
#include <QDesktopServices>

//qgis includes...
#include <qgsvectorlayer.h> //defines QgsFieldMap
#include <qgsvectorlayer.h> //defines QgsFieldMap
#include <qgsvectorfilewriter.h> //logic for writing shpfiles
#include <qgsfeature.h> //we will need to pass a bunch of these for each rec
#include <qgsgeometry.h> //each feature needs a geometry
Expand Down Expand Up @@ -95,7 +95,7 @@ void TestQgsMapRenderer::initTestCase()
QString myFileName = myTmpDir + "maprender_testdata.shp";
//copy over the default qml for our generated layer
QString myQmlFileName = myTestDataDir + "maprender_testdata.qml";
QFile::copy( myQmlFileName, myTmpDir + "maprender_testdata.qml" );
QVERIFY( QFile::copy( myQmlFileName, myTmpDir + "maprender_testdata.qml" ) );
qDebug( "Checking test dataset exists...\n%s", myFileName.toLocal8Bit().constData() );
if ( !QFile::exists( myFileName ) )
{
Expand Down Expand Up @@ -161,14 +161,12 @@ void TestQgsMapRenderer::initTestCase()
QFileInfo myPolyFileInfo( myFileName );
mpPolysLayer = new QgsVectorLayer( myPolyFileInfo.filePath(),
myPolyFileInfo.completeBaseName(), "ogr" );
QVERIFY( mpPolysLayer->isValid() );
// Register the layer with the registry
QgsMapLayerRegistry::instance()->addMapLayers(
QList<QgsMapLayer *>() << mpPolysLayer );
QgsMapLayerRegistry::instance()->addMapLayers( QList<QgsMapLayer *>() << mpPolysLayer );
// add the test layer to the maprender
mpMapRenderer = new QgsMapRenderer();
QStringList myLayers;
myLayers << mpPolysLayer->id();
mpMapRenderer->setLayerSet( myLayers );
mpMapRenderer->setLayerSet( QStringList( mpPolysLayer->id() ) );
mReport += "<h1>Map Render Tests</h1>\n";
}

Expand Down
11 changes: 6 additions & 5 deletions tests/src/core/testqgsrasterlayer.cpp
Expand Up @@ -185,11 +185,13 @@ void TestQgsRasterLayer::buildExternalOverviews()
//and make a copy of the landsat raster into the temp dir
QString myTempPath = QDir::tempPath() + QDir::separator();
QFile::remove( myTempPath + "landsat.tif.ovr" );
QFile::copy( mTestDataDir + "landsat.tif", myTempPath + "landsat.tif" );
QFile::remove( myTempPath + "landsat.tif" );
QVERIFY( QFile::copy( mTestDataDir + "landsat.tif", myTempPath + "landsat.tif" ) );
QFileInfo myRasterFileInfo( myTempPath + "landsat.tif" );
QgsRasterLayer * mypLayer = new QgsRasterLayer( myRasterFileInfo.filePath(),
myRasterFileInfo.completeBaseName() );

QVERIFY( mypLayer->isValid() );

//
// Ok now we can go on to test
Expand Down Expand Up @@ -234,17 +236,17 @@ void TestQgsRasterLayer::registry()
{
QString myTempPath = QDir::tempPath() + QDir::separator();
QFile::remove( myTempPath + "landsat.tif.ovr" );
QFile::copy( mTestDataDir + "landsat.tif", myTempPath + "landsat.tif" );
QFile::remove( myTempPath + "landsat.tif" );
QVERIFY( QFile::copy( mTestDataDir + "landsat.tif", myTempPath + "landsat.tif" ) );
QFileInfo myRasterFileInfo( myTempPath + "landsat.tif" );
QgsRasterLayer * mypLayer = new QgsRasterLayer( myRasterFileInfo.filePath(),
myRasterFileInfo.completeBaseName() );
QVERIFY( mypLayer->isValid() );

QgsMapLayerRegistry::instance()->addMapLayers(
QList<QgsMapLayer *>() << mypLayer, false );
QgsMapLayerRegistry::instance()->removeMapLayers(
QStringList() << mypLayer->id() );
//cleanup
//delete mypLayer;
}

//
Expand Down Expand Up @@ -285,4 +287,3 @@ bool TestQgsRasterLayer::setQml( QString theType )

QTEST_MAIN( TestQgsRasterLayer )
#include "moc_testqgsrasterlayer.cxx"

0 comments on commit acdd97b

Please sign in to comment.