Taylor Bockman
5 years ago
6 changed files with 99 additions and 44 deletions
@ -1,7 +1,37 @@ |
|||||||
|
import pytest |
||||||
|
|
||||||
|
from clusterview.exceptions import ExceededWindowBoundsError |
||||||
from clusterview.points import Point |
from clusterview.points import Point |
||||||
|
|
||||||
def test_move_point(): |
def test_move_point(): |
||||||
p = Point(1, 2, 8) |
# The minimum starting position is 1/2 point away |
||||||
|
# from the edges |
||||||
|
p = Point(4, 4, 8, 100, 100) |
||||||
|
|
||||||
p.move(1, 1) |
p.move(1, 1) |
||||||
|
|
||||||
assert p.x == 2 and p.y == 3 |
assert p.x == 5 and p.y == 5 |
||||||
|
|
||||||
|
def test_move_point_outside_screen_x_positive(): |
||||||
|
p = Point(1, 2, 8, 100, 100) |
||||||
|
|
||||||
|
with pytest.raises(ExceededWindowBoundsError): |
||||||
|
p.move(96, 0) |
||||||
|
|
||||||
|
def test_move_point_outside_screen_y_positive(): |
||||||
|
p = Point(1, 2, 8, 100, 100) |
||||||
|
|
||||||
|
with pytest.raises(ExceededWindowBoundsError): |
||||||
|
p.move(0, 95) |
||||||
|
|
||||||
|
def test_move_point_outside_screen_x_negative(): |
||||||
|
p = Point(1, 2, 8, 100, 100) |
||||||
|
|
||||||
|
with pytest.raises(ExceededWindowBoundsError): |
||||||
|
p.move(-2, 0) |
||||||
|
|
||||||
|
def test_move_point_outside_screen_y_negative(): |
||||||
|
p = Point(1, 2, 8, 100, 100) |
||||||
|
|
||||||
|
with pytest.raises(ExceededWindowBoundsError): |
||||||
|
p.move(0, -3) |
||||||
|
Loading…
Reference in new issue