Skip to content
Permalink
Browse files

fix TestQgsProject

  • Loading branch information
jef-n committed Jul 1, 2015
1 parent e2e7e36 commit 571752290ddf983da205e009d18402929f24798e
@@ -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...

}

BIN +131 Bytes (110%) tests/testdata/points.dbf
Binary file not shown.
BIN +28 Bytes (100%) tests/testdata/points.shp
Binary file not shown.

0 comments on commit 5717522

Please sign in to comment.
You can’t perform that action at this time.