From 73da901cd3d6b1f421f92948c4b8955b0b02410d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 25 Mar 2020 16:31:41 +0100 Subject: [PATCH] tests/clutter: Port timeline-interpolate to current test suite The error tolerance is increased dramatically to make the test less flaky when running in CI. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1289 --- src/tests/clutter/conform/meson.build | 1 + .../clutter/conform/timeline-interpolate.c | 27 ++++++++++--------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/tests/clutter/conform/meson.build b/src/tests/clutter/conform/meson.build index 82ce922f7..fbaa46bd3 100644 --- a/src/tests/clutter/conform/meson.build +++ b/src/tests/clutter/conform/meson.build @@ -34,6 +34,7 @@ clutter_conform_tests_general_tests = [ 'interval', 'script-parser', 'timeline', + 'timeline-interpolate', 'units', ] diff --git a/src/tests/clutter/conform/timeline-interpolate.c b/src/tests/clutter/conform/timeline-interpolate.c index 3988c038d..e60f72b2e 100644 --- a/src/tests/clutter/conform/timeline-interpolate.c +++ b/src/tests/clutter/conform/timeline-interpolate.c @@ -1,8 +1,9 @@ +#define CLUTTER_DISABLE_DEPRECATION_WARNINGS #include #include #include -#include "test-conform-common.h" +#include "tests/clutter-test-utils.h" /* We ask for 1 frame per millisecond. * Whenever this rate can't be achieved then the timeline @@ -12,8 +13,12 @@ #define TEST_TIMELINE_DURATION 5000 /* We are at the mercy of the system scheduler so this - * may not be a very reliable tolerance. */ -#define TEST_ERROR_TOLERANCE 20 + * may not be a very reliable tolerance. + * + * It's set as very tolerable as otherwise CI, which are + * very prone to not get CPU time scheduled, tend to often fail. + */ +#define TEST_ERROR_TOLERANCE 150 typedef struct _TestState { @@ -118,19 +123,13 @@ completed_cb (ClutterTimeline *timeline, if (state->completion_count == 2) { if (state->passed) - { - g_test_message ("Passed\n"); - clutter_main_quit (); - } + clutter_main_quit (); else - { - g_test_message ("Failed\n"); - exit (EXIT_FAILURE); - } + g_assert_not_reached (); } } -void +static void timeline_interpolation (void) { TestState state; @@ -159,3 +158,7 @@ timeline_interpolation (void) g_object_unref (state.timeline); } + +CLUTTER_TEST_SUITE ( + CLUTTER_TEST_UNIT ("/timeline/interpolate", timeline_interpolation) +)