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
This commit is contained in:
Jonas Ådahl 2020-03-25 16:31:41 +01:00 committed by Georges Basile Stavracas Neto
parent dd16fac0c7
commit 73da901cd3
2 changed files with 16 additions and 12 deletions

View File

@ -34,6 +34,7 @@ clutter_conform_tests_general_tests = [
'interval',
'script-parser',
'timeline',
'timeline-interpolate',
'units',
]

View File

@ -1,8 +1,9 @@
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include <stdlib.h>
#include <glib.h>
#include <clutter/clutter.h>
#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 ();
}
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)
)