mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
Remove useless manual timeline ticking
The master clock now works fine whether or not there are any stages, so in the timeline conformance tests don't need to set up their own times. Set CLUTTER_VBLANK=none for the conformance tests, which in addition to removing an test-environment dependency, will result in the ticking for timeline tests being throttled to the default frame rate. http://bugzilla.openedhand.com/show_bug.cgi?id=1637 Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
parent
6705ce6c6a
commit
287d4f76ec
@ -72,6 +72,13 @@ main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Turning of sync-to-vblank removes a dependency on the specifics of the
|
||||||
|
* test environment. It also means that the timeline-only tests are
|
||||||
|
* throttled to a reasonable frame rate rather than running in tight
|
||||||
|
* infinite loop.
|
||||||
|
*/
|
||||||
|
g_setenv ("CLUTTER_VBLANK", "none", FALSE);
|
||||||
|
|
||||||
g_test_init (&argc, &argv, NULL);
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
g_test_bug_base ("http://bugzilla.openedhand.com/show_bug.cgi?id=%s");
|
g_test_bug_base ("http://bugzilla.openedhand.com/show_bug.cgi?id=%s");
|
||||||
|
@ -23,7 +23,6 @@ typedef struct _TestState
|
|||||||
gint expected_frame;
|
gint expected_frame;
|
||||||
gint completion_count;
|
gint completion_count;
|
||||||
gboolean passed;
|
gboolean passed;
|
||||||
guint source_id;
|
|
||||||
} TestState;
|
} TestState;
|
||||||
|
|
||||||
|
|
||||||
@ -132,20 +131,6 @@ completed_cb (ClutterTimeline *timeline,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
frame_tick (gpointer data)
|
|
||||||
{
|
|
||||||
TestState *state = data;
|
|
||||||
GTimeVal cur_tick = { 0, };
|
|
||||||
|
|
||||||
g_get_current_time (&cur_tick);
|
|
||||||
|
|
||||||
if (clutter_timeline_is_playing (state->timeline))
|
|
||||||
clutter_timeline_do_tick (state->timeline, &cur_tick);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
test_timeline_interpolate (TestConformSimpleFixture *fixture,
|
test_timeline_interpolate (TestConformSimpleFixture *fixture,
|
||||||
gconstpointer data)
|
gconstpointer data)
|
||||||
@ -169,14 +154,10 @@ test_timeline_interpolate (TestConformSimpleFixture *fixture,
|
|||||||
state.passed = TRUE;
|
state.passed = TRUE;
|
||||||
state.expected_frame = 0;
|
state.expected_frame = 0;
|
||||||
|
|
||||||
state.source_id =
|
|
||||||
clutter_threads_add_frame_source (60, frame_tick, &state);
|
|
||||||
|
|
||||||
g_get_current_time (&state.start_time);
|
g_get_current_time (&state.start_time);
|
||||||
clutter_timeline_start (state.timeline);
|
clutter_timeline_start (state.timeline);
|
||||||
|
|
||||||
clutter_main();
|
clutter_main();
|
||||||
|
|
||||||
g_source_remove (state.source_id);
|
|
||||||
g_object_unref (state.timeline);
|
g_object_unref (state.timeline);
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ typedef struct _TestState
|
|||||||
{
|
{
|
||||||
ClutterTimeline *timeline;
|
ClutterTimeline *timeline;
|
||||||
gint rewind_count;
|
gint rewind_count;
|
||||||
guint source_id;
|
|
||||||
} TestState;
|
} TestState;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -67,20 +66,6 @@ new_frame_cb (ClutterTimeline *timeline,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
frame_tick (gpointer data)
|
|
||||||
{
|
|
||||||
TestState *state = data;
|
|
||||||
GTimeVal cur_tick = { 0, };
|
|
||||||
|
|
||||||
g_get_current_time (&cur_tick);
|
|
||||||
|
|
||||||
if (clutter_timeline_is_playing (state->timeline))
|
|
||||||
clutter_timeline_do_tick (state->timeline, &cur_tick);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
test_timeline_rewind (TestConformSimpleFixture *fixture,
|
test_timeline_rewind (TestConformSimpleFixture *fixture,
|
||||||
gconstpointer data)
|
gconstpointer data)
|
||||||
@ -100,13 +85,9 @@ test_timeline_rewind (TestConformSimpleFixture *fixture,
|
|||||||
&state);
|
&state);
|
||||||
state.rewind_count = 0;
|
state.rewind_count = 0;
|
||||||
|
|
||||||
state.source_id =
|
|
||||||
clutter_threads_add_frame_source (60, frame_tick, &state);
|
|
||||||
|
|
||||||
clutter_timeline_start (state.timeline);
|
clutter_timeline_start (state.timeline);
|
||||||
|
|
||||||
clutter_main();
|
clutter_main();
|
||||||
|
|
||||||
g_source_remove (state.source_id);
|
|
||||||
g_object_unref (state.timeline);
|
g_object_unref (state.timeline);
|
||||||
}
|
}
|
||||||
|
@ -181,38 +181,10 @@ delay_cb (gpointer data)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct _FrameCounter FrameCounter;
|
|
||||||
|
|
||||||
struct _FrameCounter
|
|
||||||
{
|
|
||||||
GSList *timelines;
|
|
||||||
};
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
frame_tick (gpointer data)
|
|
||||||
{
|
|
||||||
FrameCounter *counter = data;
|
|
||||||
GTimeVal cur_tick = { 0, };
|
|
||||||
GSList *l;
|
|
||||||
|
|
||||||
g_get_current_time (&cur_tick);
|
|
||||||
|
|
||||||
for (l = counter->timelines; l != NULL; l = l->next)
|
|
||||||
{
|
|
||||||
ClutterTimeline *timeline = l->data;
|
|
||||||
|
|
||||||
if (clutter_timeline_is_playing (timeline))
|
|
||||||
clutter_timeline_do_tick (timeline, &cur_tick);
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
test_timeline (TestConformSimpleFixture *fixture,
|
test_timeline (TestConformSimpleFixture *fixture,
|
||||||
gconstpointer data)
|
gconstpointer data)
|
||||||
{
|
{
|
||||||
FrameCounter *counter;
|
|
||||||
ClutterTimeline *timeline_1;
|
ClutterTimeline *timeline_1;
|
||||||
TimelineData data_1;
|
TimelineData data_1;
|
||||||
ClutterTimeline *timeline_2;
|
ClutterTimeline *timeline_2;
|
||||||
@ -222,11 +194,6 @@ test_timeline (TestConformSimpleFixture *fixture,
|
|||||||
gchar **markers;
|
gchar **markers;
|
||||||
gsize n_markers;
|
gsize n_markers;
|
||||||
guint delay_tag;
|
guint delay_tag;
|
||||||
guint source_id;
|
|
||||||
|
|
||||||
counter = g_new0 (FrameCounter, 1);
|
|
||||||
|
|
||||||
source_id = clutter_threads_add_frame_source (FPS, frame_tick, counter);
|
|
||||||
|
|
||||||
timeline_data_init (&data_1, 1);
|
timeline_data_init (&data_1, 1);
|
||||||
timeline_1 = clutter_timeline_new (FRAME_COUNT * 1000 / FPS);
|
timeline_1 = clutter_timeline_new (FRAME_COUNT * 1000 / FPS);
|
||||||
@ -243,8 +210,6 @@ test_timeline (TestConformSimpleFixture *fixture,
|
|||||||
g_assert (n_markers == 3);
|
g_assert (n_markers == 3);
|
||||||
g_strfreev (markers);
|
g_strfreev (markers);
|
||||||
|
|
||||||
counter->timelines = g_slist_prepend (counter->timelines, timeline_1);
|
|
||||||
|
|
||||||
timeline_data_init (&data_2, 2);
|
timeline_data_init (&data_2, 2);
|
||||||
timeline_2 = clutter_timeline_clone (timeline_1);
|
timeline_2 = clutter_timeline_clone (timeline_1);
|
||||||
clutter_timeline_add_marker_at_time (timeline_2, "bar", 2 * 1000 / FPS);
|
clutter_timeline_add_marker_at_time (timeline_2, "bar", 2 * 1000 / FPS);
|
||||||
@ -254,8 +219,6 @@ test_timeline (TestConformSimpleFixture *fixture,
|
|||||||
g_assert (strcmp (markers[0], "bar") == 0);
|
g_assert (strcmp (markers[0], "bar") == 0);
|
||||||
g_strfreev (markers);
|
g_strfreev (markers);
|
||||||
|
|
||||||
counter->timelines = g_slist_prepend (counter->timelines, timeline_2);
|
|
||||||
|
|
||||||
timeline_data_init (&data_3, 3);
|
timeline_data_init (&data_3, 3);
|
||||||
timeline_3 = clutter_timeline_clone (timeline_1);
|
timeline_3 = clutter_timeline_clone (timeline_1);
|
||||||
clutter_timeline_set_direction (timeline_3, CLUTTER_TIMELINE_BACKWARD);
|
clutter_timeline_set_direction (timeline_3, CLUTTER_TIMELINE_BACKWARD);
|
||||||
@ -266,8 +229,6 @@ test_timeline (TestConformSimpleFixture *fixture,
|
|||||||
clutter_timeline_add_marker_at_time (timeline_3, "end-marker",
|
clutter_timeline_add_marker_at_time (timeline_3, "end-marker",
|
||||||
0 * 1000 / FPS);
|
0 * 1000 / FPS);
|
||||||
|
|
||||||
counter->timelines = g_slist_prepend (counter->timelines, timeline_3);
|
|
||||||
|
|
||||||
g_signal_connect (timeline_1,
|
g_signal_connect (timeline_1,
|
||||||
"marker-reached", G_CALLBACK (timeline_marker_reached_cb),
|
"marker-reached", G_CALLBACK (timeline_marker_reached_cb),
|
||||||
&data_1);
|
&data_1);
|
||||||
@ -346,9 +307,4 @@ test_timeline (TestConformSimpleFixture *fixture,
|
|||||||
timeline_data_destroy (&data_3);
|
timeline_data_destroy (&data_3);
|
||||||
|
|
||||||
g_source_remove (delay_tag);
|
g_source_remove (delay_tag);
|
||||||
|
|
||||||
g_source_remove (source_id);
|
|
||||||
|
|
||||||
g_slist_free (counter->timelines);
|
|
||||||
g_free (counter);
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user