Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix TestQgsProject
  • Loading branch information
jef-n committed Jul 1, 2015
1 parent e2e7e36 commit 5717522
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/src/core/testqgsproject.cpp
Expand Up @@ -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...

}

Expand Down
Binary file modified tests/testdata/points.dbf
Binary file not shown.
Binary file modified tests/testdata/points.shp
Binary file not shown.

0 comments on commit 5717522

Please sign in to comment.