tests/kms/render: Add test for setting empty config

This should disable CRTCs and unassign outputs.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3318>
This commit is contained in:
Jonas Ådahl 2023-10-09 16:16:03 +08:00 committed by Marge Bot
parent f9bbe22499
commit b1b95c8681
3 changed files with 38 additions and 1 deletions

View File

@ -328,6 +328,7 @@ void meta_monitor_manager_confirm_configuration (MetaMonitorManag
gboolean meta_monitor_manager_has_hotplug_mode_update (MetaMonitorManager *manager);
META_EXPORT_TEST
void meta_monitor_manager_read_current_state (MetaMonitorManager *manager);
META_EXPORT_TEST
@ -435,3 +436,9 @@ MetaViewportInfo * meta_monitor_manager_get_viewports (MetaMonitorManager *manag
GList * meta_monitor_manager_get_virtual_monitors (MetaMonitorManager *manager);
void meta_monitor_manager_maybe_emit_privacy_screen_change (MetaMonitorManager *manager);
META_EXPORT_TEST
gboolean meta_monitor_manager_apply_monitors_config (MetaMonitorManager *manager,
MetaMonitorsConfig *config,
MetaMonitorsConfigMethod method,
GError **error);

View File

@ -725,7 +725,7 @@ meta_monitor_manager_ensure_initial_config (MetaMonitorManager *manager)
META_MONITOR_MANAGER_GET_CLASS (manager)->ensure_initial_config (manager);
}
static gboolean
gboolean
meta_monitor_manager_apply_monitors_config (MetaMonitorManager *manager,
MetaMonitorsConfig *config,
MetaMonitorsConfigMethod method,

View File

@ -472,6 +472,34 @@ meta_test_kms_render_client_scanout_fallback (void)
meta_wayland_test_client_finish (wayland_test_client);
}
static void
meta_test_kms_render_empty_config (void)
{
MetaBackend *backend = meta_context_get_backend (test_context);
MetaMonitorManager *monitor_manager = meta_backend_get_monitor_manager (backend);
GList *logical_monitors;
GError *error = NULL;
logical_monitors = meta_monitor_manager_get_logical_monitors (monitor_manager);
g_assert_cmpuint (g_list_length (logical_monitors), ==, 1);
meta_monitor_manager_read_current_state (monitor_manager);
meta_monitor_manager_apply_monitors_config (monitor_manager,
NULL,
META_MONITORS_CONFIG_METHOD_TEMPORARY,
&error);
g_assert_no_error (error);
logical_monitors = meta_monitor_manager_get_logical_monitors (monitor_manager);
g_assert_cmpuint (g_list_length (logical_monitors), ==, 0);
meta_monitor_manager_read_current_state (monitor_manager);
meta_monitor_manager_ensure_configured (monitor_manager);
logical_monitors = meta_monitor_manager_get_logical_monitors (monitor_manager);
g_assert_cmpuint (g_list_length (logical_monitors), ==, 1);
}
static void
init_tests (void)
{
@ -481,6 +509,8 @@ init_tests (void)
meta_test_kms_render_client_scanout);
g_test_add_func ("/backends/native/kms/render/client-scanout-fallabck",
meta_test_kms_render_client_scanout_fallback);
g_test_add_func ("/backends/native/kms/render/empty-config",
meta_test_kms_render_empty_config);
}
int