Example #1
0
def test_InertialObject_update__negative_rotation():
    sut = InertialObject(img=resources.chevron_image)

    sut.rotation = 0.0

    sut.rotation_speed = -15.0

    sut.update(1.0)

    assert sut.rotation == 345.0
Example #2
0
def test_InertialObject_update__motionless_rotation():
    sut = InertialObject(img=resources.chevron_image)

    sut.rotation = 0.0

    sut.rotation_speed = 0.0

    sut.update(1.0)

    assert sut.rotation == 0.0
Example #3
0
def test_InertialObject_update__rotation_partial_dt():
    sut = InertialObject(img=resources.chevron_image)

    sut.rotation = 0.0

    sut.rotation_speed = -10.0

    sut.update(0.5)

    assert sut.rotation == 355.0
Example #4
0
def test_InertialObject_update__partial_dt():
    sut = InertialObject(img=resources.chevron_image)

    sut.x = 23.45
    sut.y = 123.34

    sut.velocity_x = 10.0
    sut.velocity_y = -5.0

    sut.update(0.5)

    assert sut.x == 28.45
    assert sut.y == 120.84
Example #5
0
def test_InertialObject_update__diagonal():
    sut = InertialObject(img=resources.chevron_image)

    sut.x = 23.45
    sut.y = 123.34

    sut.velocity_x = 10.0
    sut.velocity_y = -5.0

    sut.update(1.0)

    assert sut.x == 33.45
    assert sut.y == 118.34
Example #6
0
def test_InertialObject_update__motionless():
    sut = InertialObject(img=resources.chevron_image)

    sut.x = 23.45
    sut.y = 123.34

    sut.velocity_x = 0.0
    sut.velocity_y = 0.0

    sut.update(1.0)

    assert sut.x == 23.45
    assert sut.y == 123.34