Beispiel #1
0
def test_InertialObject_die():
    sut = InertialObject(img=resources.chevron_image)

    assert not sut.dead

    sut.die()

    assert sut.dead
Beispiel #2
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
Beispiel #3
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
Beispiel #4
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
Beispiel #5
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
Beispiel #6
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
Beispiel #7
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