From 51369246466a689b3cc9798d22a73fb7fa86871f Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Wed, 12 Jul 2017 08:49:31 +0900 Subject: Imported Upstream version 3.8.2 Change-Id: Ied3493b571ffbcc68a9078d5806b02d9511409e6 Signed-off-by: DongHun Kwak --- tests/Makefile.in | 6 ++++-- tests/test_everything.py | 5 +++-- tests/test_gi.py | 22 ++++++++++++++++++++++ tests/test_overrides_pango.py | 5 +++++ 4 files changed, 34 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/Makefile.in b/tests/Makefile.in index feb324f..6f3cd5e 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -59,8 +59,10 @@ subdir = tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \ - $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/python.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d diff --git a/tests/test_everything.py b/tests/test_everything.py index 3c820d7..c5f9ac9 100644 --- a/tests/test_everything.py +++ b/tests/test_everything.py @@ -505,7 +505,8 @@ class TestEverything(unittest.TestCase): glist = GLib.List() raw = RawGList.from_wrapped(glist) - self.assertEqual(glist.data, None) + # Note that pointer fields use 0 for NULL in PyGObject and None in ctypes + self.assertEqual(glist.data, 0) self.assertEqual(raw.contents.data, None) glist.data = 123 @@ -513,7 +514,7 @@ class TestEverything(unittest.TestCase): self.assertEqual(raw.contents.data, 123) glist.data = None - self.assertEqual(glist.data, None) + self.assertEqual(glist.data, 0) self.assertEqual(raw.contents.data, None) # Setting to anything other than an int should raise diff --git a/tests/test_gi.py b/tests/test_gi.py index 2671588..13e87f4 100644 --- a/tests/test_gi.py +++ b/tests/test_gi.py @@ -2074,6 +2074,9 @@ class TestPythonGObject(unittest.TestCase): def do_method_with_default_implementation(self, int8): self.val = int8 + def do_vfunc_return_value_only(self): + return 2121 + class Interface3Impl(GObject.Object, GIMarshallingTests.Interface3): def __init__(self): GObject.Object.__init__(self) @@ -2147,6 +2150,10 @@ class TestPythonGObject(unittest.TestCase): object_.method_with_default_implementation(87) self.assertEqual(object_.val, 87) + def test_subobject_child_vfunc(self): + object_ = self.SubObject(int=1) + self.assertEqual(object_.vfunc_return_value_only(), 2121) + def test_dynamic_module(self): from gi.module import DynamicModule self.assertTrue(isinstance(GObject, DynamicModule)) @@ -2288,6 +2295,21 @@ class TestInterfaces(unittest.TestCase): GIMarshallingTests.test_interface_test_int8_in(instance, 42) self.assertEqual(instance.val, 42) + def test_subclass_override(self): + class TestInterfaceImplD(TestInterfaces.TestInterfaceImpl): + val2 = None + + def do_test_int8_in(self, int8): + self.val2 = int8 + + instance = TestInterfaceImplD() + self.assertEqual(instance.val, None) + self.assertEqual(instance.val2, None) + + GIMarshallingTests.test_interface_test_int8_in(instance, 42) + self.assertEqual(instance.val, None) + self.assertEqual(instance.val2, 42) + def test_mro(self): # there was a problem with Python bailing out because of # http://en.wikipedia.org/wiki/Diamond_problem with interfaces, diff --git a/tests/test_overrides_pango.py b/tests/test_overrides_pango.py index 51f4f6a..42d4de9 100644 --- a/tests/test_overrides_pango.py +++ b/tests/test_overrides_pango.py @@ -30,3 +30,8 @@ class TestPango(unittest.TestCase): layout.set_markup("Foobar") self.assertEqual(layout.get_text(), "Foobar") + + def test_break_keyword_escape(self): + # https://bugzilla.gnome.org/show_bug.cgi?id=697363 + self.assertTrue(hasattr(Pango, 'break_')) + self.assertTrue(Pango.break_ is not None) -- cgit v1.2.3