[pygobject] Revert "Fix Pango FontDescription override"
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Revert "Fix Pango FontDescription override"
- Date: Wed, 19 Jan 2011 14:01:37 +0000 (UTC)
commit 5eca5ff2c9509ec96158fe43b29f0fd951243efe
Author: Martin Pitt <martin pitt ubuntu com>
Date: Wed Jan 19 14:54:57 2011 +0100
Revert "Fix Pango FontDescription override"
According to
http://library.gnome.org/devel/pango/1.28/pango-Fonts.html#pango-font-description-new
the default constructor actually does take no arguments; we should actually fix
the MemoryError. Add a test case for this.
Remove the FIXME though, as pango_font_description_from_string() is not a
FontDescription constructor, but a static factory method.
Thanks to Paolo Borelli for pointing this out!
This reverts commit 8878c57676091c08e66bc6cbe735d898cb420582.
gi/overrides/Pango.py | 5 ++++-
tests/test_overrides.py | 5 +++++
2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gi/overrides/Pango.py b/gi/overrides/Pango.py
index 423e1fb..3269806 100644
--- a/gi/overrides/Pango.py
+++ b/gi/overrides/Pango.py
@@ -28,7 +28,10 @@ __all__ = []
class FontDescription(Pango.FontDescription):
def __new__(cls, string=None):
- return Pango.font_description_from_string (string)
+ if string is not None:
+ return Pango.font_description_from_string (string)
+ else:
+ return Pango.FontDescription.__new__(cls)
FontDescription = override(FontDescription)
__all__.append('FontDescription')
diff --git a/tests/test_overrides.py b/tests/test_overrides.py
index 9fb3192..67ccf6b 100644
--- a/tests/test_overrides.py
+++ b/tests/test_overrides.py
@@ -134,9 +134,14 @@ class TestGLib(unittest.TestCase):
class TestPango(unittest.TestCase):
+ def test_default_font_description(self):
+ desc = Pango.FontDescription()
+ self.assertEquals(desc.get_variant(), Pango.Variant.NORMAL)
+
def test_font_description(self):
desc = Pango.FontDescription('monospace')
self.assertEquals(desc.get_family(), 'monospace')
+ self.assertEquals(desc.get_variant(), Pango.Variant.NORMAL)
def test_layout(self):
self.assertRaises(TypeError, Pango.Layout)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]