File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 32
32
QgsMapCanvas )
33
33
34
34
from qgis .PyQt .QtTest import QSignalSpy
35
- from qgis .PyQt .QtCore import QT_VERSION_STR , QTemporaryFile , QTemporaryDir
35
+ from qgis .PyQt .QtCore import QT_VERSION_STR , QTemporaryDir
36
36
import sip
37
37
38
38
from qgis .testing import start_app , unittest
@@ -1105,6 +1105,22 @@ def testProjectTitleWithPeriod(self):
1105
1105
self .assertEqual (p0 .baseName (), '2.18.21' )
1106
1106
self .assertEqual (p1 .baseName (), 'qgis-3.2.0' )
1107
1107
1108
+ def testWriteEntry (self ):
1109
+
1110
+ tmpDir = QTemporaryDir ()
1111
+ tmpFile = "{}/project.qgs" .format (tmpDir .path ())
1112
+
1113
+ # zip with existing file
1114
+ project = QgsProject ()
1115
+ query = 'select * from "sample DH" where "sample DH"."Elev" > 130 and "sample DH"."Elev" < 140'
1116
+ self .assertTrue (project .writeEntry ('myscope' , 'myentry' , query ))
1117
+ self .assertTrue (project .write (tmpFile ))
1118
+
1119
+ self .assertTrue (project .read (tmpFile ))
1120
+ q , ok = project .readEntry ('myscope' , 'myentry' )
1121
+ self .assertTrue (ok )
1122
+ self .assertEqual (q , query )
1123
+
1108
1124
1109
1125
if __name__ == '__main__' :
1110
1126
unittest .main ()
You can’t perform that action at this time.
0 commit comments