Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
use temp copy of points.shp
  • Loading branch information
signedav committed Dec 10, 2018
1 parent 73e3ead commit 8fda2b7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/src/core/testqgsofflineediting.cpp
Expand Up @@ -41,6 +41,7 @@ class TestQgsOfflineEditing : public QObject
QStringList layerIds;
long numberOfFeatures;
int numberOfFields;
QTemporaryDir tempDir;

private slots:
void initTestCase();// will be called before the first testfunction is executed.
Expand Down Expand Up @@ -75,8 +76,12 @@ void TestQgsOfflineEditing::cleanupTestCase()
void TestQgsOfflineEditing::init()
{
QString myFileName( TEST_DATA_DIR ); //defined in CmakeLists.txt
myFileName = myFileName + "/points.shp";
QFileInfo myMapFileInfo( myFileName );
QString myTempDirName = tempDir.path();
QFile::copy( myFileName + "/points.shp", myTempDirName + "/points.shp" );
QFile::copy( myFileName + "/points.shx", myTempDirName + "/points.shx" );
QFile::copy( myFileName + "/points.dbf", myTempDirName + "/points.dbf" );
QString myTempFileName = myTempDirName + "/points.shp";
QFileInfo myMapFileInfo( myTempFileName );
mpLayer = new QgsVectorLayer( myMapFileInfo.filePath(),
myMapFileInfo.completeBaseName(), QStringLiteral( "ogr" ) );
QgsProject::instance()->addMapLayer( mpLayer );
Expand Down

0 comments on commit 8fda2b7

Please sign in to comment.