Ejemplo n.º 1
0
    def testToFromMimeData(self):
        """
        Test converting QFonts to and from mime data
        """
        f = QgsFontUtils.getStandardTestFont('Bold Oblique', 14)
        mime_data = QgsFontUtils.toMimeData(f)
        self.assertTrue(mime_data is not None)

        res, ok = QgsFontUtils.fromMimeData(None)
        self.assertFalse(ok)
        res, ok = QgsFontUtils.fromMimeData(mime_data)
        self.assertTrue(ok)

        expected = (res.family() == self._family and res.bold()
                    and res.italic() and res.pointSize() == 14)
        msg = self._family + ' test font Bold Oblique at 14 pt not retrieved from mime data'
        self.assertTrue(res, msg)
Ejemplo n.º 2
0
    def testToFromMimeData(self):
        """
        Test converting QFonts to and from mime data
        """
        f = QgsFontUtils.getStandardTestFont('Bold Oblique', 14)
        mime_data = QgsFontUtils.toMimeData(f)
        self.assertTrue(mime_data is not None)

        res, ok = QgsFontUtils.fromMimeData(None)
        self.assertFalse(ok)
        res, ok = QgsFontUtils.fromMimeData(mime_data)
        self.assertTrue(ok)

        expected = (
            res.family() == self._family and
            res.bold() and
            res.italic() and
            res.pointSize() == 14
        )
        msg = self._family + ' test font Bold Oblique at 14 pt not retrieved from mime data'
        self.assertTrue(res, msg)