summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gi/overrides/Pango.py9
-rw-r--r--tests/test_overrides_pango.py12
2 files changed, 12 insertions, 9 deletions
diff --git a/gi/overrides/Pango.py b/gi/overrides/Pango.py
index 74602c47..0f7c484e 100644
--- a/gi/overrides/Pango.py
+++ b/gi/overrides/Pango.py
@@ -26,15 +26,6 @@ Pango = get_introspection_module('Pango')
__all__ = []
-class Context(Pango.Context):
-
- def get_metrics(self, desc, language=None):
- return super(Context, self).get_metrics(desc, language)
-
-Context = override(Context)
-__all__.append('Context')
-
-
class FontDescription(Pango.FontDescription):
def __new__(cls, string=None):
diff --git a/tests/test_overrides_pango.py b/tests/test_overrides_pango.py
index 42d4de92..1e8fe2df 100644
--- a/tests/test_overrides_pango.py
+++ b/tests/test_overrides_pango.py
@@ -5,9 +5,12 @@ import unittest
try:
from gi.repository import Pango
+ from gi.repository import PangoCairo
Pango
+ PangoCairo
except ImportError:
Pango = None
+ PangoCairo = None
@unittest.skipUnless(Pango, 'Pango not available')
@@ -35,3 +38,12 @@ class TestPango(unittest.TestCase):
# https://bugzilla.gnome.org/show_bug.cgi?id=697363
self.assertTrue(hasattr(Pango, 'break_'))
self.assertTrue(Pango.break_ is not None)
+
+ def test_context_get_metrics(self):
+ # Test default "language" argument
+ font_map = PangoCairo.font_map_get_default()
+ context = font_map.create_context()
+ desc = Pango.FontDescription('monospace')
+ metrics1 = context.get_metrics(desc)
+ metrics2 = context.get_metrics(desc, context.get_language())
+ self.assertEqual(metrics1.get_ascent(), metrics2.get_ascent())