def test_all_sessions_shut_down(application): gtk_app = GtkApplicationStub() session1, session2 = two_sessions(application, gtk_app) session1.get_service("event_manager").handle(SessionShutdown(None)) session2.get_service("event_manager").handle(SessionShutdown(None)) assert len(application.sessions) == 0 assert gtk_app.has_quit
def test_session_shutdown(application): session1, session2 = two_sessions(application) session2.get_service("event_manager").handle(SessionShutdown(None)) assert len(application.sessions) == 1 assert session1 in application.sessions
def test_all_sessions_shut_down(application): quit_events = [] @event_handler(ApplicationShutdown) def on_quit(event): quit_events.append(event) application.event_manager.subscribe(on_quit) session1, session2 = two_sessions(application) session1.get_service("event_manager").handle(SessionShutdown(None)) session2.get_service("event_manager").handle(SessionShutdown(None)) assert len(application.sessions) == 0 assert quit_events assert quit_events[0].service is application
def confirm_shutdown(): self.event_manager.handle(SessionShutdown(self))