def test_frame_geom():
    frame = DirectFrame(geom=NodePath("geom-a"))
    assert frame.hascomponent('geom0')
    assert not frame.hascomponent('geom1')
    assert frame.component('geom0').name == "geom-a"

    # Change geom
    frame.setGeom(NodePath("geom-b"))
    assert frame.component('geom0').name == "geom-b"

    # Clear geom
    frame.clearGeom()
    assert not frame.hascomponent('geom0')
def test_frame_geom_states():
    frame = DirectFrame(geom=(NodePath("A"), NodePath("B"), NodePath("C")),
                        numStates=3)
    assert frame.hascomponent('geom0')
    assert frame.hascomponent('geom1')
    assert frame.hascomponent('geom2')
    assert not frame.hascomponent('geom3')

    assert frame.component('geom0').name == "A"
    assert frame.component('geom1').name == "B"
    assert frame.component('geom2').name == "C"

    # Change geom for all states
    frame.setGeom(NodePath("Foo"))

    assert frame.component('geom0').name == "Foo"
    assert frame.component('geom1').name == "Foo"
    assert frame.component('geom2').name == "Foo"

    # Change geom per state
    states = (NodePath("1"), NodePath("2"), NodePath("3"))
    frame.setGeom(states)
    assert frame.component('geom0').name == "1"
    assert frame.component('geom1').name == "2"
    assert frame.component('geom2').name == "3"

    # Changing via list should work too
    frame.setGeom(list(states))

    # Clear geom
    frame.clearGeom()
    assert not frame.hascomponent('geom0')
    assert not frame.hascomponent('geom1')
    assert not frame.hascomponent('geom2')