mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
fix TestQgsProject
This commit is contained in:
parent
e2e7e365e2
commit
571752290d
@ -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
tests/testdata/points.dbf
vendored
BIN
tests/testdata/points.dbf
vendored
Binary file not shown.
BIN
tests/testdata/points.shp
vendored
BIN
tests/testdata/points.shp
vendored
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user