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
This commit is contained in:
Jonas Ådahl 2017-03-21 17:16:04 +08:00
parent af4017de49
commit 99a0b43f28
3 changed files with 63 additions and 5 deletions

View File

@ -268,7 +268,10 @@ meta_monitor_manager_test_apply_monitors_config (MetaMonitorManager *manage
manager->screen_width = 1; manager->screen_width = 1;
manager->screen_height = 1; manager->screen_height = 1;
if (meta_is_stage_views_enabled ())
meta_monitor_manager_rebuild (manager, NULL); meta_monitor_manager_rebuild (manager, NULL);
else
meta_monitor_manager_rebuild_derived (manager);
return TRUE; return TRUE;
} }
@ -296,7 +299,11 @@ meta_monitor_manager_test_apply_monitors_config (MetaMonitorManager *manage
g_ptr_array_free (output_infos, TRUE); g_ptr_array_free (output_infos, TRUE);
update_screen_size (manager, config); update_screen_size (manager, config);
if (meta_is_stage_views_enabled ())
meta_monitor_manager_rebuild (manager, config); meta_monitor_manager_rebuild (manager, config);
else
meta_monitor_manager_rebuild_derived (manager);
return TRUE; return TRUE;
} }

View File

@ -510,6 +510,12 @@ meta_test_monitor_store_scale (void)
return; return;
} }
if (!meta_is_stage_views_enabled ())
{
g_test_skip ("Not using stage views");
return;
}
set_custom_monitor_config ("scale.xml"); set_custom_monitor_config ("scale.xml");
check_monitor_configurations (&expect); check_monitor_configurations (&expect);

View File

@ -707,6 +707,7 @@ check_monitor_configuration (MonitorTestCase *test_case)
else else
{ {
MetaCrtc *crtc = &monitor_manager->crtcs[i]; MetaCrtc *crtc = &monitor_manager->crtcs[i];
MetaLogicalMonitor *logical_monitor = crtc->logical_monitor;
MetaCrtcMode *expected_current_mode = MetaCrtcMode *expected_current_mode =
&monitor_manager->modes[test_case->expect.crtcs[i].current_mode]; &monitor_manager->modes[test_case->expect.crtcs[i].current_mode];
int crtc_x, crtc_y; int crtc_x, crtc_y;
@ -717,11 +718,31 @@ check_monitor_configuration (MonitorTestCase *test_case)
==, ==,
test_case->expect.crtcs[i].transform); test_case->expect.crtcs[i].transform);
if (meta_is_stage_views_enabled ())
{
get_compensated_crtc_position (crtc, &crtc_x, &crtc_y); get_compensated_crtc_position (crtc, &crtc_x, &crtc_y);
g_assert_cmpint (crtc_x, ==, test_case->expect.crtcs[i].x); 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_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; return;
} }
if (!meta_is_stage_views_enabled ())
{
g_test_skip ("Not using stage views");
return;
}
test_setup = create_monitor_test_setup (&test_case, test_setup = create_monitor_test_setup (&test_case,
MONITOR_TEST_FLAG_NO_STORED); MONITOR_TEST_FLAG_NO_STORED);
emulate_hotplug (test_setup); emulate_hotplug (test_setup);
@ -2788,6 +2815,12 @@ meta_test_monitor_custom_scale_config (void)
return; return;
} }
if (!meta_is_stage_views_enabled ())
{
g_test_skip ("Not using stage views");
return;
}
test_setup = create_monitor_test_setup (&test_case, test_setup = create_monitor_test_setup (&test_case,
MONITOR_TEST_FLAG_NONE); MONITOR_TEST_FLAG_NONE);
set_custom_monitor_config ("scale.xml"); set_custom_monitor_config ("scale.xml");
@ -2924,6 +2957,12 @@ meta_test_monitor_custom_tiled_config (void)
return; return;
} }
if (!meta_is_stage_views_enabled ())
{
g_test_skip ("Not using stage views");
return;
}
test_setup = create_monitor_test_setup (&test_case, test_setup = create_monitor_test_setup (&test_case,
MONITOR_TEST_FLAG_NONE); MONITOR_TEST_FLAG_NONE);
set_custom_monitor_config ("tiled.xml"); set_custom_monitor_config ("tiled.xml");
@ -3079,6 +3118,12 @@ meta_test_monitor_custom_tiled_custom_resolution_config (void)
return; return;
} }
if (!meta_is_stage_views_enabled ())
{
g_test_skip ("Not using stage views");
return;
}
test_setup = create_monitor_test_setup (&test_case, test_setup = create_monitor_test_setup (&test_case,
MONITOR_TEST_FLAG_NONE); MONITOR_TEST_FLAG_NONE);
set_custom_monitor_config ("tiled-custom-resolution.xml"); set_custom_monitor_config ("tiled-custom-resolution.xml");