fix: harden Wayland compositor runtime checks
This commit is contained in:
@@ -110,6 +110,31 @@ class CompositorStateAdapterRegressionTests(unittest.TestCase):
|
||||
|
||||
sourceRemove.assert_called_once_with(41)
|
||||
|
||||
def test_wayland_backend_logs_activation_failure_reason(self) -> None:
|
||||
fakeDisplay = mock.Mock()
|
||||
fakeDisplay.connect.side_effect = ValueError("Unable to connect to display")
|
||||
fakeProtocols = mock.Mock()
|
||||
fakeProtocols.has_runtime_support.return_value = True
|
||||
fakeProtocols.get_display_class.return_value = mock.Mock(return_value=fakeDisplay)
|
||||
backend = compositor_state_wayland.WaylandSharedProtocolsBackend(
|
||||
environment={"WAYLAND_DISPLAY": "wayland-0"},
|
||||
protocols=fakeProtocols,
|
||||
)
|
||||
|
||||
with (
|
||||
mock.patch.object(compositor_state_wayland, "get_session_type", return_value="wayland"),
|
||||
mock.patch.object(compositor_state_wayland.debug, "printMessage") as printMessage,
|
||||
):
|
||||
backend.activate(mock.Mock())
|
||||
|
||||
printMessage.assert_any_call(
|
||||
compositor_state_wayland.debug.LEVEL_WARNING,
|
||||
mock.ANY,
|
||||
True,
|
||||
)
|
||||
self.assertIn("Unable to connect to display", printMessage.call_args_list[-1].args[1])
|
||||
self.assertIsNone(backend._display)
|
||||
|
||||
def test_local_ext_workspace_wrapper_supports_base_pywayland_without_distro_protocol_module(self) -> None:
|
||||
fakeClientModule = types.ModuleType("pywayland.client")
|
||||
|
||||
@@ -234,7 +259,8 @@ class CompositorStateAdapterRegressionTests(unittest.TestCase):
|
||||
backend_name="wayland-shared-protocols",
|
||||
)
|
||||
|
||||
workspace.activate(adapter._handle_workspace_signal)
|
||||
with mock.patch.object(workspace, "is_available", return_value=False):
|
||||
workspace.activate(adapter._handle_workspace_signal)
|
||||
workspace._handle_workspace_state(first_workspace, "active", True)
|
||||
workspace._handle_workspace_manager_done()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user