From 46e3d20057c90bf607889d4810b9c9699bf324ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 26 Feb 2020 09:35:14 +0100 Subject: [PATCH] tests/monitor-unit-tests: Make hotplug mode part of test setup https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287 --- src/tests/monitor-test-utils.c | 12 ++++++++++-- src/tests/monitor-test-utils.h | 3 +++ src/tests/monitor-unit-tests.c | 24 ++++++++---------------- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/tests/monitor-test-utils.c b/src/tests/monitor-test-utils.c index d4d6d4e7d..61d85c627 100644 --- a/src/tests/monitor-test-utils.c +++ b/src/tests/monitor-test-utils.c @@ -671,8 +671,16 @@ create_monitor_test_setup (MonitorTestCaseSetup *setup, output->vendor = g_strdup ("MetaProduct's Inc."); output->product = g_strdup ("MetaMonitor"); output->serial = g_strdup (serial); - output->suggested_x = -1; - output->suggested_y = -1; + if (setup->outputs[i].hotplug_mode) + { + output->suggested_x = setup->outputs[i].suggested_x; + output->suggested_y = setup->outputs[i].suggested_y; + } + else + { + output->suggested_x = -1; + output->suggested_y = -1; + } output->hotplug_mode_update = hotplug_mode_update; output->width_mm = setup->outputs[i].width_mm; output->height_mm = setup->outputs[i].height_mm; diff --git a/src/tests/monitor-test-utils.h b/src/tests/monitor-test-utils.h index f3b71a915..db6be98f3 100644 --- a/src/tests/monitor-test-utils.h +++ b/src/tests/monitor-test-utils.h @@ -107,6 +107,9 @@ typedef struct _MonitorTestCaseOutput gboolean is_underscanning; const char *serial; MetaMonitorTransform panel_orientation_transform; + gboolean hotplug_mode; + int suggested_x; + int suggested_y; } MonitorTestCaseOutput; typedef struct _MonitorTestCaseCrtc diff --git a/src/tests/monitor-unit-tests.c b/src/tests/monitor-unit-tests.c index 8d857b3e3..6cce73997 100644 --- a/src/tests/monitor-unit-tests.c +++ b/src/tests/monitor-unit-tests.c @@ -1178,15 +1178,6 @@ meta_test_monitor_hidpi_linear_config (void) check_monitor_test_clients_state (); } -static void -set_suggested_output_position (MetaOutput *output, - int x, - int y) -{ - output->suggested_x = x; - output->suggested_y = y; -} - static void meta_test_monitor_suggested_config (void) { @@ -1214,7 +1205,10 @@ meta_test_monitor_suggested_config (void) .possible_crtcs = { 0 }, .n_possible_crtcs = 1, .width_mm = 222, - .height_mm = 125 + .height_mm = 125, + .hotplug_mode = TRUE, + .suggested_x = 1024, + .suggested_y = 758, }, { .crtc = 1, @@ -1224,7 +1218,10 @@ meta_test_monitor_suggested_config (void) .possible_crtcs = { 1 }, .n_possible_crtcs = 1, .width_mm = 220, - .height_mm = 124 + .height_mm = 124, + .hotplug_mode = TRUE, + .suggested_x = 0, + .suggested_y = 0, } }, .n_outputs = 2, @@ -1327,11 +1324,6 @@ meta_test_monitor_suggested_config (void) test_setup = create_monitor_test_setup (&test_case.setup, MONITOR_TEST_FLAG_NO_STORED); - set_suggested_output_position (g_list_nth_data (test_setup->outputs, 0), - 1024, 758); - set_suggested_output_position (g_list_nth_data (test_setup->outputs, 1), - 0, 0); - emulate_hotplug (test_setup); check_monitor_configuration (&test_case.expect); check_monitor_test_clients_state ();