tests/monitor: Check that the CRTC "layout" is correct

The layout should be the region of the stage the CRTC represents; check
that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
This commit is contained in:
Jonas Ådahl 2020-10-08 17:36:19 +02:00 committed by Marge Bot
parent 7215b0d88c
commit 3bd0037fa1
3 changed files with 25 additions and 1 deletions

View File

@ -172,7 +172,7 @@ meta_renderer_real_rebuild_views (MetaRenderer *renderer)
}
}
static MetaRendererView *
MetaRendererView *
meta_renderer_get_view_for_crtc (MetaRenderer *renderer,
MetaCrtc *crtc)
{

View File

@ -62,6 +62,10 @@ void meta_renderer_add_view (MetaRenderer *renderer,
GList * meta_renderer_get_views_for_monitor (MetaRenderer *renderer,
MetaMonitor *monitor);
META_EXPORT_TEST
MetaRendererView * meta_renderer_get_view_for_crtc (MetaRenderer *renderer,
MetaCrtc *crtc);
META_EXPORT_TEST
GList * meta_renderer_get_views (MetaRenderer *renderer);

View File

@ -325,6 +325,7 @@ void
check_monitor_configuration (MonitorTestCaseExpect *expect)
{
MetaBackend *backend = meta_get_backend ();
MetaRenderer *renderer = meta_backend_get_renderer (backend);
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
MetaMonitorManagerTest *monitor_manager_test =
@ -544,6 +545,8 @@ check_monitor_configuration (MonitorTestCaseExpect *expect)
{
MetaCrtcMode *expected_current_mode;
const GList *l_output;
MetaRendererView *view;
cairo_rectangle_int_t view_layout;
for (l_output = meta_crtc_get_outputs (crtc);
l_output;
@ -572,6 +575,23 @@ check_monitor_configuration (MonitorTestCaseExpect *expect)
g_assert_cmpfloat_with_epsilon (crtc_config->layout.origin.y,
expect->crtcs[i].y,
FLT_EPSILON);
view = meta_renderer_get_view_for_crtc (renderer, crtc);
g_assert_nonnull (view);
clutter_stage_view_get_layout (CLUTTER_STAGE_VIEW (view),
&view_layout);
g_assert_cmpfloat_with_epsilon (crtc_config->layout.origin.x,
view_layout.x,
FLT_EPSILON);
g_assert_cmpfloat_with_epsilon (crtc_config->layout.origin.y,
view_layout.y,
FLT_EPSILON);
g_assert_cmpfloat_with_epsilon (crtc_config->layout.size.width,
view_layout.width,
FLT_EPSILON);
g_assert_cmpfloat_with_epsilon (crtc_config->layout.size.height,
view_layout.height,
FLT_EPSILON);
}
}
}