mirror of
https://github.com/brl/mutter.git
synced 2025-02-16 13:24:09 +00:00
tests/clutter/conform: Make sure to destroy created actors
We're moving towards not supporting stand-alone application style clutter stages, meaning the stage tests use will be reused instead of recreated. To make this feasable, tests must clean up after themself. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
This commit is contained in:
parent
06d5973851
commit
21e2f41a26
@ -74,6 +74,8 @@ actor_realized (void)
|
|||||||
|
|
||||||
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor)));
|
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor)));
|
||||||
g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (actor)));
|
g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (actor)));
|
||||||
|
|
||||||
|
clutter_actor_destroy (actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -115,6 +117,8 @@ actor_mapped (void)
|
|||||||
g_assert (CLUTTER_ACTOR_IS_REALIZED (actor));
|
g_assert (CLUTTER_ACTOR_IS_REALIZED (actor));
|
||||||
g_assert (!CLUTTER_ACTOR_IS_MAPPED (actor));
|
g_assert (!CLUTTER_ACTOR_IS_MAPPED (actor));
|
||||||
g_assert (!CLUTTER_ACTOR_IS_VISIBLE (actor));
|
g_assert (!CLUTTER_ACTOR_IS_VISIBLE (actor));
|
||||||
|
|
||||||
|
clutter_actor_destroy (actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -155,6 +159,9 @@ actor_visibility_not_recursive (void)
|
|||||||
|
|
||||||
clutter_actor_show (stage);
|
clutter_actor_show (stage);
|
||||||
g_assert (!CLUTTER_ACTOR_IS_VISIBLE (actor));
|
g_assert (!CLUTTER_ACTOR_IS_VISIBLE (actor));
|
||||||
|
|
||||||
|
clutter_actor_destroy (actor);
|
||||||
|
clutter_actor_destroy (group);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -190,6 +197,9 @@ actor_realize_not_recursive (void)
|
|||||||
g_assert (!CLUTTER_ACTOR_IS_REALIZED (actor));
|
g_assert (!CLUTTER_ACTOR_IS_REALIZED (actor));
|
||||||
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor)));
|
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor)));
|
||||||
g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (actor)));
|
g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (actor)));
|
||||||
|
|
||||||
|
clutter_actor_destroy (actor);
|
||||||
|
clutter_actor_destroy (group);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -235,6 +245,9 @@ actor_map_recursive (void)
|
|||||||
g_assert (CLUTTER_ACTOR_IS_MAPPED (actor));
|
g_assert (CLUTTER_ACTOR_IS_MAPPED (actor));
|
||||||
g_assert (CLUTTER_ACTOR_IS_VISIBLE (group));
|
g_assert (CLUTTER_ACTOR_IS_VISIBLE (group));
|
||||||
g_assert (CLUTTER_ACTOR_IS_VISIBLE (actor));
|
g_assert (CLUTTER_ACTOR_IS_VISIBLE (actor));
|
||||||
|
|
||||||
|
clutter_actor_destroy (actor);
|
||||||
|
clutter_actor_destroy (group);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -337,6 +350,7 @@ clone_no_map (void)
|
|||||||
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (group)));
|
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (group)));
|
||||||
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor)));
|
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor)));
|
||||||
|
|
||||||
|
clutter_actor_destroy (actor);
|
||||||
clutter_actor_destroy (CLUTTER_ACTOR (clone));
|
clutter_actor_destroy (CLUTTER_ACTOR (clone));
|
||||||
clutter_actor_destroy (CLUTTER_ACTOR (group));
|
clutter_actor_destroy (CLUTTER_ACTOR (group));
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,8 @@ actor_basic_layout (void)
|
|||||||
|
|
||||||
graphene_point_init (&p, 250, 50);
|
graphene_point_init (&p, 250, 50);
|
||||||
clutter_test_assert_actor_at_point (stage, &p, flower[2]);
|
clutter_test_assert_actor_at_point (stage, &p, flower[2]);
|
||||||
|
|
||||||
|
clutter_actor_destroy (vase);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -86,6 +88,8 @@ actor_margin_layout (void)
|
|||||||
|
|
||||||
graphene_point_init (&p, 212, 7);
|
graphene_point_init (&p, 212, 7);
|
||||||
clutter_test_assert_actor_at_point (stage, &p, flower[2]);
|
clutter_test_assert_actor_at_point (stage, &p, flower[2]);
|
||||||
|
|
||||||
|
clutter_actor_destroy (vase);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLUTTER_TEST_SUITE (
|
CLUTTER_TEST_SUITE (
|
||||||
|
@ -442,6 +442,9 @@ actor_offscreen_redirect (void)
|
|||||||
|
|
||||||
while (!data.was_painted)
|
while (!data.was_painted)
|
||||||
g_main_context_iteration (NULL, FALSE);
|
g_main_context_iteration (NULL, FALSE);
|
||||||
|
|
||||||
|
clutter_actor_destroy (data.parent_container);
|
||||||
|
clutter_actor_destroy (data.unrelated_actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLUTTER_TEST_SUITE (
|
CLUTTER_TEST_SUITE (
|
||||||
|
@ -37,6 +37,8 @@ opacity_label (void)
|
|||||||
g_print ("label 50%%.get_paint_opacity()/2\n");
|
g_print ("label 50%%.get_paint_opacity()/2\n");
|
||||||
clutter_actor_set_opacity (label, 128);
|
clutter_actor_set_opacity (label, 128);
|
||||||
g_assert (clutter_actor_get_paint_opacity (label) == 128);
|
g_assert (clutter_actor_get_paint_opacity (label) == 128);
|
||||||
|
|
||||||
|
clutter_actor_destroy (label);
|
||||||
}
|
}
|
||||||
|
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
@ -70,6 +72,8 @@ opacity_rectangle (void)
|
|||||||
if (!g_test_quiet ())
|
if (!g_test_quiet ())
|
||||||
g_print ("rect 100%%.get_paint_opacity()\n");
|
g_print ("rect 100%%.get_paint_opacity()\n");
|
||||||
g_assert (clutter_actor_get_paint_opacity (rect) == 255);
|
g_assert (clutter_actor_get_paint_opacity (rect) == 255);
|
||||||
|
|
||||||
|
clutter_actor_destroy (rect);
|
||||||
}
|
}
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
|
||||||
@ -135,6 +139,8 @@ opacity_paint (void)
|
|||||||
if (!g_test_quiet ())
|
if (!g_test_quiet ())
|
||||||
g_print ("rect 100%%.get_paint_opacity()\n");
|
g_print ("rect 100%%.get_paint_opacity()\n");
|
||||||
g_assert (clutter_actor_get_paint_opacity (rect) == 128);
|
g_assert (clutter_actor_get_paint_opacity (rect) == 128);
|
||||||
|
|
||||||
|
clutter_actor_destroy (group1);
|
||||||
}
|
}
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ struct _State
|
|||||||
guint failed_pass;
|
guint failed_pass;
|
||||||
guint failed_idx;
|
guint failed_idx;
|
||||||
gboolean pass;
|
gboolean pass;
|
||||||
|
GList *actor_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *test_passes[] = {
|
static const char *test_passes[] = {
|
||||||
@ -61,6 +62,7 @@ on_timeout (gpointer data)
|
|||||||
clutter_actor_set_background_color (over_actor, &red);
|
clutter_actor_set_background_color (over_actor, &red);
|
||||||
clutter_actor_set_size (over_actor, STAGE_WIDTH, STAGE_HEIGHT);
|
clutter_actor_set_size (over_actor, STAGE_WIDTH, STAGE_HEIGHT);
|
||||||
clutter_actor_add_child (state->stage, over_actor);
|
clutter_actor_add_child (state->stage, over_actor);
|
||||||
|
state->actor_list = g_list_prepend (state->actor_list, over_actor);
|
||||||
clutter_actor_hide (over_actor);
|
clutter_actor_hide (over_actor);
|
||||||
|
|
||||||
if (!g_test_quiet ())
|
if (!g_test_quiet ())
|
||||||
@ -172,7 +174,7 @@ static void
|
|||||||
actor_pick (void)
|
actor_pick (void)
|
||||||
{
|
{
|
||||||
int y, x;
|
int y, x;
|
||||||
State state;
|
State state = { 0 };
|
||||||
|
|
||||||
state.pass = TRUE;
|
state.pass = TRUE;
|
||||||
|
|
||||||
@ -188,6 +190,7 @@ actor_pick (void)
|
|||||||
y * 255 / (ACTORS_Y - 1),
|
y * 255 / (ACTORS_Y - 1),
|
||||||
128, 255 };
|
128, 255 };
|
||||||
ClutterActor *rect = clutter_actor_new ();
|
ClutterActor *rect = clutter_actor_new ();
|
||||||
|
state.actor_list = g_list_prepend (state.actor_list, rect);
|
||||||
|
|
||||||
clutter_actor_set_background_color (rect, &color);
|
clutter_actor_set_background_color (rect, &color);
|
||||||
clutter_actor_set_position (rect,
|
clutter_actor_set_position (rect,
|
||||||
@ -219,6 +222,8 @@ actor_pick (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_assert (state.pass);
|
g_assert (state.pass);
|
||||||
|
|
||||||
|
g_list_free_full (state.actor_list, (GDestroyNotify) clutter_actor_destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLUTTER_TEST_SUITE (
|
CLUTTER_TEST_SUITE (
|
||||||
|
@ -41,6 +41,9 @@ actor_pivot (void)
|
|||||||
clutter_actor_get_transform (actor_explicit, &result_explicit);
|
clutter_actor_get_transform (actor_explicit, &result_explicit);
|
||||||
|
|
||||||
g_assert (cogl_matrix_equal (&result_implicit, &result_explicit));
|
g_assert (cogl_matrix_equal (&result_implicit, &result_explicit));
|
||||||
|
|
||||||
|
clutter_actor_destroy (actor_implicit);
|
||||||
|
clutter_actor_destroy (actor_explicit);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLUTTER_TEST_SUITE (
|
CLUTTER_TEST_SUITE (
|
||||||
|
@ -256,6 +256,7 @@ actor_shader_effect (void)
|
|||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
ClutterActor *rect;
|
ClutterActor *rect;
|
||||||
gboolean was_painted;
|
gboolean was_painted;
|
||||||
|
GList *actors = NULL;
|
||||||
|
|
||||||
if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
|
if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
|
||||||
return;
|
return;
|
||||||
@ -264,18 +265,22 @@ actor_shader_effect (void)
|
|||||||
|
|
||||||
rect = make_actor (foo_old_shader_effect_get_type ());
|
rect = make_actor (foo_old_shader_effect_get_type ());
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
|
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
|
||||||
|
actors = g_list_prepend (actors, rect);
|
||||||
|
|
||||||
rect = make_actor (foo_new_shader_effect_get_type ());
|
rect = make_actor (foo_new_shader_effect_get_type ());
|
||||||
clutter_actor_set_x (rect, 100);
|
clutter_actor_set_x (rect, 100);
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
|
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
|
||||||
|
actors = g_list_prepend (actors, rect);
|
||||||
|
|
||||||
rect = make_actor (foo_another_new_shader_effect_get_type ());
|
rect = make_actor (foo_another_new_shader_effect_get_type ());
|
||||||
clutter_actor_set_x (rect, 200);
|
clutter_actor_set_x (rect, 200);
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
|
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
|
||||||
|
actors = g_list_prepend (actors, rect);
|
||||||
|
|
||||||
rect = make_actor (foo_new_shader_effect_get_type ());
|
rect = make_actor (foo_new_shader_effect_get_type ());
|
||||||
clutter_actor_set_x (rect, 300);
|
clutter_actor_set_x (rect, 300);
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
|
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
|
||||||
|
actors = g_list_prepend (actors, rect);
|
||||||
|
|
||||||
clutter_actor_show (stage);
|
clutter_actor_show (stage);
|
||||||
|
|
||||||
@ -286,6 +291,8 @@ actor_shader_effect (void)
|
|||||||
|
|
||||||
while (!was_painted)
|
while (!was_painted)
|
||||||
g_main_context_iteration (NULL, FALSE);
|
g_main_context_iteration (NULL, FALSE);
|
||||||
|
|
||||||
|
g_list_free_full (actors, (GDestroyNotify) clutter_actor_destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLUTTER_TEST_SUITE (
|
CLUTTER_TEST_SUITE (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user