clutter/tests: Stop using deprecated BoxLayout API

... so that we can remove it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1265
This commit is contained in:
Florian Müllner 2020-05-21 06:17:10 +02:00
parent e50e14af82
commit c14ba5937f
2 changed files with 25 additions and 31 deletions

View File

@ -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);

View File

@ -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),
"<b>Red</b>: 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 ("<b>Red</b>: vertical swipes only"));
label = clutter_text_new ();
clutter_text_set_markup (CLUTTER_TEXT (label),
"<b>Blue</b>: 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 ("<b>Blue</b>: horizontal swipes only"));
label = clutter_text_new ();
clutter_text_set_markup (CLUTTER_TEXT (label),
"<b>Green</b>: 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 ("<b>Green</b>: both"));
offset = clutter_actor_get_height (stage)
- clutter_actor_get_height (box)