diff --git a/src/backends/meta-monitor-manager-private.h b/src/backends/meta-monitor-manager-private.h index 242fc2353..2d45fe777 100644 --- a/src/backends/meta-monitor-manager-private.h +++ b/src/backends/meta-monitor-manager-private.h @@ -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); diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c index 3b836f327..b85130fa3 100644 --- a/src/backends/meta-monitor-manager.c +++ b/src/backends/meta-monitor-manager.c @@ -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, diff --git a/src/tests/native-kms-render.c b/src/tests/native-kms-render.c index 31e74a9a4..90ea9b581 100644 --- a/src/tests/native-kms-render.c +++ b/src/tests/native-kms-render.c @@ -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