Esempio n. 1
0
def test_rotate3():
    """Test rotating clockwise."""
    obj_list = [[10.0, 20.0, 270.0, "#000000"], [10.0, 10.0, 0.0, "#ffffff"]]
    main.__think_rotate(obj_list[0], obj_list)
    # rotation should be ~equal to ROTATION_SPEED (variance because floats)
    assert (obj_list[0][2] > 270.0 + (ROTATION_SPEED * 0.9)
            and obj_list[0][2] < 270.0 + (ROTATION_SPEED * 1.1))
Esempio n. 2
0
def test_rotate6():
    """Test rotating clockwise with two others."""
    obj_list = [[20.0, 20.0, 45.0, "#000000"], [20.0, 10.0, 0.0, "#ffffff"],
                [12.0, 20.0, 0.0, "#888888"]]
    main.__think_rotate(obj_list[0], obj_list)
    # rotation should be clockwise (obj_list[1] is closer)
    assert (obj_list[0][2] > 45.0 + (ROTATION_SPEED * 0.9)
            and obj_list[0][2] < 45.0 + (ROTATION_SPEED * 1.1))
Esempio n. 3
0
def test_rotate5():
    """Test rotating clockwise to stop."""
    obj_list = [[10.0, 20.0, 359.0, "#000000"], [10.0, 10.0, 0.0, "#ffffff"]]
    main.__think_rotate(obj_list[0], obj_list)
    # rotation should be ~equal to 360.0 (variance because floats)
    assert (obj_list[0][2] > 359.0 or obj_list[0][2] < 1.0)
Esempio n. 4
0
def test_rotate1():
    """Test rotating to opposite."""
    obj_list = [[10.0, 20.0, 180.0, "#000000"], [10.0, 10.0, 0.0, "#ffffff"]]
    main.__think_rotate(obj_list[0], obj_list)
    assert obj_list[0][2] != 180.0  # don't care which way we rotate