示例#1
0
    def test_clear_does_not_turn_on_pixels(self):
        """Clearing does not activate any pixels that were already off"""
        v = VideoRam(20, 20)

        v.clear_screen()

        for x, y in all_coordinates(v):
            assert not v.pixels[y * v.width + x]
示例#2
0
    def test_clear_turns_off_pixels(self):
        """Pixels turned on are switched off"""
        v = VideoRam(21, 21)

        for pixel_index in range(len(v.pixels)):
            if pixel_index % 2:
                v.pixels[pixel_index] = True

        v.clear_screen()
        for x, y in all_coordinates(v):
            assert not v[x, y]