示例#1
0
    def test_xor_pixel_sets_correct_values(self):
        """Xoring a pixel draws correctly for both on and off pixels """
        v = VideoRam(3, 5)

        v.xor_pixel(2, 4, True)
        assert v.pixels[14]

        v.xor_pixel(2, 4, True)
        assert not v.pixels[14]
示例#2
0
    def test_wrapping_when_set(self):
        """Coordinates exceeding dimensions wrap when wrapping is on"""
        v = VideoRam(2, 2, wrap=True)
        assert v.wrap

        assert not v.xor_pixel(2, 2, True)

        assert v[0, 0]
        assert not v[1, 0]
        assert not v[0, 1]
        assert not v[1, 1]
示例#3
0
 def test_wrapping_unset(self):
     """Coordinates exceeding dimensions don't wrap if wrapping is off"""
     v = VideoRam(1, 1)
     assert not v.xor_pixel(1, 1, True)
     assert not v[0, 0]
示例#4
0
 def test_xor_pixel_signals_switchoffs(self):
     """Xoring a pixel returns correct switch-off signals"""
     v = VideoRam(2, 4)
     assert not v.xor_pixel(1, 3, True)
     assert v.xor_pixel(1, 3, True)