Ejemplo n.º 1
0
def test_set_get_all():
    from itertools import chain

    a = App()
    w = Waffle(a)

    w.set_all("red")
    # turn 2d list into 1d list
    pixels = chain.from_iterable(zip(*w.get_all()))
    
    count = 0
    for pixel in pixels:
        assert pixel == "red"
        count += 1

    assert count == w.width * w.height

    a.destroy()
Ejemplo n.º 2
0
def test_reset():
    from itertools import chain

    a = App()
    w = Waffle(a)

    w.set_pixel(0, 1, "red")
    w.reset()

    pixels = chain.from_iterable(zip(*w.get_all()))
    
    count = 0
    for pixel in pixels:
        assert pixel == w.color
        count += 1

    assert count == w.width * w.height

    a.destroy()