Esempio n. 1
0
def test_InertialObject_die():
    sut = InertialObject(img=resources.chevron_image)

    assert not sut.dead

    sut.die()

    assert sut.dead
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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