@@ -71,15 +71,17 @@ void TestVectorLayerCache::initTestCase()
71
71
72
72
// Backup test shape file and attributes
73
73
QStringList backupFiles;
74
- backupFiles << " points.shp" << " points.shx" << " points.dbf" ;
74
+ backupFiles << " points.shp" << " points.shx" << " points.dbf" << " points.prj " ;
75
75
76
76
QString myDataDir ( TEST_DATA_DIR ); // defined in CmakeLists.txt
77
77
QString myTestDataDir = myDataDir + QDir::separator ();
78
78
79
79
foreach ( QString f, backupFiles )
80
80
{
81
- QString tmpFileName = QDir::tempPath () + QDir::separator () + f + " _" + QString::number ( qApp->applicationPid () );
82
81
QString origFileName = myTestDataDir + f;
82
+ QFileInfo origFileInfo ( origFileName );
83
+
84
+ QString tmpFileName = QDir::tempPath () + QDir::separator () + origFileInfo.baseName () + " _" + QString::number ( qApp->applicationPid () ) + " ." + origFileInfo.completeSuffix ();
83
85
84
86
qDebug () << " Copy " << origFileName << " " << tmpFileName;
85
87
@@ -90,7 +92,7 @@ void TestVectorLayerCache::initTestCase()
90
92
//
91
93
// load a vector layer
92
94
//
93
- QString myPointsFileName = myTestDataDir + " points.shp" ;
95
+ QString myPointsFileName = mTmpFiles . value ( myTestDataDir + " points.shp" ) ;
94
96
QFileInfo myPointFileInfo ( myPointsFileName );
95
97
mPointsLayer = new QgsVectorLayer ( myPointFileInfo.filePath (),
96
98
myPointFileInfo.completeBaseName (), " ogr" );
@@ -111,19 +113,6 @@ void TestVectorLayerCache::cleanup()
111
113
// runs after all tests
112
114
void TestVectorLayerCache::cleanupTestCase ()
113
115
{
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
-
127
116
delete mPointsLayer ;
128
117
129
118
// Clean tmp files
@@ -132,8 +121,6 @@ void TestVectorLayerCache::cleanupTestCase()
132
121
for ( it = mTmpFiles .constBegin (); it != mTmpFiles .constEnd (); ++it )
133
122
{
134
123
QString tmpFileName = it.value ();
135
- QString origFileName = it.key ();
136
-
137
124
qDebug () << " Remove " << tmpFileName;
138
125
QFile::remove ( tmpFileName );
139
126
}
0 commit comments