Skip to content

Commit f3fe29d

Browse files
committedJul 1, 2015
Better fix for b847a06
1 parent f72ae91 commit f3fe29d

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed
 

‎tests/src/core/testqgsvectorlayercache.cpp

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,17 @@ void TestVectorLayerCache::initTestCase()
7171

7272
// Backup test shape file and attributes
7373
QStringList backupFiles;
74-
backupFiles << "points.shp" << "points.shx" << "points.dbf";
74+
backupFiles << "points.shp" << "points.shx" << "points.dbf" << "points.prj";
7575

7676
QString myDataDir( TEST_DATA_DIR ); //defined in CmakeLists.txt
7777
QString myTestDataDir = myDataDir + QDir::separator();
7878

7979
foreach ( QString f, backupFiles )
8080
{
81-
QString tmpFileName = QDir::tempPath() + QDir::separator() + f + "_" + QString::number( qApp->applicationPid() );
8281
QString origFileName = myTestDataDir + f;
82+
QFileInfo origFileInfo( origFileName );
83+
84+
QString tmpFileName = QDir::tempPath() + QDir::separator() + origFileInfo.baseName() + "_" + QString::number( qApp->applicationPid() ) + "." + origFileInfo.completeSuffix();
8385

8486
qDebug() << "Copy " << origFileName << " " << tmpFileName;
8587

@@ -90,7 +92,7 @@ void TestVectorLayerCache::initTestCase()
9092
//
9193
// load a vector layer
9294
//
93-
QString myPointsFileName = myTestDataDir + "points.shp";
95+
QString myPointsFileName = mTmpFiles.value( myTestDataDir + "points.shp" );
9496
QFileInfo myPointFileInfo( myPointsFileName );
9597
mPointsLayer = new QgsVectorLayer( myPointFileInfo.filePath(),
9698
myPointFileInfo.completeBaseName(), "ogr" );
@@ -111,19 +113,6 @@ void TestVectorLayerCache::cleanup()
111113
//runs after all tests
112114
void TestVectorLayerCache::cleanupTestCase()
113115
{
114-
// Clean added features
115-
if ( mAddedFeatures.length() > 0 )
116-
{
117-
mPointsLayer->startEditing();
118-
foreach ( QgsFeature f, mAddedFeatures )
119-
{
120-
mPointsLayer->deleteFeature( f.id() );
121-
}
122-
mPointsLayer->commitChanges();
123-
mAddedFeatures.clear();
124-
}
125-
126-
127116
delete mPointsLayer;
128117

129118
// Clean tmp files
@@ -132,8 +121,6 @@ void TestVectorLayerCache::cleanupTestCase()
132121
for ( it = mTmpFiles.constBegin(); it != mTmpFiles.constEnd(); ++it )
133122
{
134123
QString tmpFileName = it.value();
135-
QString origFileName = it.key();
136-
137124
qDebug() << "Remove " << tmpFileName;
138125
QFile::remove( tmpFileName );
139126
}

0 commit comments

Comments
 (0)
Please sign in to comment.