示例#1
0
    def test_from_image_data(self):
        image_data = self.swirl_1_img.load()
        s = SwirlFrameRow()

        s.from_image_data(image_data=image_data, y=0)
        assert_equal(SwirlFrameRow(x1=0, x2=1, x3=0xff, x4=0), s)

        s.from_image_data(image_data=image_data, y=1)
        assert_equal(SwirlFrameRow(x1=0xfe, x2=0xff, x3=0xff, x4=0), s)

        s.from_image_data(image_data=image_data, y=2)
        assert_equal(SwirlFrameRow(x1=0, x2=1, x3=0xfe, x4=0xff), s)

        s.from_image_data(image_data=image_data, y=3)
        assert_equal(SwirlFrameRow(x1=0, x2=1, x3=3, x4=4), s)

        s.from_image_data(image_data=image_data, y=4)
        assert_equal(SwirlFrameRow(x1=0xff, x2=0, x3=0xff, x4=0), s)
示例#2
0
    def test_from_image_data(self):
        image_data = self.swirl_1_img.load()
        s = SwirlFrameRow()

        s.from_image_data(image_data=image_data, y=0)
        assert_equal(SwirlFrameRow(x1=0, x2=1, x3=0xff, x4=0), s)

        s.from_image_data(image_data=image_data, y=1)
        assert_equal(SwirlFrameRow(x1=0xfe, x2=0xff, x3=0xff, x4=0), s)

        s.from_image_data(image_data=image_data, y=2)
        assert_equal(SwirlFrameRow(x1=0, x2=1, x3=0xfe, x4=0xff), s)

        s.from_image_data(image_data=image_data, y=3)
        assert_equal(SwirlFrameRow(x1=0, x2=1, x3=3, x4=4), s)

        s.from_image_data(image_data=image_data, y=4)
        assert_equal(SwirlFrameRow(x1=0xff, x2=0, x3=0xff, x4=0), s)