diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-07-12 08:42:56 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-07-12 08:43:00 +0900 |
commit | 54fae7ae44d06bd920816004a686c1e17751cb54 (patch) | |
tree | 3485945c492a0bc5f5d83faf374687cd1d66b7f9 /tests/compat_test_pygtk.py | |
parent | d6533baedc708736d91c255cccc1b4507942ee85 (diff) | |
download | pygobject2-54fae7ae44d06bd920816004a686c1e17751cb54.tar.gz pygobject2-54fae7ae44d06bd920816004a686c1e17751cb54.tar.bz2 pygobject2-54fae7ae44d06bd920816004a686c1e17751cb54.zip |
Imported Upstream version 3.15.0
Change-Id: I02b859dff581f456d759a90a2aea3eeec391e2ff
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'tests/compat_test_pygtk.py')
-rw-r--r-- | tests/compat_test_pygtk.py | 16 |
1 files changed, 15 insertions, 1 deletions
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) |