File tree 1 file changed +11
-0
lines changed
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 12
12
# This will get replaced with a git SHA1 when you do a git archive
13
13
__revision__ = '$Format:%H$'
14
14
15
+ import os
15
16
import qgis # NOQA
16
17
import tempfile
17
18
20
21
QgsProject )
21
22
from qgis .testing import start_app , unittest
22
23
from qgis .PyQt .QtXml import QDomDocument
24
+ from qgis .PyQt .QtCore import QTemporaryDir
23
25
24
26
start_app ()
25
27
@@ -105,6 +107,15 @@ def testReadWriteMetadata(self):
105
107
self .assertTrue (status )
106
108
self .assertTrue (layer2 .metadata ().abstract (), 'My abstract' )
107
109
110
+ def testSaveNamedStyle (self ):
111
+ layer = QgsVectorLayer ("Point?field=fldtxt:string" , "layer" , "memory" )
112
+ dir = QTemporaryDir ()
113
+ dir_path = dir .path ()
114
+ style_path = os .path .join (dir_path , 'my.qml' )
115
+ _ , result = layer .saveNamedStyle (style_path )
116
+ self .assertTrue (result )
117
+ self .assertTrue (os .path .exists (style_path ))
118
+
108
119
109
120
if __name__ == '__main__' :
110
121
unittest .main ()
You can’t perform that action at this time.
0 commit comments