Commit c11599e3 authored by Jean Felder's avatar Jean Felder

tests: Fix gtk_drag_methods method for Gtk4

parent 1f8f3617
Pipeline #161413 failed with stages
in 3 minutes and 21 seconds
......@@ -655,6 +655,7 @@ class TestGtk(unittest.TestCase):
sb = sw.get_vscrollbar()
self.assertEqual(sw.get_vadjustment(), sb.get_adjustment())
@unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
def test_widget_drag_methods(self):
widget = Gtk.Button()
......@@ -672,10 +673,8 @@ class TestGtk(unittest.TestCase):
widget.drag_dest_set_track_motion(True)
widget.drag_dest_get_target_list()
widget.drag_dest_set_target_list(None)
if GTK4:
widget.drag_dest_set_target_list(Gdk.ContentFormats.new([]))
else:
widget.drag_dest_set_target_list(Gtk.TargetList.new([Gtk.TargetEntry.new('test', 0, 0)]))
widget.drag_dest_set_target_list(Gtk.TargetList.new([Gtk.TargetEntry.new('test', 0, 0)]))
widget.drag_dest_unset()
widget.drag_highlight()
......@@ -687,23 +686,38 @@ class TestGtk(unittest.TestCase):
widget.drag_source_add_text_targets()
widget.drag_source_add_uri_targets()
widget.drag_source_set_icon_name("_About")
if not GTK4:
widget.drag_source_set_icon_pixbuf(GdkPixbuf.Pixbuf())
widget.drag_source_set_icon_stock(Gtk.STOCK_ABOUT)
widget.drag_source_set_icon_pixbuf(GdkPixbuf.Pixbuf())
widget.drag_source_set_icon_stock(Gtk.STOCK_ABOUT)
widget.drag_source_get_target_list()
widget.drag_source_set_target_list(None)
if GTK4:
widget.drag_source_set_target_list(Gdk.ContentFormats.new([]))
else:
widget.drag_source_set_target_list(Gtk.TargetList.new([Gtk.TargetEntry.new('test', 0, 0)]))
widget.drag_source_set_target_list(Gtk.TargetList.new([Gtk.TargetEntry.new('test', 0, 0)]))
widget.drag_source_unset()
# these methods cannot be called because they require a valid drag on
# a real GdkWindow. So we only check that they exist and are callable.
if not GTK4:
self.assertTrue(hasattr(widget, 'drag_dest_set_proxy'))
self.assertTrue(hasattr(widget, 'drag_dest_set_proxy'))
self.assertTrue(hasattr(widget, 'drag_get_data'))
@unittest.skipIf(Gtk_version != "4.0", "gtk4 only")
def test_widget_drag_methods_gtk4(self):
widget = Gtk.Button()
# here we are not checking functionality, only that the methods exist
# and except the right number of arguments
widget.drag_check_threshold(0, 0, 0, 0)
# drop
drop_target = Gtk.DropTarget.new(Gdk.ContentFormats.new([]), Gdk.DragAction.COPY)
widget.add_controller(drop_target)
widget.drag_highlight()
widget.drag_unhighlight()
# drag
@unittest.skipIf(sys.platform == "darwin", "crashes")
@unittest.skipIf(GTK4, "uses lots of gtk3 only api")
def test_drag_target_list_gtk3(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment