[pygobject] overrides: Remove Pango.Context.get_metrics



commit 2d388fcfca4bf1258d01b4491b4168589f3dd2b0
Author: Simon Feltman <sfeltman src gnome org>
Date:   Mon Jan 6 21:22:41 2014 -0800

    overrides: Remove Pango.Context.get_metrics
    
    Remove the override for Pango.Context and the get_metrics method. This can
    be done now that tail end method arguments with "allow-none" are implicitly
    defaulted to use None/NULL.

 gi/overrides/Pango.py         |    9 ---------
 tests/test_overrides_pango.py |   12 ++++++++++++
 2 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/gi/overrides/Pango.py b/gi/overrides/Pango.py
index 74602c4..0f7c484 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 42d4de9..1e8fe2d 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())


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]