예제 #1
0
def test_add_photo():
    canvas = Canvas()
    canvas._width = 100
    canvas._height = 150
    canvas._photos = 5
    canvas._map = {(0,0): "None", (0,50): "None", (0,100): "None", (0,150): "None",
                   (50,0): "None", (50,50): "None", (50,100): "None", (50,150): "None",
                   (100,0): "None", (100,50): "None", (100,100): "None", (100,150): "None"}
    canvas.add_photo((0,20), (90, 80), "P_06")
    assert canvas._photos == 6
    assert canvas._map == {(0,0): "P_06", (0,50): "P_06", (0,100): "None", (0,150): "None",
                        (50,0): "P_06", (50,50): "P_06", (50,100): "None", (50,150): "None",
                        (100,0): "None", (100,50): "None", (100,100): "None", (100,150): "None"}
예제 #2
0
def test_possibility_true():
    canvas = Canvas()
    canvas.add_photo((464, 934), (754, 1000), "P_01")
    result = canvas._possibility((764, 234), (1254, 600))
    assert result == True
예제 #3
0
def test_possibility_false():
    canvas = Canvas()
    canvas.add_photo((464, 934), (754, 1000), "P_01")
    result = canvas._possibility((176, 754), (470, 910))
    assert result == False