blob: 51f4f6adbb5662ff2eaedc59828ef5be1fda1533 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# -*- Mode: Python; py-indent-offset: 4 -*-
# vim: tabstop=4 shiftwidth=4 expandtab
import unittest
try:
from gi.repository import Pango
Pango
except ImportError:
Pango = None
@unittest.skipUnless(Pango, 'Pango not available')
class TestPango(unittest.TestCase):
def test_default_font_description(self):
desc = Pango.FontDescription()
self.assertEqual(desc.get_variant(), Pango.Variant.NORMAL)
def test_font_description(self):
desc = Pango.FontDescription('monospace')
self.assertEqual(desc.get_family(), 'monospace')
self.assertEqual(desc.get_variant(), Pango.Variant.NORMAL)
def test_layout(self):
self.assertRaises(TypeError, Pango.Layout)
context = Pango.Context()
layout = Pango.Layout(context)
self.assertEqual(layout.get_context(), context)
layout.set_markup("Foobar")
self.assertEqual(layout.get_text(), "Foobar")
|