示例#1
0
    def test_delayed_loading(self):
        pixel_array = pixel_array_factory([[Black]])

        class Loader(object):
            def __init__(self):
                self.callcount = 0

            def __call__(self):
                self.callcount += 1
                return pixel_array, None

        loader = Loader()
        image = Image(RGBA, 1, 1, loader)
        self.assertEqual(loader.callcount, 0)
        image.set_color(0, 0, White)
        self.assertEqual(loader.callcount, 1)
        image.flip_left_right()
        self.assertEqual(loader.callcount, 1)
示例#2
0
    def test_delayed_loading(self):
        pixel_array = pixel_array_factory([
            [Black]
        ])
        class Loader(object):
            def __init__(self):
                self.callcount = 0

            def __call__(self):
                self.callcount += 1
                return pixel_array, None
        loader = Loader()
        image = Image(RGBA, 1, 1, loader)
        self.assertEqual(loader.callcount, 0)
        image.set_color(0, 0, White)
        self.assertEqual(loader.callcount, 1)
        image.flip_left_right()
        self.assertEqual(loader.callcount, 1)
示例#3
0
 def loader():
     return pixel_array_factory([[Black]]), None
示例#4
0
 def loader():
     return pixel_array_factory([[Black]]), None