tests/monitor/default-scale: Use a large epsilon

To have the test case say e.g. 1.75 while the effective scale is
1.74863386, use an epsilon of 0.2.

Fixes: a6217c720e4f ("tests: Add tests for monitor_calculate_mode_scale")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2880>
This commit is contained in:
Jonas Ådahl 2023-03-02 11:01:08 +01:00 committed by Marge Bot
parent f3f9200f9a
commit 98c9db98e3

View File

@ -9324,6 +9324,11 @@ meta_test_monitor_calculate_mode_scale (void)
},
};
static const int n_cases = 1;
/* Set a rather high scale epsilon, to have "easy" scales as the
* expectations, while ignoring that the actual scaling factors are slightly
* different, e.g. 1.74863386 instead of 1.75.
*/
const float scale_epsilon = 0.2;
MetaMonitorManager *manager;
MetaMonitorManagerTest *manager_test;
@ -9367,7 +9372,7 @@ meta_test_monitor_calculate_mode_scale (void)
emulate_hotplug (test_setup);
logical_monitor = manager->logical_monitors->data;
g_assert_cmpfloat_with_epsilon (logical_monitor->scale, cases[i].exp,
FLT_EPSILON);
scale_epsilon);
}
}