summaryrefslogtreecommitdiff
path: root/tests/test_overrides_gtk.py
diff options
context:
space:
mode:
authorJean Felder <jfelder@src.gnome.org>2020-04-17 15:26:42 +0200
committerJean Felder <jfelder@src.gnome.org>2020-04-17 15:39:31 +0200
commit555cb2b63ea3a7ac49fef2f8e28a08fc928ccb90 (patch)
treea29ce48d67f91ebf00d0ab587f5510bc6b229c4f /tests/test_overrides_gtk.py
parent934cfec8813db96c3dc6d2a5e76a0b96f49e9cd6 (diff)
downloadpygobject-555cb2b63ea3a7ac49fef2f8e28a08fc928ccb90.tar.gz
tests: GtkWindowType has been removed from GTK4
See gtk commit c1f71ee3e8add0c8e43445b888719ac85a743583. There are now top_level windows only. A new gtk4 test is added to check that windows are correctly created and work from builder.
Diffstat (limited to 'tests/test_overrides_gtk.py')
-rw-r--r--tests/test_overrides_gtk.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/test_overrides_gtk.py b/tests/test_overrides_gtk.py
index 43537452..8ed9775e 100644
--- a/tests/test_overrides_gtk.py
+++ b/tests/test_overrides_gtk.py
@@ -313,7 +313,8 @@ class TestGtk(unittest.TestCase):
mi = ui.get_widget("/menubær1")
self.assertEqual(type(mi), Gtk.MenuBar)
- def test_window(self):
+ @unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
+ def test_window_gtk3(self):
# standard Window
w = Gtk.Window()
self.assertEqual(w.get_property('type'), Gtk.WindowType.TOPLEVEL)
@@ -345,6 +346,33 @@ class TestGtk(unittest.TestCase):
self.assertEqual(builder.get_object('testpop').get_property('type'),
Gtk.WindowType.POPUP)
+ @unittest.skipUnless(Gtk_version == "4.0", "no GtkWindowType in gtk4")
+ def test_window_gtk4(self):
+ w = Gtk.Window()
+
+ # check that setting default size works
+ w.set_default_size(300, 300)
+ self.assertEqual(w.get_default_size(), (300, 300))
+
+ class TestWindow(Gtk.Window):
+ __gtype_name__ = "TestWindow"
+
+ # works from builder
+ builder = Gtk.Builder()
+ builder.add_from_string('''
+<interface>
+ <object class="GtkWindow" id="win">
+ <property name="css-name">amazing</property>
+ </object>
+ <object class="TestWindow" id="testwin">
+ <property name="css-name">amazing-test</property>
+ </object>
+</interface>''')
+ self.assertEqual(builder.get_object("win").get_property("css-name"),
+ "amazing")
+ self.assertEqual(builder.get_object("testwin").get_property("css-name"),
+ "amazing-test")
+
def test_dialog_classes(self):
self.assertEqual(Gtk.Dialog, gi.overrides.Gtk.Dialog)
self.assertEqual(Gtk.FileChooserDialog, gi.overrides.Gtk.FileChooserDialog)