From c14ba5937f28a6095af63ce855c24ca3b53e60f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 21 May 2020 06:17:10 +0200 Subject: [PATCH] clutter/tests: Stop using deprecated BoxLayout API ... so that we can remove it. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1265 --- src/tests/clutter/conform/script-parser.c | 2 +- .../clutter/interactive/test-swipe-action.c | 54 +++++++++---------- 2 files changed, 25 insertions(+), 31 deletions(-) diff --git a/src/tests/clutter/conform/script-parser.c b/src/tests/clutter/conform/script-parser.c index 7a7e6a8b6..8dae8f7f6 100644 --- a/src/tests/clutter/conform/script-parser.c +++ b/src/tests/clutter/conform/script-parser.c @@ -245,7 +245,7 @@ script_named_object (void) manager = clutter_box_get_layout_manager (CLUTTER_BOX (actor)); g_assert (CLUTTER_IS_BOX_LAYOUT (manager)); - g_assert (clutter_box_layout_get_vertical (CLUTTER_BOX_LAYOUT (manager))); + g_assert (clutter_box_layout_get_orientation (CLUTTER_BOX_LAYOUT (manager)) == CLUTTER_ORIENTATION_VERTICAL); g_object_unref (script); g_free (test_file); diff --git a/src/tests/clutter/interactive/test-swipe-action.c b/src/tests/clutter/interactive/test-swipe-action.c index 3d0877401..68ccb36b4 100644 --- a/src/tests/clutter/interactive/test-swipe-action.c +++ b/src/tests/clutter/interactive/test-swipe-action.c @@ -97,6 +97,19 @@ attach_action (ClutterActor *actor, guint axis) g_signal_connect (action, "gesture-cancel", G_CALLBACK (gesture_cancel_cb), NULL); } +static ClutterActor * +create_label (const char *markup) +{ + return CLUTTER_ACTOR (g_object_new (CLUTTER_TYPE_TEXT, + "text", markup, + "use-markup", TRUE, + "x-expand", TRUE, + "y-expand", TRUE, + "x-align", CLUTTER_ACTOR_ALIGN_START, + "y-align", CLUTTER_ACTOR_ALIGN_CENTER, + NULL)); +} + G_MODULE_EXPORT int test_swipe_action_main (int argc, char *argv[]) { @@ -136,43 +149,24 @@ test_swipe_action_main (int argc, char *argv[]) { ClutterLayoutManager *layout = clutter_box_layout_new (); - ClutterActor *box, *label; + ClutterActor *box; float offset; - clutter_box_layout_set_vertical (CLUTTER_BOX_LAYOUT (layout), TRUE); + clutter_box_layout_set_orientation (CLUTTER_BOX_LAYOUT (layout), + CLUTTER_ORIENTATION_VERTICAL); clutter_box_layout_set_spacing (CLUTTER_BOX_LAYOUT (layout), 6); - box = clutter_box_new (layout); + box = clutter_actor_new (); + clutter_actor_set_layout_manager (box, layout); - label = clutter_text_new (); - clutter_text_set_markup (CLUTTER_TEXT (label), - "Red: vertical swipes only"); - clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (layout), - label, - TRUE, - TRUE, TRUE, - CLUTTER_BOX_ALIGNMENT_START, - CLUTTER_BOX_ALIGNMENT_CENTER); + clutter_actor_add_child (box, + create_label ("Red: vertical swipes only")); - label = clutter_text_new (); - clutter_text_set_markup (CLUTTER_TEXT (label), - "Blue: horizontal swipes only"); - clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (layout), - label, - TRUE, - TRUE, TRUE, - CLUTTER_BOX_ALIGNMENT_START, - CLUTTER_BOX_ALIGNMENT_CENTER); + clutter_actor_add_child (box, + create_label ("Blue: horizontal swipes only")); - label = clutter_text_new (); - clutter_text_set_markup (CLUTTER_TEXT (label), - "Green: both"); - clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (layout), - label, - TRUE, - TRUE, TRUE, - CLUTTER_BOX_ALIGNMENT_START, - CLUTTER_BOX_ALIGNMENT_CENTER); + clutter_actor_add_child (box, + create_label ("Green: both")); offset = clutter_actor_get_height (stage) - clutter_actor_get_height (box)