[mutter] clutter/tests/conform: Fix actor-offscreen-redirect
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter/tests/conform: Fix actor-offscreen-redirect
- Date: Wed, 20 Jul 2016 06:26:17 +0000 (UTC)
commit 9c0fa583f526f711cda196f5a287f7fe5438297a
Author: Jonas Ådahl <jadahl gmail com>
Date: Thu May 26 22:44:49 2016 +0800
clutter/tests/conform: Fix actor-offscreen-redirect
The actor-offscreen-redirect didn't initialize its state properly, so
it could potentially end up with the "was_painted" state being TRUE
from the start, effectively skipping the whole test.
Fixing so that the test even run resulted in the test getting stuck in
a dead lock due to the verification that a frame was drawn was done
from a paint callback. A paint callback had the mutex held, so when the
test case tried to run the main loop, the next paint callback caller
path taken would try to re-lock the same mutex, thus dead lock.
https://bugzilla.gnome.org/show_bug.cgi?id=768976
clutter/tests/conform/actor-offscreen-redirect.c | 49 +++++++++++++--------
1 files changed, 30 insertions(+), 19 deletions(-)
---
diff --git a/clutter/tests/conform/actor-offscreen-redirect.c
b/clutter/tests/conform/actor-offscreen-redirect.c
index f47af36..63d5e6c 100644
--- a/clutter/tests/conform/actor-offscreen-redirect.c
+++ b/clutter/tests/conform/actor-offscreen-redirect.c
@@ -177,6 +177,33 @@ verify_redraw (Data *data, int expected_paint_count)
}
static gboolean
+verify_redraws (gpointer user_data)
+{
+ Data *data = user_data;
+
+ /* Queueing a redraw on the actor should cause a redraw */
+ clutter_actor_queue_redraw (data->container);
+ verify_redraw (data, 1);
+
+ /* Queueing a redraw on a child should cause a redraw */
+ clutter_actor_queue_redraw (data->child);
+ verify_redraw (data, 1);
+
+ /* Modifying the transformation on the parent should cause a
+ redraw */
+ clutter_actor_set_anchor_point (data->parent_container, 0, 1);
+ verify_redraw (data, 1);
+
+ /* Redrawing an unrelated actor shouldn't cause a redraw */
+ clutter_actor_set_position (data->unrelated_actor, 0, 1);
+ verify_redraw (data, 0);
+
+ data->was_painted = TRUE;
+
+ return G_SOURCE_REMOVE;
+}
+
+static gboolean
run_verify (gpointer user_data)
{
Data *data = user_data;
@@ -273,24 +300,8 @@ run_verify (gpointer user_data)
0,
255);
- /* Queueing a redraw on the actor should cause a redraw */
- clutter_actor_queue_redraw (data->container);
- verify_redraw (data, 1);
-
- /* Queueing a redraw on a child should cause a redraw */
- clutter_actor_queue_redraw (data->child);
- verify_redraw (data, 1);
-
- /* Modifying the transformation on the parent should cause a
- redraw */
- clutter_actor_set_anchor_point (data->parent_container, 0, 1);
- verify_redraw (data, 1);
-
- /* Redrawing an unrelated actor shouldn't cause a redraw */
- clutter_actor_set_position (data->unrelated_actor, 0, 1);
- verify_redraw (data, 0);
-
- data->was_painted = TRUE;
+ /* Check redraws */
+ g_idle_add (verify_redraws, data);
return G_SOURCE_REMOVE;
}
@@ -298,7 +309,7 @@ run_verify (gpointer user_data)
static void
actor_offscreen_redirect (void)
{
- Data data;
+ Data data = { 0 };
if (!cogl_features_available (COGL_FEATURE_OFFSCREEN))
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]