summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2019-10-18 22:19:33 +0200
committerChristoph Reiter <reiter.christoph@gmail.com>2019-10-19 00:18:57 +0200
commit15ae632842cb7722d0ac4bd2f8c08ab2f3befea5 (patch)
treeeae3d6d3c5675d80f3dc218e80e8ab15ce5f4994 /tests
parente29b06546454a43ff4d138ce08618fa8664643fe (diff)
downloadpygobject-15ae632842cb7722d0ac4bd2f8c08ab2f3befea5.tar.gz
CI: Use gnome-master for testing with gtk4
This makes it easier to track upstream changes without us having to rebuild docker images. Downside is that we don't control it and API is still changing, so allow the job to fail.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gtk_template.py13
-rw-r--r--tests/test_overrides_gtk.py16
2 files changed, 14 insertions, 15 deletions
diff --git a/tests/test_gtk_template.py b/tests/test_gtk_template.py
index ee197d0f..3a1c1f02 100644
--- a/tests/test_gtk_template.py
+++ b/tests/test_gtk_template.py
@@ -190,18 +190,17 @@ def test_main_example():
assert w.goodbye_button.props.label == "Goodbye World"
assert w.callback_hello == []
- w._hello_button.clicked()
+ w._hello_button.emit("clicked")
assert w.callback_hello == [(w,)]
assert w.callback_hello_after == [(w,)]
assert w.callback_goodbye == []
- w.goodbye_button.clicked()
+ w.goodbye_button.emit("clicked")
assert w.callback_goodbye == [(w.goodbye_button,)]
assert w.callback_goodbye_after == [(w.goodbye_button,)]
def test_duplicate_handler():
-
type_name = new_gtype_name()
xml = """\
@@ -209,7 +208,7 @@ def test_duplicate_handler():
<template class="{0}" parent="GtkBox">
<child>
<object class="GtkButton" id="hello_button">
- <signal name="clicked" handler="hello_button_clicked">
+ <signal name="clicked" handler="hello_button_clicked" />
</object>
</child>
</template>
@@ -300,7 +299,6 @@ def test_missing_handler_callback():
def test_handler_swapped_not_supported():
-
type_name = new_gtype_name()
xml = """\
@@ -332,7 +330,6 @@ def test_handler_swapped_not_supported():
def test_handler_class_staticmethod():
-
type_name = new_gtype_name()
xml = """\
@@ -368,13 +365,13 @@ def test_handler_class_staticmethod():
signal_args_static.append(args)
foo = Foo()
- foo.hello_button.clicked()
+ foo.hello_button.emit("clicked")
assert signal_args_class == [(Foo, foo.hello_button)]
assert signal_args_static == [(foo.hello_button,)]
+@pytest.mark.skipif(Gtk._version == "4.0", reason="errors out first with gtk4")
def test_check_decorated_class():
-
NonWidget = type("Foo", (object,), {})
with pytest.raises(TypeError, match=".*on Widgets.*"):
Gtk.Template.from_string("")(NonWidget)
diff --git a/tests/test_overrides_gtk.py b/tests/test_overrides_gtk.py
index d791e240..9c32e8ba 100644
--- a/tests/test_overrides_gtk.py
+++ b/tests/test_overrides_gtk.py
@@ -56,7 +56,7 @@ def realized(widget):
toplevel = widget
else:
if Gtk._version == "4.0":
- toplevel = widget.get_parent_surface()
+ toplevel = widget.get_parent()
else:
toplevel = widget.get_parent_window()
@@ -79,6 +79,7 @@ def realized(widget):
@unittest.skipUnless(Gtk, 'Gtk not available')
+@unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
def test_freeze_child_notif():
events = []
@@ -90,10 +91,7 @@ def test_freeze_child_notif():
c = Gtk.Button()
c.connect("child-notify", on_notify)
c.freeze_child_notify()
- if GTK4:
- b.pack_start(c)
- else:
- b.pack_start(c, True, True, 0)
+ b.pack_start(c, True, True, 0)
b.child_set_property(c, "pack-type", Gtk.PackType.END)
b.child_set_property(c, "pack-type", Gtk.PackType.START)
c.thaw_child_notify()
@@ -895,7 +893,10 @@ class TestSignals(unittest.TestCase):
else:
win.size_allocate(rect)
self.assertTrue(win._alloc_called)
- self.assertIsInstance(win._alloc_value, Gdk.Rectangle)
+ if GTK4:
+ self.assertIsInstance(win._alloc_value, int)
+ else:
+ self.assertIsInstance(win._alloc_value, Gdk.Rectangle)
self.assertTrue(win._alloc_error is None, win._alloc_error)
@unittest.expectedFailure # https://bugzilla.gnome.org/show_bug.cgi?id=735693
@@ -2699,11 +2700,12 @@ class TestContainer(unittest.TestCase):
result = box.child_get_property(child, 'padding')
self.assertEqual(result, 42)
+ @unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
def test_child_get_property_error(self):
box = Gtk.Box()
child = Gtk.Button()
if Gtk_version == "4.0":
- box.pack_start(child)
+ box.add(child)
else:
box.pack_start(child, expand=False, fill=True, padding=42)
with self.assertRaises(ValueError):