Пример #1
0
 def testFieldTooltip(self):
     f = QgsField('my_string', QVariant.String, 'string')
     self.assertEqual(
         QgsFieldModel.fieldToolTip(f),
         "<b>my_string</b><br><font style='font-family:monospace; white-space: nowrap;'>string NULL</font>"
     )
     f.setAlias('my alias')
     self.assertEqual(
         QgsFieldModel.fieldToolTip(f),
         "<b>my alias</b> (my_string)<br><font style='font-family:monospace; white-space: nowrap;'>string NULL</font>"
     )
     f.setLength(20)
     self.assertEqual(
         QgsFieldModel.fieldToolTip(f),
         "<b>my alias</b> (my_string)<br><font style='font-family:monospace; white-space: nowrap;'>string(20) NULL</font>"
     )
     f = QgsField('my_real', QVariant.Double, 'real', 8, 3)
     self.assertEqual(
         QgsFieldModel.fieldToolTip(f),
         "<b>my_real</b><br><font style='font-family:monospace; white-space: nowrap;'>real(8, 3) NULL</font>"
     )
     f.setComment('Comment text')
     self.assertEqual(
         QgsFieldModel.fieldToolTip(f),
         "<b>my_real</b><br><font style='font-family:monospace; white-space: nowrap;'>real(8, 3) NULL</font><br><em>Comment text</em>"
     )
Пример #2
0
 def testFieldTooltip(self):
     f = QgsField('my_string', QVariant.String, 'string')
     self.assertEqual(QgsFieldModel.fieldToolTip(f), '<b>my_string</b><p>string</p>')
     f.setAlias('my alias')
     self.assertEqual(QgsFieldModel.fieldToolTip(f), '<b>my alias</b> (my_string)<p>string</p>')
     f.setLength(20)
     self.assertEqual(QgsFieldModel.fieldToolTip(f), '<b>my alias</b> (my_string)<p>string (20)</p>')
     f = QgsField('my_real', QVariant.Double, 'real', 8, 3)
     self.assertEqual(QgsFieldModel.fieldToolTip(f), '<b>my_real</b><p>real (8, 3)</p>')
Пример #3
0
 def testFieldTooltip(self):
     f = QgsField('my_string', QVariant.String, 'string')
     self.assertEqual(QgsFieldModel.fieldToolTip(f), '<b>my_string</b><p>string</p>')
     f.setAlias('my alias')
     self.assertEqual(QgsFieldModel.fieldToolTip(f), '<b>my alias</b> (my_string)<p>string</p>')
     f.setLength(20)
     self.assertEqual(QgsFieldModel.fieldToolTip(f), '<b>my alias</b> (my_string)<p>string (20)</p>')
     f = QgsField('my_real', QVariant.Double, 'real', 8, 3)
     self.assertEqual(QgsFieldModel.fieldToolTip(f), '<b>my_real</b><p>real (8, 3)</p>')