From 99a0b43f2884d0f663bb4b644d771abc10c662bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 21 Mar 2017 17:16:04 +0800 Subject: [PATCH] tests: Derive configuration when stage views is disabled In order to test deriving the logical state from the underlying configuration, as is always done on X11, make the test backend derive the state when stage views are disabled. https://bugzilla.gnome.org/show_bug.cgi?id=777732 --- src/tests/meta-monitor-manager-test.c | 11 ++++-- src/tests/monitor-store-unit-tests.c | 6 ++++ src/tests/monitor-unit-tests.c | 51 +++++++++++++++++++++++++-- 3 files changed, 63 insertions(+), 5 deletions(-) diff --git a/src/tests/meta-monitor-manager-test.c b/src/tests/meta-monitor-manager-test.c index c5a912926..2f68809c7 100644 --- a/src/tests/meta-monitor-manager-test.c +++ b/src/tests/meta-monitor-manager-test.c @@ -268,7 +268,10 @@ meta_monitor_manager_test_apply_monitors_config (MetaMonitorManager *manage manager->screen_width = 1; manager->screen_height = 1; - meta_monitor_manager_rebuild (manager, NULL); + if (meta_is_stage_views_enabled ()) + meta_monitor_manager_rebuild (manager, NULL); + else + meta_monitor_manager_rebuild_derived (manager); return TRUE; } @@ -296,7 +299,11 @@ meta_monitor_manager_test_apply_monitors_config (MetaMonitorManager *manage g_ptr_array_free (output_infos, TRUE); update_screen_size (manager, config); - meta_monitor_manager_rebuild (manager, config); + + if (meta_is_stage_views_enabled ()) + meta_monitor_manager_rebuild (manager, config); + else + meta_monitor_manager_rebuild_derived (manager); return TRUE; } diff --git a/src/tests/monitor-store-unit-tests.c b/src/tests/monitor-store-unit-tests.c index 121c0bb01..e01562deb 100644 --- a/src/tests/monitor-store-unit-tests.c +++ b/src/tests/monitor-store-unit-tests.c @@ -510,6 +510,12 @@ meta_test_monitor_store_scale (void) return; } + if (!meta_is_stage_views_enabled ()) + { + g_test_skip ("Not using stage views"); + return; + } + set_custom_monitor_config ("scale.xml"); check_monitor_configurations (&expect); diff --git a/src/tests/monitor-unit-tests.c b/src/tests/monitor-unit-tests.c index a23401ad1..42ebce9a4 100644 --- a/src/tests/monitor-unit-tests.c +++ b/src/tests/monitor-unit-tests.c @@ -707,6 +707,7 @@ check_monitor_configuration (MonitorTestCase *test_case) else { MetaCrtc *crtc = &monitor_manager->crtcs[i]; + MetaLogicalMonitor *logical_monitor = crtc->logical_monitor; MetaCrtcMode *expected_current_mode = &monitor_manager->modes[test_case->expect.crtcs[i].current_mode]; int crtc_x, crtc_y; @@ -717,10 +718,30 @@ check_monitor_configuration (MonitorTestCase *test_case) ==, test_case->expect.crtcs[i].transform); - get_compensated_crtc_position (crtc, &crtc_x, &crtc_y); + if (meta_is_stage_views_enabled ()) + { + get_compensated_crtc_position (crtc, &crtc_x, &crtc_y); - g_assert_cmpint (crtc_x, ==, test_case->expect.crtcs[i].x); - g_assert_cmpint (crtc_y, ==, test_case->expect.crtcs[i].y); + g_assert_cmpint (crtc_x, ==, test_case->expect.crtcs[i].x); + g_assert_cmpint (crtc_y, ==, test_case->expect.crtcs[i].y); + } + else + { + int expect_crtc_x; + int expect_crtc_y; + + g_assert_cmpuint (logical_monitor->transform, + ==, + crtc->transform); + + expect_crtc_x = (test_case->expect.crtcs[i].x + + logical_monitor->rect.x); + expect_crtc_y = (test_case->expect.crtcs[i].y + + logical_monitor->rect.y); + + g_assert_cmpint (crtc->rect.x, ==, expect_crtc_x); + g_assert_cmpint (crtc->rect.y, ==, expect_crtc_y); + } } } } @@ -1455,6 +1476,12 @@ meta_test_monitor_hidpi_linear_config (void) return; } + if (!meta_is_stage_views_enabled ()) + { + g_test_skip ("Not using stage views"); + return; + } + test_setup = create_monitor_test_setup (&test_case, MONITOR_TEST_FLAG_NO_STORED); emulate_hotplug (test_setup); @@ -2788,6 +2815,12 @@ meta_test_monitor_custom_scale_config (void) return; } + if (!meta_is_stage_views_enabled ()) + { + g_test_skip ("Not using stage views"); + return; + } + test_setup = create_monitor_test_setup (&test_case, MONITOR_TEST_FLAG_NONE); set_custom_monitor_config ("scale.xml"); @@ -2924,6 +2957,12 @@ meta_test_monitor_custom_tiled_config (void) return; } + if (!meta_is_stage_views_enabled ()) + { + g_test_skip ("Not using stage views"); + return; + } + test_setup = create_monitor_test_setup (&test_case, MONITOR_TEST_FLAG_NONE); set_custom_monitor_config ("tiled.xml"); @@ -3079,6 +3118,12 @@ meta_test_monitor_custom_tiled_custom_resolution_config (void) return; } + if (!meta_is_stage_views_enabled ()) + { + g_test_skip ("Not using stage views"); + return; + } + test_setup = create_monitor_test_setup (&test_case, MONITOR_TEST_FLAG_NONE); set_custom_monitor_config ("tiled-custom-resolution.xml");