[pygobject] [GI] Add tests for Gtk.Widget.drag_* methods.
- From: Laszlo Pandy <lpandy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] [GI] Add tests for Gtk.Widget.drag_* methods.
- Date: Thu, 3 Feb 2011 14:47:59 +0000 (UTC)
commit 2660be1f227be7a53092483bc9d8ead1bd1fb266
Author: Laszlo Pandy <lpandy src gnome org>
Date: Thu Feb 3 15:31:42 2011 +0100
[GI] Add tests for Gtk.Widget.drag_* methods.
Previously all the drag_* methods were accessible as Gtk.drag_*.
Now that the (method) attribute has been included for these
methods in Gtk+, this test checks that they are included as class
methods when using pygobject introspection.
https://bugzilla.gnome.org/show_bug.cgi?id=639945
tests/test_overrides.py | 40 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/tests/test_overrides.py b/tests/test_overrides.py
index aeb9e80..0642dcc 100644
--- a/tests/test_overrides.py
+++ b/tests/test_overrides.py
@@ -15,6 +15,7 @@ from gi.repository import Gdk
from gi.repository import Gtk
from gi.repository import Gio
from gi.repository import Pango
+from gi.repository import GdkPixbuf
import gi.overrides as overrides
import gi.types
@@ -1190,6 +1191,45 @@ class TestGtk(unittest.TestCase):
sb = sw.get_vscrollbar()
self.assertEquals(sw.get_vadjustment(), sb.get_adjustment())
+ def test_widget_drag_methods(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)
+
+ # drag_dest_ methods
+ widget.drag_dest_set(Gtk.DestDefaults.DROP, None, Gdk.DragAction.COPY)
+ widget.drag_dest_add_image_targets()
+ widget.drag_dest_add_text_targets()
+ widget.drag_dest_add_uri_targets()
+ widget.drag_dest_get_track_motion()
+ widget.drag_dest_set_track_motion(True)
+ widget.drag_dest_get_target_list()
+ widget.drag_dest_set_target_list(Gtk.TargetList.new([Gtk.TargetEntry()]))
+ widget.drag_dest_unset()
+
+ widget.drag_highlight()
+ widget.drag_unhighlight()
+
+ # drag_source_ methods
+ widget.drag_source_set(Gdk.ModifierType.BUTTON1_MASK, None, Gdk.DragAction.MOVE)
+ widget.drag_source_add_image_targets()
+ widget.drag_source_add_text_targets()
+ widget.drag_source_add_uri_targets()
+ widget.drag_source_set_icon_name("")
+ widget.drag_source_set_icon_pixbuf(GdkPixbuf.Pixbuf())
+ widget.drag_source_set_icon_stock("")
+ widget.drag_source_get_target_list()
+ widget.drag_source_set_target_list(Gtk.TargetList.new([Gtk.TargetEntry()]))
+ 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.
+ self.assertTrue(hasattr(widget.drag_dest_set_proxy, '__call__'))
+ self.assertTrue(hasattr(widget.drag_get_data, '__call__'))
+
class TestGio(unittest.TestCase):
def setUp(self):
os.environ['GSETTINGS_BACKEND'] = 'memory'
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]