From dec97a65410c92b2048c6ca782655abeb49d2a8c Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Sat, 9 May 2020 02:12:30 +0200 Subject: [PATCH] tests/monitor-transform: Also test invert() Commit e06daa58c335b7 changed the tested values to use corresponding valid enum values instead of negative ones. Unfortunately that made one value become a duplicate of an existing one and also in part defeated the original intention of checking the implementation of `meta_output_crtc_to_logical_transform`. Use `meta_monitor_transform_invert` to fix both shortcomings. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1242 --- src/backends/meta-monitor-transform.h | 1 + src/tests/monitor-transform-tests.c | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/backends/meta-monitor-transform.h b/src/backends/meta-monitor-transform.h index e5757e869..c49e29e81 100644 --- a/src/backends/meta-monitor-transform.h +++ b/src/backends/meta-monitor-transform.h @@ -52,6 +52,7 @@ meta_monitor_transform_is_flipped (MetaMonitorTransform transform) return (transform >= META_MONITOR_TRANSFORM_FLIPPED); } +META_EXPORT_TEST MetaMonitorTransform meta_monitor_transform_invert (MetaMonitorTransform transform); META_EXPORT_TEST diff --git a/src/tests/monitor-transform-tests.c b/src/tests/monitor-transform-tests.c index fb505d00c..871a06b10 100644 --- a/src/tests/monitor-transform-tests.c +++ b/src/tests/monitor-transform-tests.c @@ -62,22 +62,23 @@ test_transform (void) }, { .transform = META_MONITOR_TRANSFORM_NORMAL, - .other = META_MONITOR_TRANSFORM_270, + .other = meta_monitor_transform_invert (META_MONITOR_TRANSFORM_90), .expect = META_MONITOR_TRANSFORM_270, }, { .transform = META_MONITOR_TRANSFORM_FLIPPED, - .other = META_MONITOR_TRANSFORM_270, + .other = meta_monitor_transform_invert (META_MONITOR_TRANSFORM_90), .expect = META_MONITOR_TRANSFORM_FLIPPED_270, }, { .transform = META_MONITOR_TRANSFORM_FLIPPED_180, - .other = META_MONITOR_TRANSFORM_90, + .other = meta_monitor_transform_invert (META_MONITOR_TRANSFORM_270), .expect = META_MONITOR_TRANSFORM_FLIPPED_270, }, { .transform = META_MONITOR_TRANSFORM_FLIPPED_180, - .other = META_MONITOR_TRANSFORM_FLIPPED_180, + .other = + meta_monitor_transform_invert (META_MONITOR_TRANSFORM_FLIPPED_180), .expect = META_MONITOR_TRANSFORM_NORMAL, }, };