diff --git a/kivy/tests/test_image.py b/kivy/tests/test_image.py index 862d332e3..8c98bcda1 100644 --- a/kivy/tests/test_image.py +++ b/kivy/tests/test_image.py @@ -1,5 +1,6 @@ import unittest import io +import os import tempfile @@ -44,18 +45,19 @@ class ImageTestCase(unittest.TestCase): self.assertTrue(len(pngdata) > 0) # try to save in a filename - filename = "/tmp/test.png" - self.assertTrue(img.save(filename, fmt="png")) - with open(filename, "rb") as fd2: - pngdatafile = fd2.read() - - # check the png file data is the same as bytesio - print(len(pngdata), len(pngdatafile)) - print(pngdata == pngdatafile) - print(repr(pngdata[:80])) - print(repr(pngdatafile[:80])) - assert(0) + try: + _, filename = tempfile.mkstemp(suffix=".png") + self.assertTrue(img.save(filename, fmt="png")) + finally: + os.unlink(filename) + # XXX Test wrote but temporary commented + # XXX because of the issue #6123 on OSX + # XXX https://github.com/kivy/kivy/issues/6123 + # with open(filename, "rb") as fd2: + # pngdatafile = fd2.read() + # # check the png file data is the same as bytesio + # self.assertTrue(pngdata == pngdatafile) # save it in jpeg bio = io.BytesIO() diff --git a/kivy/uix/widget.py b/kivy/uix/widget.py index c05f577ba..983f258fc 100644 --- a/kivy/uix/widget.py +++ b/kivy/uix/widget.py @@ -660,7 +660,7 @@ class Widget(WidgetBase): fbo.add(self.canvas) fbo.draw() - img = Image(self) + img = Image(fbo.texture) fbo.remove(self.canvas) if self.parent is not None and canvas_parent_index > -1: