more test fixes on windows

This commit is contained in:
Juergen E. Fischer 2012-04-24 01:02:11 +02:00
parent 6e9454d814
commit acdd97bd65
2 changed files with 11 additions and 12 deletions

View File

@ -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
@ -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 ) )
{
@ -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";
}

View File

@ -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
@ -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;
}
//
@ -285,4 +287,3 @@ bool TestQgsRasterLayer::setQml( QString theType )
QTEST_MAIN( TestQgsRasterLayer )
#include "moc_testqgsrasterlayer.cxx"