fix TestQgsProject

This commit is contained in:
Juergen E. Fischer 2015-07-01 10:21:38 +02:00
parent e2e7e365e2
commit 571752290d
3 changed files with 9 additions and 5 deletions

View File

@ -55,20 +55,24 @@ void TestQgsProject::testReadPath()
{
QgsProject* prj = QgsProject::instance();
// this is a bit hacky as we do not really load such project
prj->setFileName( "/home/qgis/a-project-file.qgs" ); // not expected to exist
QString prefix;
#if defined(Q_OS_WIN)
prefix = "C:";
#endif
prj->setFileName( prefix + "/home/qgis/a-project-file.qgs" ); // not expected to exist
// make sure we work with relative paths!
prj->writeEntry( "Paths", "Absolute", false );
QCOMPARE( prj->readPath( "./x.shp" ), QString( "/home/qgis/x.shp" ) );
QCOMPARE( prj->readPath( "../x.shp" ), QString( "/home/x.shp" ) );
QCOMPARE( prj->readPath( "./x.shp" ), QString( prefix + "/home/qgis/x.shp" ) );
QCOMPARE( prj->readPath( "../x.shp" ), QString( prefix + "/home/x.shp" ) );
// TODO: old style (seems QGIS < 1.3) - needs existing project file and existing file
// QCOMPARE( prj->readPath( "x.shp" ), QString( "/home/qgis/x.shp" ) );
// VSI: /vsizip, /vsitar, /vsigzip, *.zip, *.gz, *.tgz, ...
QCOMPARE( prj->readPath( "./x.gz" ), QString( "/home/qgis/x.gz" ) );
QCOMPARE( prj->readPath( "/vsigzip/./x.gz" ), QString( "/vsigzip//home/qgis/x.gz" ) ); // not sure how useful this really is...
QCOMPARE( prj->readPath( "./x.gz" ), QString( prefix + "/home/qgis/x.gz" ) );
QCOMPARE( prj->readPath( "/vsigzip/./x.gz" ), QString( prefix + "/vsigzip//home/qgis/x.gz" ) ); // not sure how useful this really is...
}

Binary file not shown.

Binary file not shown.