diff --git a/tests/pyportaltest/test_remotedesktop.py b/tests/pyportaltest/test_remotedesktop.py index c230edf..b069e0c 100644 --- a/tests/pyportaltest/test_remotedesktop.py +++ b/tests/pyportaltest/test_remotedesktop.py @@ -55,6 +55,7 @@ def create_session( start_session=True, persist_mode=None, restore_token=None, + cb_closed_signal=None, ) -> SessionSetup: params = params or {} # To make the tests easier, load ScreenCast automatically if we have @@ -119,6 +120,9 @@ def create_session_done(portal, task, data): assert session.get_session_type() == Xdp.SessionType.REMOTE_DESKTOP + if cb_closed_signal: + session.connect("closed", cb_closed_signal) + if outputs: # open the PW remote by default since we need it anyway for Start() handle = session.open_pipewire_remote() @@ -580,9 +584,6 @@ def test_close_session_signal(self): Ensure that we get the GObject signal when our session is closed externally. """ - params = {"close-after-start": 500} - setup = self.create_session(params=params) - session = setup.session session_closed_signal_received = False @@ -591,8 +592,8 @@ def session_closed(session): session_closed_signal_received = True self.mainloop.quit() - session.connect("closed", session_closed) - + params = {"close-after-start": 500} + self.create_session(params=params, cb_closed_signal=session_closed) self.setup_mainloop_with_timeout(timeout_ms=0).run() assert session_closed_signal_received is True