mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05:00
tests/conform: Use the clutter stage from mutter
The tests created their own stage, which caused various issues. Lets use the one from mutter instead. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1289
This commit is contained in:
parent
01609de587
commit
007d27fa40
@ -5,8 +5,6 @@
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
typedef struct {
|
||||
ClutterActor *stage;
|
||||
|
||||
guint no_display : 1;
|
||||
} ClutterTestEnvironment;
|
||||
|
||||
@ -98,18 +96,9 @@ out:
|
||||
ClutterActor *
|
||||
clutter_test_get_stage (void)
|
||||
{
|
||||
g_assert (test_environ != NULL);
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
|
||||
if (test_environ->stage == NULL)
|
||||
{
|
||||
/* create a stage, and ensure that it goes away at the end */
|
||||
test_environ->stage = clutter_stage_new ();
|
||||
clutter_actor_set_name (test_environ->stage, "Test Stage");
|
||||
g_object_add_weak_pointer (G_OBJECT (test_environ->stage),
|
||||
(gpointer *) &test_environ->stage);
|
||||
}
|
||||
|
||||
return test_environ->stage;
|
||||
return meta_backend_get_stage (backend);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
@ -122,11 +111,13 @@ static void
|
||||
clutter_test_func_wrapper (gconstpointer data_)
|
||||
{
|
||||
const ClutterTestData *data = data_;
|
||||
ClutterActor *stage;
|
||||
|
||||
g_test_log_set_fatal_handler (log_func, NULL);
|
||||
|
||||
/* ensure that the previous test state has been cleaned up */
|
||||
g_assert_null (test_environ->stage);
|
||||
stage = clutter_test_get_stage ();
|
||||
g_assert_false (clutter_actor_is_mapped (stage));
|
||||
|
||||
if (test_environ->no_display)
|
||||
{
|
||||
@ -151,11 +142,8 @@ out:
|
||||
if (data->test_notify != NULL)
|
||||
data->test_notify (data->test_data);
|
||||
|
||||
if (test_environ->stage != NULL)
|
||||
{
|
||||
clutter_actor_destroy (test_environ->stage);
|
||||
g_assert_null (test_environ->stage);
|
||||
}
|
||||
clutter_actor_remove_all_children (stage);
|
||||
clutter_actor_hide (stage);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -260,7 +260,7 @@ actor_shader_effect (void)
|
||||
if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
|
||||
return;
|
||||
|
||||
stage = clutter_stage_new ();
|
||||
stage = clutter_test_get_stage ();
|
||||
|
||||
rect = make_actor (foo_old_shader_effect_get_type ());
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
|
||||
|
@ -132,8 +132,11 @@ completed_cb (ClutterTimeline *timeline,
|
||||
static void
|
||||
timeline_interpolation (void)
|
||||
{
|
||||
ClutterActor *stage;
|
||||
TestState state;
|
||||
|
||||
stage = clutter_test_get_stage ();
|
||||
|
||||
state.timeline =
|
||||
clutter_timeline_new (TEST_TIMELINE_DURATION);
|
||||
clutter_timeline_set_repeat_count (state.timeline, -1);
|
||||
@ -151,6 +154,8 @@ timeline_interpolation (void)
|
||||
state.passed = TRUE;
|
||||
state.expected_frame = 0;
|
||||
|
||||
clutter_actor_show (stage);
|
||||
|
||||
state.start_time = g_get_real_time ();
|
||||
clutter_timeline_start (state.timeline);
|
||||
|
||||
|
@ -70,8 +70,11 @@ new_frame_cb (ClutterTimeline *timeline,
|
||||
static void
|
||||
timeline_rewind (void)
|
||||
{
|
||||
ClutterActor *stage;
|
||||
TestState state;
|
||||
|
||||
stage = clutter_test_get_stage ();
|
||||
|
||||
state.timeline =
|
||||
clutter_timeline_new (TEST_TIMELINE_DURATION);
|
||||
g_signal_connect (G_OBJECT(state.timeline),
|
||||
@ -85,6 +88,8 @@ timeline_rewind (void)
|
||||
&state);
|
||||
state.rewind_count = 0;
|
||||
|
||||
clutter_actor_show (stage);
|
||||
|
||||
clutter_timeline_start (state.timeline);
|
||||
|
||||
clutter_main();
|
||||
|
@ -184,6 +184,7 @@ delay_cb (gpointer data)
|
||||
static void
|
||||
timeline_base (void)
|
||||
{
|
||||
ClutterActor *stage;
|
||||
ClutterTimeline *timeline_1;
|
||||
TimelineData data_1;
|
||||
ClutterTimeline *timeline_2;
|
||||
@ -194,6 +195,8 @@ timeline_base (void)
|
||||
gsize n_markers;
|
||||
guint delay_tag;
|
||||
|
||||
stage = clutter_test_get_stage ();
|
||||
|
||||
timeline_data_init (&data_1, 1);
|
||||
timeline_1 = clutter_timeline_new (FRAME_COUNT * 1000 / FPS);
|
||||
clutter_timeline_add_marker_at_time (timeline_1, "start-marker",
|
||||
@ -263,6 +266,8 @@ timeline_base (void)
|
||||
"completed", G_CALLBACK (timeline_complete_cb),
|
||||
&data_3);
|
||||
|
||||
clutter_actor_show (stage);
|
||||
|
||||
if (!g_test_quiet ())
|
||||
g_print ("Without delay...\n");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user