[pygobject] test_atoms.py: Add test for out array



commit fc021516552b1720bacc4afe6b7a610c413194c4
Author: Martin Pitt <martinpitt gnome org>
Date:   Wed Nov 14 06:27:17 2012 +0100

    test_atoms.py: Add test for out array
    
    This reproduces https://bugzilla.gnome.org/show_bug.cgi?id=678620

 tests/test_atoms.py |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/tests/test_atoms.py b/tests/test_atoms.py
index 449fcda..1561dbd 100644
--- a/tests/test_atoms.py
+++ b/tests/test_atoms.py
@@ -48,6 +48,25 @@ class TestGdkAtom(unittest.TestCase):
         self.assertTrue(Gtk.targets_include_image([a_jpeg], False))
         self.assertTrue(Gtk.targets_include_image([a_jpeg, a_plain], False))
 
+    def test_out_array(self):
+        a_selection = Gdk.Atom.intern('my_clipboard', False)
+        clipboard = Gtk.Clipboard.get(a_selection)
+
+        # empty
+        (res, targets) = clipboard.wait_for_targets()
+        self.assertEqual(res, False)
+        self.assertEqual(targets, [])
+
+        # text
+        clipboard.set_text('hello', 5)
+        (res, targets) = clipboard.wait_for_targets()
+        self.assertEqual(res, True)
+        self.assertNotEqual(targets, [])
+        self.assertEqual(type(targets[0]), Gdk.Atom)
+        names = [t.name() for t in targets]
+        self.assertFalse(None in names, names)
+        self.assertTrue('TEXT' in names, names)
+
     def test_out_glist(self):
         display = Gdk.Display.get_default()
         dm = display.get_device_manager()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]