Beispiel #1
0
    def test_outputStreamParam(self):
        # This tests being able to pass a Python file-like object to a
        # wrapped function expecting a wxOutputStream.

        image = wx.Image(pngFile)
        stream = FileLikeObject()
        image.SaveFile(stream, wx.BITMAP_TYPE_PNG)
        del image
        
        stream = FileLikeObject(stream.getvalue())        
        image = wx.Image(stream)
        self.assertTrue(image.IsOk())
Beispiel #2
0
    def test_inputStreamParam(self):
        # This tests being able to pass a Python file-like object to a
        # wrapped function expecting a wxInputStream.

        # First, load the image data into a StringIO object
        with open(pngFile, 'rb') as f:
            stream = FileLikeObject(f.read())

        # Then use it to create a wx.Image
        img = wx.Image(stream)
        self.assertTrue(img.IsOk())
Beispiel #3
0
 def test_imageCtor9(self):
     with open(pngFile, 'rb') as f:
         data = f.read()
     stream = FileLikeObject(data)
     img = wx.Image(stream, 'image/png')
     self.assertTrue(img.IsOk())
Beispiel #4
0
 def test_imageCtor8(self):
     with open(pngFile, 'rb') as f:
         data = f.read()
     stream = FileLikeObject(data)
     img = wx.Image(stream, wx.BITMAP_TYPE_PNG)
     self.assertTrue(img.IsOk())