Beispiel #1
0
    def test_cursor(self):
        self.assertEqual(Gdk.Cursor, gi.overrides.Gdk.Cursor)
        with capture_glib_deprecation_warnings():
            c = Gdk.Cursor(Gdk.CursorType.WATCH)
        self.assertNotEqual(c, None)
        with capture_glib_deprecation_warnings():
            c = Gdk.Cursor(cursor_type=Gdk.CursorType.WATCH)
        self.assertNotEqual(c, None)

        display_manager = Gdk.DisplayManager.get()
        display = display_manager.get_default_display()

        test_pixbuf = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, False, 8,
                                           5, 10)

        with capture_glib_deprecation_warnings() as warn:
            c = Gdk.Cursor(display, test_pixbuf, y=0, x=0)
            self.assertNotEqual(c, None)

            self.assertEqual(len(warn), 1)
            self.assertTrue(
                issubclass(warn[0].category, PyGIDeprecationWarning))
            self.assertRegexpMatches(str(warn[0].message),
                                     '.*new_from_pixbuf.*')

        self.assertRaises(ValueError, Gdk.Cursor, 1, 2, 3)
    def test_cursor(self):
        self.assertEqual(Gdk.Cursor, gi.overrides.Gdk.Cursor)
        with capture_glib_deprecation_warnings():
            c = Gdk.Cursor(Gdk.CursorType.WATCH)
        self.assertNotEqual(c, None)
        with capture_glib_deprecation_warnings():
            c = Gdk.Cursor(cursor_type=Gdk.CursorType.WATCH)
        self.assertNotEqual(c, None)

        display_manager = Gdk.DisplayManager.get()
        display = display_manager.get_default_display()

        test_pixbuf = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB,
                                           False,
                                           8,
                                           5,
                                           10)

        with capture_glib_deprecation_warnings() as warn:
            c = Gdk.Cursor(display,
                           test_pixbuf,
                           y=0, x=0)
            self.assertNotEqual(c, None)

            self.assertEqual(len(warn), 1)
            self.assertTrue(issubclass(warn[0].category, PyGIDeprecationWarning))
            self.assertRegexpMatches(str(warn[0].message),
                                     '.*new_from_pixbuf.*')

        self.assertRaises(ValueError, Gdk.Cursor, 1, 2, 3)
Beispiel #3
0
 def test_color_parse(self):
     with capture_glib_deprecation_warnings():
         c = Gdk.color_parse('#00FF80')
     self.assertEqual(c.red, 0)
     self.assertEqual(c.green, 65535)
     self.assertEqual(c.blue, 32896)
     self.assertEqual(Gdk.color_parse('bogus'), None)
 def test_color_parse(self):
     with capture_glib_deprecation_warnings():
         c = Gdk.color_parse('#00FF80')
     self.assertEqual(c.red, 0)
     self.assertEqual(c.green, 65535)
     self.assertEqual(c.blue, 32896)
     self.assertEqual(Gdk.color_parse('bogus'), None)
Beispiel #5
0
 def test_color(self):
     color = Gdk.Color(100, 200, 300)
     self.assertEqual(color.red, 100)
     self.assertEqual(color.green, 200)
     self.assertEqual(color.blue, 300)
     with capture_glib_deprecation_warnings():
         self.assertEqual(color, Gdk.Color(100, 200, 300))
     self.assertNotEqual(color, Gdk.Color(1, 2, 3))
 def test_color(self):
     color = Gdk.Color(100, 200, 300)
     self.assertEqual(color.red, 100)
     self.assertEqual(color.green, 200)
     self.assertEqual(color.blue, 300)
     with capture_glib_deprecation_warnings():
         self.assertEqual(color, Gdk.Color(100, 200, 300))
     self.assertNotEqual(color, Gdk.Color(1, 2, 3))
Beispiel #7
0
 def test_out_glist(self):
     display = Gdk.Display.get_default()
     with capture_glib_deprecation_warnings():
         dm = display.get_device_manager()
         device = dm.get_client_pointer()
     axes = device.list_axes()
     axes_names = [atom.name() for atom in axes]
     self.assertNotEqual(axes_names, [])
     self.assertTrue('Rel X' in axes_names)