Exemplo n.º 1
0
def test_draw_dots3():
    img = Image(20, 20)

    img.draw_dots(((2, 2), (2, 18), (10, 10)), diameter=3)

    img.draw_dots(((18, 18), (18, 2)), diameter=4, color='red')

    img.save(outfile("test_image_points3.png"), "png")
Exemplo n.º 2
0
def test_draw_dots_wrong_shape():
    """
    test passing in a wrong-shaped points
    """
    w, h, = 1000, 500
    img = Image(w, h)

    points = [(1, 2, 3), (4, 5, 6), (7, 8, 9), (10, 11, 12)]

    with pytest.raises(ValueError):
        img.draw_dots(points, diameter=2, color='red')

    assert True
Exemplo n.º 3
0
def test_draw_dots_lots():
    """
    test drawing a lot of dots
    """
    import random
    w, h, = 1000, 500
    img = Image(w, h)

    points = [(random.randint(0, w), random.randint(0, w))
              for _i in range(10000)]

    img.draw_dots(points, diameter=2, color='red')

    img.save(outfile("test_image_dots_lots.png"), 'png')
Exemplo n.º 4
0
def test_draw_dots_large():
    img = Image(200, 200)

    img.draw_dots(((5, 5), ), diameter=3, color='red')

    img.draw_dots(((15, 15), ), diameter=4, color='red')

    img.draw_dots(((25, 25), ), diameter=5, color='red')

    img.draw_dots(((35, 35), ), diameter=6, color='red')

    img.draw_dots(((45, 45), ), diameter=7, color='red')

    img.draw_dots(((55, 55), ), diameter=9, color='red')

    img.draw_dots(((65, 65), ), diameter=12, color='red')

    img.draw_dots(((80, 80), ), diameter=15, color='red')

    img.draw_dots(((100, 100), ), diameter=20, color='red')

    img.draw_dots(((120, 120), ), diameter=30, color='red')

    img.draw_dots(((65, 65), ), diameter=12, color='red')

    img.save(outfile("test_image_dots_large.png"), "png")