Exemplo n.º 1
0
def test_empty_application():
    assert pytest.raises(eaf.errors.ApplicationNotInitializedError,
                         eaf.app.current)
    assert pytest.raises(eaf.errors.ApplicationNotInitializedError,
                         Application.current)

    app = Application()
    assert eaf.app.current() is app
    assert Application.current() is app

    assert pytest.raises(eaf.errors.ApplicationIsEmpty, lambda: app.state)
    assert pytest.raises(eaf.errors.ApplicationIsEmpty, app.start)

    assert app.renderer is not None
    assert app.event_queue is None

    assert app.fps is not None
    app.fps = 40
    assert app.fps == 40

    assert eaf.app.current() is app
    del app
    assert pytest.raises(eaf.errors.ApplicationNotInitializedError,
                         eaf.app.current)
Exemplo n.º 2
0
 def inner(mock_app=False):
     if mock_app:
         mock_application()
     Application.current().register(MockedState)
     return Application.current().state
Exemplo n.º 3
0
 def stop():
     try:
         Application.current().deregister(MockedState.__name__)
     except eaf.errors.ApplicationNotInitializedError:
         pass
Exemplo n.º 4
0
 def _finalize():
     try:
         app = Application.current()
         app.stop()
     except eaf.errors.ApplicationNotInitializedError:
         pass