From 54fae7ae44d06bd920816004a686c1e17751cb54 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Wed, 12 Jul 2017 08:42:56 +0900 Subject: Imported Upstream version 3.15.0 Change-Id: I02b859dff581f456d759a90a2aea3eeec391e2ff Signed-off-by: DongHun Kwak --- tests/compat_test_pygtk.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'tests/compat_test_pygtk.py') diff --git a/tests/compat_test_pygtk.py b/tests/compat_test_pygtk.py index f0126c3..b2e7a11 100644 --- a/tests/compat_test_pygtk.py +++ b/tests/compat_test_pygtk.py @@ -3,14 +3,20 @@ import unittest import contextlib +import base64 +import gi from gi.repository import GLib try: + try: + gi.require_version("Gtk", "3.0") + except ValueError as e: + raise ImportError(e) + from gi.repository import Gtk from gi.repository import Pango from gi.repository import Atk from gi.repository import Gdk - from gi.repository import Gtk (Atk, Gtk, Pango) # pyflakes import pygtkcompat @@ -143,9 +149,17 @@ class TestGTKCompat(unittest.TestCase): gtk.gdk.Pixbuf() def test_pixbuf_loader(self): + # load a 1x1 pixel PNG from memory + data = base64.b64decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP4n8Dw' + 'HwAGIAJf85Z3XgAAAABJRU5ErkJggg==') loader = gtk.gdk.PixbufLoader('png') + loader.write(data) loader.close() + pixbuf = loader.get_pixbuf() + self.assertEqual(pixbuf.get_width(), 1) + self.assertEqual(pixbuf.get_height(), 1) + def test_pixbuf_formats(self): formats = gtk.gdk.pixbuf_get_formats() self.assertEqual(type(formats[0]), dict) -- cgit v1.2.3