Skip to content

Commit

Permalink
Fix text renderer test
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed May 13, 2017
1 parent c882f88 commit bbb13f4
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tests/src/python/test_qgstextrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
QgsVectorLayer,
QgsTextRenderer,
QgsMapSettings,
QgsReadWriteContext,
QgsRenderContext,
QgsRectangle,
QgsRenderChecker,
Expand Down Expand Up @@ -202,11 +203,11 @@ def testBackgroundReadWriteXml(self):
"""test saving and restoring state of a background to xml"""
doc = QDomDocument("testdoc")
s = self.createBackgroundSettings()
elem = s.writeXml(doc)
elem = s.writeXml(doc, QgsReadWriteContext())
parent = doc.createElement("settings")
parent.appendChild(elem)
t = QgsTextBackgroundSettings()
t.readXml(parent)
t.readXml(parent, QgsReadWriteContext())
self.checkBackgroundSettings(t)

def createShadowSettings(self):
Expand Down Expand Up @@ -352,11 +353,11 @@ def testFormatReadWriteXml(self):
"""test saving and restoring state of a shadow to xml"""
doc = QDomDocument("testdoc")
s = self.createFormatSettings()
elem = s.writeXml(doc)
elem = s.writeXml(doc, QgsReadWriteContext())
parent = doc.createElement("settings")
parent.appendChild(elem)
t = QgsTextFormat()
t.readXml(parent)
t.readXml(parent, QgsReadWriteContext())
self.checkTextFormat(t)

def containsAdvancedEffects(self):
Expand Down Expand Up @@ -404,17 +405,17 @@ def testFontFoundFromLayer(self):
def testFontFoundFromXml(self):
doc = QDomDocument("testdoc")
f = QgsTextFormat()
elem = f.writeXml(doc)
elem = f.writeXml(doc, QgsReadWriteContext())
elem.setAttribute('fontFamily', 'asdfasdfsadf')
parent = doc.createElement("parent")
parent.appendChild(elem)

f.readXml(parent)
f.readXml(parent, QgsReadWriteContext())
self.assertFalse(f.fontFound())

font = getTestFont()
elem.setAttribute('fontFamily', font.family())
f.readXml(parent)
f.readXml(parent, QgsReadWriteContext())
self.assertTrue(f.fontFound())

def imageCheck(self, name, reference_image, image):
Expand Down

0 comments on commit bbb13f4

Please sign in to comment.