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:
parent
dd16fac0c7
commit
73da901cd3
@ -34,6 +34,7 @@ clutter_conform_tests_general_tests = [
|
|||||||
'interval',
|
'interval',
|
||||||
'script-parser',
|
'script-parser',
|
||||||
'timeline',
|
'timeline',
|
||||||
|
'timeline-interpolate',
|
||||||
'units',
|
'units',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <clutter/clutter.h>
|
#include <clutter/clutter.h>
|
||||||
|
|
||||||
#include "test-conform-common.h"
|
#include "tests/clutter-test-utils.h"
|
||||||
|
|
||||||
/* We ask for 1 frame per millisecond.
|
/* We ask for 1 frame per millisecond.
|
||||||
* Whenever this rate can't be achieved then the timeline
|
* Whenever this rate can't be achieved then the timeline
|
||||||
@ -12,8 +13,12 @@
|
|||||||
#define TEST_TIMELINE_DURATION 5000
|
#define TEST_TIMELINE_DURATION 5000
|
||||||
|
|
||||||
/* We are at the mercy of the system scheduler so this
|
/* We are at the mercy of the system scheduler so this
|
||||||
* may not be a very reliable tolerance. */
|
* may not be a very reliable tolerance.
|
||||||
#define TEST_ERROR_TOLERANCE 20
|
*
|
||||||
|
* 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
|
typedef struct _TestState
|
||||||
{
|
{
|
||||||
@ -118,19 +123,13 @@ completed_cb (ClutterTimeline *timeline,
|
|||||||
if (state->completion_count == 2)
|
if (state->completion_count == 2)
|
||||||
{
|
{
|
||||||
if (state->passed)
|
if (state->passed)
|
||||||
{
|
clutter_main_quit ();
|
||||||
g_test_message ("Passed\n");
|
|
||||||
clutter_main_quit ();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
g_assert_not_reached ();
|
||||||
g_test_message ("Failed\n");
|
|
||||||
exit (EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
timeline_interpolation (void)
|
timeline_interpolation (void)
|
||||||
{
|
{
|
||||||
TestState state;
|
TestState state;
|
||||||
@ -159,3 +158,7 @@ timeline_interpolation (void)
|
|||||||
|
|
||||||
g_object_unref (state.timeline);
|
g_object_unref (state.timeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CLUTTER_TEST_SUITE (
|
||||||
|
CLUTTER_TEST_UNIT ("/timeline/interpolate", timeline_interpolation)
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user