Пример #1
0
 def testFromPlainText(self):
     doc = QgsTextDocument.fromPlainText(['a', 'b c d', 'e'])
     self.assertEqual(len(doc), 3)
     self.assertEqual(len(doc[0]), 1)
     self.assertEqual(doc[0][0].text(), 'a')
     self.assertEqual(len(doc[1]), 1)
     self.assertEqual(doc[1][0].text(), 'b c d')
     self.assertEqual(len(doc[2]), 1)
     self.assertEqual(doc[2][0].text(), 'e')
Пример #2
0
 def testCapitalize(self):
     doc = QgsTextDocument.fromPlainText(['abc def ghi', 'more text', 'another block'])
     doc.applyCapitalization(QgsStringUtils.TitleCase)
     self.assertEqual(doc.toPlainText(), ['Abc Def Ghi', 'More Text', 'Another Block'])