[mutter/gbsneto/clutter-cleanups-part1: 13/19] tests: Replace ClutterRectangle with ClutterActor
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/clutter-cleanups-part1: 13/19] tests: Replace ClutterRectangle with ClutterActor
- Date: Fri, 26 Jun 2020 22:38:50 +0000 (UTC)
commit e896d14afa10542843ffb6e63da0827ff42b8c29
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Jun 26 17:51:48 2020 -0300
tests: Replace ClutterRectangle with ClutterActor
These tests were written (and copy-pasted) before ClutterActor
had an actual background-color property. As a preparation to
the removal of ClutterRectangle, replace all these rectangles
with plain actors and background colors.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1332
.../clutter/accessibility/cally-atkcomponent-example.c | 12 ++++++++----
.../accessibility/cally-atkeditabletext-example.c | 3 ++-
.../clutter/accessibility/cally-atkevents-example.c | 3 ++-
.../clutter/accessibility/cally-atktext-example.c | 3 ++-
src/tests/clutter/accessibility/cally-clone-example.c | 3 ++-
src/tests/clutter/conform/actor-destroy.c | 4 ++--
src/tests/clutter/conform/actor-paint-opacity.c | 14 ++++++++------
src/tests/clutter/conform/actor-pick.c | 6 ++++--
src/tests/clutter/conform/actor-shader-effect.c | 4 ++--
src/tests/clutter/conform/script-parser.c | 8 ++++----
.../clutter/conform/scripts/test-script-child.json | 8 ++++----
.../clutter/conform/scripts/test-script-model.json | 6 +++---
.../conform/scripts/test-script-named-object.json | 2 +-
.../conform/scripts/test-script-object-property.json | 2 +-
.../clutter/conform/scripts/test-script-single.json | 4 ++--
src/tests/clutter/conform/texture-fbo.c | 8 ++++----
src/tests/clutter/interactive/test-events.c | 18 ++++++++++++------
src/tests/clutter/interactive/test-grab.c | 15 ++++++++++-----
src/tests/clutter/interactive/test-path-constraint.c | 4 ++--
src/tests/clutter/interactive/test-script.c | 4 ++--
src/tests/clutter/interactive/test-script.json | 8 ++++----
src/tests/clutter/interactive/test-shader-effects.c | 3 ++-
src/tests/clutter/interactive/test-swipe-action.c | 9 ++++++---
src/tests/clutter/interactive/test-touch-events.c | 6 ++++--
src/tests/clutter/micro-bench/test-picking.c | 3 ++-
src/tests/clutter/performance/test-picking.c | 3 ++-
26 files changed, 97 insertions(+), 66 deletions(-)
---
diff --git a/src/tests/clutter/accessibility/cally-atkcomponent-example.c
b/src/tests/clutter/accessibility/cally-atkcomponent-example.c
index d27c5a8844..20401294b5 100644
--- a/src/tests/clutter/accessibility/cally-atkcomponent-example.c
+++ b/src/tests/clutter/accessibility/cally-atkcomponent-example.c
@@ -53,21 +53,25 @@ main (int argc, char *argv[])
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
- button1 = clutter_rectangle_new_with_color (CLUTTER_COLOR_Yellow);
+ button1 = clutter_actor_new ();
+ clutter_actor_set_background_color (button1, CLUTTER_COLOR_Yellow);
clutter_actor_set_size (button1, SIZE, SIZE);
- button2 = clutter_rectangle_new_with_color (CLUTTER_COLOR_Green);
+ button2 = clutter_actor_new ();
+ clutter_actor_set_background_color (button2, CLUTTER_COLOR_Green);
clutter_actor_set_position (button2, 2 * SIZE, 0);
clutter_actor_set_size (button2, SIZE, SIZE);
- button3 = clutter_rectangle_new_with_color (CLUTTER_COLOR_Blue);
+ button3 = clutter_actor_new ();
+ clutter_actor_set_background_color (button3, CLUTTER_COLOR_Blue);
clutter_actor_set_position (button3, 0, 2 * SIZE);
clutter_actor_set_size (button3, SIZE, SIZE);
clutter_actor_set_z_position (button3, DEPTH);
/* a nested hierarchy, to check that the relative positions are
computed properly */
- button4 = clutter_rectangle_new_with_color (CLUTTER_COLOR_Magenta);
+ button4 = clutter_actor_new ();
+ clutter_actor_set_background_color (button4, CLUTTER_COLOR_Magenta);
clutter_actor_set_position (button4, SIZE / 2, SIZE / 2);
clutter_actor_set_size (button4, SIZE, SIZE);
diff --git a/src/tests/clutter/accessibility/cally-atkeditabletext-example.c
b/src/tests/clutter/accessibility/cally-atkeditabletext-example.c
index 7cd8df72f4..b80ec74d82 100644
--- a/src/tests/clutter/accessibility/cally-atkeditabletext-example.c
+++ b/src/tests/clutter/accessibility/cally-atkeditabletext-example.c
@@ -150,7 +150,8 @@ _create_button (const gchar *text)
ClutterActor *label = NULL;
button = clutter_actor_new ();
- rectangle = clutter_rectangle_new_with_color (CLUTTER_COLOR_Magenta);
+ rectangle = clutter_actor_new ();
+ clutter_actor_set_background_color (rectangle, CLUTTER_COLOR_Magenta);
clutter_actor_set_size (rectangle, 375, 35);
label = clutter_text_new_full ("Sans Bold 32px",
diff --git a/src/tests/clutter/accessibility/cally-atkevents-example.c
b/src/tests/clutter/accessibility/cally-atkevents-example.c
index 1b8cd23d57..3c3bf2bed4 100644
--- a/src/tests/clutter/accessibility/cally-atkevents-example.c
+++ b/src/tests/clutter/accessibility/cally-atkevents-example.c
@@ -121,7 +121,8 @@ make_ui (ClutterActor *stage)
clutter_actor_set_reactive (editable, TRUE);
/* rectangle: to create a entry "feeling" */
- rectangle = clutter_rectangle_new_with_color (&color_rect);
+ rectangle = clutter_actor_new ();
+ clutter_actor_set_background_color (rectangle, &color_rect);
clutter_actor_set_position (rectangle, 150, editable_geom_y);
clutter_actor_set_size (rectangle, 500, 75);
diff --git a/src/tests/clutter/accessibility/cally-atktext-example.c
b/src/tests/clutter/accessibility/cally-atktext-example.c
index 3eae810562..78e19c3015 100644
--- a/src/tests/clutter/accessibility/cally-atktext-example.c
+++ b/src/tests/clutter/accessibility/cally-atktext-example.c
@@ -210,7 +210,8 @@ make_ui (ClutterActor *stage)
/* test button */
button = clutter_actor_new ();
- rectangle = clutter_rectangle_new_with_color (&color_rect);
+ rectangle = clutter_actor_new ();
+ clutter_actor_set_background_color (rectangle, &color_rect);
clutter_actor_set_size (rectangle, 75, 35);
label = clutter_text_new_full ("Sans Bold 32px",
diff --git a/src/tests/clutter/accessibility/cally-clone-example.c
b/src/tests/clutter/accessibility/cally-clone-example.c
index 2e88acbc0f..c234d95548 100644
--- a/src/tests/clutter/accessibility/cally-clone-example.c
+++ b/src/tests/clutter/accessibility/cally-clone-example.c
@@ -66,7 +66,8 @@ make_ui (ClutterActor *stage)
clutter_actor_set_reactive (editable, TRUE);
/* rectangle: to create a entry "feeling" */
- rectangle = clutter_rectangle_new_with_color (&color_rect);
+ rectangle = clutter_actor_new ();
+ clutter_actor_set_background_color (rectangle, &color_rect);
clutter_actor_set_position (rectangle, 150, 50);
clutter_actor_add_constraint (rectangle, clutter_bind_constraint_new (editable, CLUTTER_BIND_SIZE, 0));
diff --git a/src/tests/clutter/conform/actor-destroy.c b/src/tests/clutter/conform/actor-destroy.c
index 1aca9aba7d..eebcacc47b 100644
--- a/src/tests/clutter/conform/actor-destroy.c
+++ b/src/tests/clutter/conform/actor-destroy.c
@@ -120,7 +120,7 @@ test_destroy_class_init (TestDestroyClass *klass)
static void
test_destroy_init (TestDestroy *self)
{
- self->bg = clutter_rectangle_new ();
+ self->bg = clutter_actor_new ();
clutter_container_add_actor (CLUTTER_CONTAINER (self), self->bg);
clutter_actor_set_name (self->bg, "Background");
@@ -164,7 +164,7 @@ static void
actor_destruction (void)
{
ClutterActor *test = g_object_new (TEST_TYPE_DESTROY, NULL);
- ClutterActor *child = clutter_rectangle_new ();
+ ClutterActor *child = clutter_actor_new ();
gboolean destroy_called = FALSE;
gboolean parent_set_called = FALSE;
gboolean property_changed = FALSE;
diff --git a/src/tests/clutter/conform/actor-paint-opacity.c b/src/tests/clutter/conform/actor-paint-opacity.c
index 16d8d92315..661d9efe53 100644
--- a/src/tests/clutter/conform/actor-paint-opacity.c
+++ b/src/tests/clutter/conform/actor-paint-opacity.c
@@ -50,20 +50,21 @@ opacity_rectangle (void)
stage = clutter_test_get_stage ();
- rect = clutter_rectangle_new_with_color (&rect_color);
+ rect = clutter_actor_new ();
+ clutter_actor_set_background_color (rect, &rect_color);
clutter_actor_set_size (rect, 128, 128);
clutter_actor_set_position (rect, 150, 90);
if (!g_test_quiet ())
g_print ("rect 100%%.get_color()/1\n");
- clutter_rectangle_get_color (CLUTTER_RECTANGLE (rect), &color_check);
+ clutter_actor_get_background_color (rect, &color_check);
g_assert (color_check.alpha == rect_color.alpha);
clutter_actor_add_child (stage, rect);
if (!g_test_quiet ())
g_print ("rect 100%%.get_color()/2\n");
- clutter_rectangle_get_color (CLUTTER_RECTANGLE (rect), &color_check);
+ clutter_actor_set_background_color (rect, &color_check);
g_assert (color_check.alpha == rect_color.alpha);
if (!g_test_quiet ())
@@ -115,19 +116,20 @@ opacity_paint (void)
clutter_container_add (CLUTTER_CONTAINER (group1), group2, NULL);
clutter_actor_set_position (group2, 10, 60);
- rect = clutter_rectangle_new_with_color (&rect_color);
+ rect = clutter_actor_new ();
+ clutter_actor_set_background_color (rect, &rect_color);
clutter_actor_set_size (rect, 128, 128);
if (!g_test_quiet ())
g_print ("rect 100%% + group 100%% + group 50%%.get_color()/1\n");
- clutter_rectangle_get_color (CLUTTER_RECTANGLE (rect), &color_check);
+ clutter_actor_get_background_color (rect, &color_check);
g_assert (color_check.alpha == rect_color.alpha);
clutter_container_add (CLUTTER_CONTAINER (group2), rect, NULL);
if (!g_test_quiet ())
g_print ("rect 100%% + group 100%% + group 50%%.get_color()/2\n");
- clutter_rectangle_get_color (CLUTTER_RECTANGLE (rect), &color_check);
+ clutter_actor_get_background_color (rect, &color_check);
g_assert (color_check.alpha == rect_color.alpha);
if (!g_test_quiet ())
diff --git a/src/tests/clutter/conform/actor-pick.c b/src/tests/clutter/conform/actor-pick.c
index eb4e834f80..0e04ac004a 100644
--- a/src/tests/clutter/conform/actor-pick.c
+++ b/src/tests/clutter/conform/actor-pick.c
@@ -57,7 +57,8 @@ on_timeout (gpointer data)
static const ClutterColor red = { 0xff, 0x00, 0x00, 0xff };
/* Create an actor that covers the whole stage but that
isn't visible so it shouldn't affect the picking */
- over_actor = clutter_rectangle_new_with_color (&red);
+ over_actor = clutter_actor_new ();
+ clutter_actor_set_background_color (over_actor, &red);
clutter_actor_set_size (over_actor, STAGE_WIDTH, STAGE_HEIGHT);
clutter_actor_add_child (state->stage, over_actor);
clutter_actor_hide (over_actor);
@@ -186,8 +187,9 @@ actor_pick (void)
ClutterColor color = { x * 255 / (ACTORS_X - 1),
y * 255 / (ACTORS_Y - 1),
128, 255 };
- ClutterActor *rect = clutter_rectangle_new_with_color (&color);
+ ClutterActor *rect = clutter_actor_new ();
+ clutter_actor_set_background_color (rect, &color);
clutter_actor_set_position (rect,
x * state.actor_width,
y * state.actor_height);
diff --git a/src/tests/clutter/conform/actor-shader-effect.c b/src/tests/clutter/conform/actor-shader-effect.c
index f3b063c2e6..4a663403ca 100644
--- a/src/tests/clutter/conform/actor-shader-effect.c
+++ b/src/tests/clutter/conform/actor-shader-effect.c
@@ -203,8 +203,8 @@ make_actor (GType shader_type)
ClutterActor *rect;
const ClutterColor white = { 0xff, 0xff, 0xff, 0xff };
- rect = clutter_rectangle_new ();
- clutter_rectangle_set_color (CLUTTER_RECTANGLE (rect), &white);
+ rect = clutter_actor_new ();
+ clutter_actor_set_background_color (rect, &white);
clutter_actor_set_size (rect, 50, 50);
clutter_actor_add_effect (rect, g_object_new (shader_type, NULL));
diff --git a/src/tests/clutter/conform/script-parser.c b/src/tests/clutter/conform/script-parser.c
index 5f4d8b600d..c51329e13a 100644
--- a/src/tests/clutter/conform/script-parser.c
+++ b/src/tests/clutter/conform/script-parser.c
@@ -142,7 +142,7 @@ script_child (void)
"test-rect-1", &actor,
NULL);
g_assert (TEST_IS_GROUP (container));
- g_assert (CLUTTER_IS_RECTANGLE (actor));
+ g_assert (CLUTTER_IS_ACTOR (actor));
focus_ret = FALSE;
clutter_container_child_get (CLUTTER_CONTAINER (container),
@@ -152,7 +152,7 @@ script_child (void)
g_assert (focus_ret);
actor = clutter_script_get_object (script, "test-rect-2");
- g_assert (CLUTTER_IS_RECTANGLE (actor));
+ g_assert (CLUTTER_IS_ACTOR (actor));
focus_ret = FALSE;
clutter_container_child_get (CLUTTER_CONTAINER (container),
@@ -183,13 +183,13 @@ script_single (void)
g_assert_no_error (error);
actor = clutter_script_get_object (script, "test");
- g_assert (CLUTTER_IS_RECTANGLE (actor));
+ g_assert (CLUTTER_IS_ACTOR (actor));
rect = CLUTTER_ACTOR (actor);
g_assert_cmpfloat (clutter_actor_get_width (rect), ==, 50.0);
g_assert_cmpfloat (clutter_actor_get_y (rect), ==, 100.0);
- clutter_rectangle_get_color (CLUTTER_RECTANGLE (rect), &color);
+ clutter_actor_get_background_color (rect, &color);
g_assert_cmpint (color.red, ==, 255);
g_assert_cmpint (color.green, ==, 0xcc);
g_assert_cmpint (color.alpha, ==, 0xff);
diff --git a/src/tests/clutter/conform/scripts/test-script-child.json
b/src/tests/clutter/conform/scripts/test-script-child.json
index 5e8ac5242b..f23208a79b 100644
--- a/src/tests/clutter/conform/scripts/test-script-child.json
+++ b/src/tests/clutter/conform/scripts/test-script-child.json
@@ -3,19 +3,19 @@
"id" : "test-group",
"children" : [
{
- "type" : "ClutterRectangle",
+ "type" : "ClutterActor",
"id" : "test-rect-1",
"width" : 100.0,
"height" : 100.0,
- "color" : [ 255, 0, 0, 255 ],
+ "background-color" : [ 255, 0, 0, 255 ],
"child::focus" : true
},
{
- "type" : "ClutterRectangle",
+ "type" : "ClutterActor",
"id" : "test-rect-2",
"width" : 100.0,
"height" : 100.0,
- "color" : [ 0, 255, 0, 255 ]
+ "background-color" : [ 0, 255, 0, 255 ]
}
]
}
diff --git a/src/tests/clutter/conform/scripts/test-script-model.json
b/src/tests/clutter/conform/scripts/test-script-model.json
index 9bd6aefc54..dc4a62dc00 100644
--- a/src/tests/clutter/conform/scripts/test-script-model.json
+++ b/src/tests/clutter/conform/scripts/test-script-model.json
@@ -4,14 +4,14 @@
"columns" : [
[ "text-column", "gchararray" ],
[ "int-column", "gint" ],
- [ "actor-column", "ClutterRectangle" ]
+ [ "actor-column", "ClutterActor" ]
],
"rows" : [
[ "text-row-1", 1, null ],
- [ "text-row-2", 2, { "type" : "ClutterRectangle", "color" : "blue" } ],
+ [ "text-row-2", 2, { "type" : "ClutterActor", "background-color" : "blue" } ],
{
"int-column" : 3,
- "actor-column" : { "type" : "ClutterRectangle", "name" : "actor-row-3" }
+ "actor-column" : { "type" : "ClutterActor", "name" : "actor-row-3" }
}
]
}
diff --git a/src/tests/clutter/conform/scripts/test-script-named-object.json
b/src/tests/clutter/conform/scripts/test-script-named-object.json
index 956d2b4fd6..4ba5d2c927 100644
--- a/src/tests/clutter/conform/scripts/test-script-named-object.json
+++ b/src/tests/clutter/conform/scripts/test-script-named-object.json
@@ -17,7 +17,7 @@
"children" : [
{
"id" : "child-1",
- "type" : "ClutterRectangle",
+ "type" : "ClutterActor",
"width" : "3 em",
"height" : "3 em"
}
diff --git a/src/tests/clutter/conform/scripts/test-script-object-property.json
b/src/tests/clutter/conform/scripts/test-script-object-property.json
index d41a5f12ce..58187bbb6f 100644
--- a/src/tests/clutter/conform/scripts/test-script-object-property.json
+++ b/src/tests/clutter/conform/scripts/test-script-object-property.json
@@ -5,7 +5,7 @@
"children" : [
{
"id" : "child-1",
- "type" : "ClutterRectangle",
+ "type" : "ClutterActor",
"width" : "3 em",
"height" : "3 em"
}
diff --git a/src/tests/clutter/conform/scripts/test-script-single.json
b/src/tests/clutter/conform/scripts/test-script-single.json
index e20a318df1..cb09d696ab 100644
--- a/src/tests/clutter/conform/scripts/test-script-single.json
+++ b/src/tests/clutter/conform/scripts/test-script-single.json
@@ -1,10 +1,10 @@
{
- "type" : "ClutterRectangle",
+ "type" : "ClutterActor",
"id" : "test",
"width" : 50.0,
"height" : 100.0,
"x" : 100.0,
"y" : 100.0,
- "color" : "#ffccdd",
+ "background-color" : "#ffccdd",
"name" : "Test Rectangle"
}
diff --git a/src/tests/clutter/conform/texture-fbo.c b/src/tests/clutter/conform/texture-fbo.c
index ec07c77ec1..d03232a25e 100644
--- a/src/tests/clutter/conform/texture-fbo.c
+++ b/src/tests/clutter/conform/texture-fbo.c
@@ -38,14 +38,14 @@ create_source (void)
for (y = 0; y < SOURCE_DIVISIONS_Y; y++)
for (x = 0; x < SOURCE_DIVISIONS_X; x++)
{
- ClutterActor *rect = clutter_rectangle_new ();
+ ClutterActor *rect = clutter_actor_new ();
+ clutter_actor_set_background_color (rect,
+ corner_colors +
+ (y * SOURCE_DIVISIONS_X + x));
clutter_actor_set_size (rect, DIVISION_WIDTH, DIVISION_HEIGHT);
clutter_actor_set_position (rect,
DIVISION_WIDTH * x,
DIVISION_HEIGHT * y);
- clutter_rectangle_set_color (CLUTTER_RECTANGLE (rect),
- corner_colors +
- (y * SOURCE_DIVISIONS_X + x));
clutter_container_add (CLUTTER_CONTAINER (group), rect, NULL);
}
diff --git a/src/tests/clutter/interactive/test-events.c b/src/tests/clutter/interactive/test-events.c
index 4074b67eb9..7cc9a3c3c9 100644
--- a/src/tests/clutter/interactive/test-events.c
+++ b/src/tests/clutter/interactive/test-events.c
@@ -412,11 +412,13 @@ test_events_main (int argc, char *argv[])
g_signal_connect (stage, "deactivate",
G_CALLBACK (stage_state_cb), (char *) "deactivate");
- focus_box = clutter_rectangle_new_with_color (CLUTTER_COLOR_Black);
+ focus_box = clutter_actor_new ();
+ clutter_actor_set_background_color (focus_box, CLUTTER_COLOR_Black);
clutter_actor_set_name (focus_box, "Focus Box");
clutter_container_add (CLUTTER_CONTAINER(stage), focus_box, NULL);
- actor = clutter_rectangle_new_with_color (CLUTTER_COLOR_Red);
+ actor = clutter_actor_new ();
+ clutter_actor_set_background_color (actor, CLUTTER_COLOR_Red);
clutter_actor_set_name (actor, "Red Box");
clutter_actor_set_size (actor, 100, 100);
clutter_actor_set_position (actor, 100, 100);
@@ -431,7 +433,8 @@ test_events_main (int argc, char *argv[])
clutter_stage_set_key_focus (CLUTTER_STAGE (stage), actor);
- actor = clutter_rectangle_new_with_color (CLUTTER_COLOR_Green);
+ actor = clutter_actor_new ();
+ clutter_actor_set_background_color (actor, CLUTTER_COLOR_Green);
clutter_actor_set_name (actor, "Green Box");
clutter_actor_set_size (actor, 100, 100);
clutter_actor_set_position (actor, 250, 100);
@@ -443,7 +446,8 @@ test_events_main (int argc, char *argv[])
g_signal_connect (actor, "captured-event", G_CALLBACK (capture_cb), NULL);
/* non reactive */
- actor = clutter_rectangle_new_with_color (CLUTTER_COLOR_Black);
+ actor = clutter_actor_new ();
+ clutter_actor_set_background_color (actor, CLUTTER_COLOR_Black);
clutter_actor_set_name (actor, "Black Box");
clutter_actor_set_size (actor, 400, 50);
clutter_actor_set_position (actor, 100, 250);
@@ -455,7 +459,8 @@ test_events_main (int argc, char *argv[])
focus_box);
/* non reactive group, with reactive child */
- actor = clutter_rectangle_new_with_color (CLUTTER_COLOR_Yellow);
+ actor = clutter_actor_new ();
+ clutter_actor_set_background_color (actor, CLUTTER_COLOR_Yellow);
clutter_actor_set_name (actor, "Yellow Box");
clutter_actor_set_size (actor, 100, 100);
clutter_actor_set_reactive (actor, TRUE);
@@ -469,7 +474,8 @@ test_events_main (int argc, char *argv[])
clutter_actor_set_position (group, 100, 350);
/* border actor */
- actor = clutter_rectangle_new_with_color (CLUTTER_COLOR_Magenta);
+ actor = clutter_actor_new ();
+ clutter_actor_set_background_color (actor, CLUTTER_COLOR_Magenta);
clutter_actor_set_name (actor, "Border Box");
clutter_actor_set_size (actor, 100, 100);
clutter_actor_set_position (actor,
diff --git a/src/tests/clutter/interactive/test-grab.c b/src/tests/clutter/interactive/test-grab.c
index cceb547e1b..317433a6da 100644
--- a/src/tests/clutter/interactive/test-grab.c
+++ b/src/tests/clutter/interactive/test-grab.c
@@ -235,7 +235,8 @@ test_grab_main (int argc, char *argv[])
g_signal_connect (stage, "deactivate",
G_CALLBACK (stage_state_cb), (char *) "deactivate");
- actor = clutter_rectangle_new_with_color (&rcol);
+ actor = clutter_actor_new ();
+ clutter_actor_set_background_color (actor, &rcol);
clutter_actor_set_size (actor, 100, 100);
clutter_actor_set_position (actor, 100, 100);
clutter_actor_set_reactive (actor, TRUE);
@@ -246,7 +247,8 @@ test_grab_main (int argc, char *argv[])
g_signal_connect (actor, "button-release-event",
G_CALLBACK (red_release_cb), NULL);
- actor = clutter_rectangle_new_with_color (&ycol);
+ actor = clutter_actor_new ();
+ clutter_actor_set_background_color (actor, &ycol);
clutter_actor_set_size (actor, 100, 100);
clutter_actor_set_position (actor, 100, 300);
clutter_actor_set_reactive (actor, TRUE);
@@ -255,7 +257,8 @@ test_grab_main (int argc, char *argv[])
g_signal_connect (actor, "button-press-event",
G_CALLBACK (toggle_grab_pointer_cb), NULL);
- actor = clutter_rectangle_new_with_color (&bcol);
+ actor = clutter_actor_new ();
+ clutter_actor_set_background_color (actor, &bcol);
clutter_actor_set_size (actor, 100, 100);
clutter_actor_set_position (actor, 300, 100);
clutter_actor_set_reactive (actor, TRUE);
@@ -267,7 +270,8 @@ test_grab_main (int argc, char *argv[])
g_signal_connect (actor, "button-release-event",
G_CALLBACK (blue_release_cb), NULL);
- actor = clutter_rectangle_new_with_color (&gcol);
+ actor = clutter_actor_new ();
+ clutter_actor_set_background_color (actor, &gcol);
clutter_actor_set_size (actor, 100, 100);
clutter_actor_set_position (actor, 300, 300);
clutter_actor_set_reactive (actor, TRUE);
@@ -278,7 +282,8 @@ test_grab_main (int argc, char *argv[])
G_CALLBACK (green_press_cb), NULL);
- actor = clutter_rectangle_new_with_color (&ccol);
+ actor = clutter_actor_new ();
+ clutter_actor_set_background_color (actor, &ccol);
clutter_actor_set_size (actor, 100, 100);
clutter_actor_set_position (actor, 500, 100);
clutter_actor_set_reactive (actor, TRUE);
diff --git a/src/tests/clutter/interactive/test-path-constraint.c
b/src/tests/clutter/interactive/test-path-constraint.c
index f802ed4817..de6a70b828 100644
--- a/src/tests/clutter/interactive/test-path-constraint.c
+++ b/src/tests/clutter/interactive/test-path-constraint.c
@@ -116,8 +116,8 @@ test_path_constraint_main (int argc,
path = clutter_path_new ();
clutter_path_set_description (path, PATH_DESCRIPTION);
- rect = clutter_rectangle_new ();
- clutter_rectangle_set_color (CLUTTER_RECTANGLE (rect), &rect_color);
+ rect = clutter_actor_new ();
+ clutter_actor_set_background_color (rect, &rect_color);
clutter_actor_set_size (rect, 128, 128);
clutter_actor_set_reactive (rect, TRUE);
clutter_actor_add_constraint_with_name (rect, "path", clutter_path_constraint_new (path, 0.0));
diff --git a/src/tests/clutter/interactive/test-script.c b/src/tests/clutter/interactive/test-script.c
index d0795dde2a..ea881c2373 100644
--- a/src/tests/clutter/interactive/test-script.c
+++ b/src/tests/clutter/interactive/test-script.c
@@ -22,8 +22,8 @@ static const gchar *test_unmerge =
" },"
" {"
" \"id\" : \"blue-button\","
-" \"type\" : \"ClutterRectangle\","
-" \"color\" : \"#0000ffff\","
+" \"type\" : \"ClutterActor\","
+" \"background-color\" : \"#0000ffff\","
" \"x\" : 350,"
" \"y\" : 50,"
" \"width\" : 100,"
diff --git a/src/tests/clutter/interactive/test-script.json b/src/tests/clutter/interactive/test-script.json
index ce135cb3ab..07cf21b068 100644
--- a/src/tests/clutter/interactive/test-script.json
+++ b/src/tests/clutter/interactive/test-script.json
@@ -11,8 +11,8 @@
"children" : [
{
"id" : "red-button",
- "type" : "ClutterRectangle",
- "color" : "#ff0000ff",
+ "type" : "ClutterActor",
+ "background-color" : "#ff0000ff",
"x" : 50, "y" : 50, "width" : 100, "height" : 100,
"reactive" : true,
"rotation" : [
@@ -21,8 +21,8 @@
},
{
"id" : "green-button",
- "type" : "ClutterRectangle",
- "color" : "#00ff00ff",
+ "type" : "ClutterActor",
+ "background-color" : "#00ff00ff",
"border-width" : 5,
"border-color" : "#00cc00ff",
"position" : [ 200.0, 50.0 ],
diff --git a/src/tests/clutter/interactive/test-shader-effects.c
b/src/tests/clutter/interactive/test-shader-effects.c
index abe2472d56..df546ad660 100644
--- a/src/tests/clutter/interactive/test-shader-effects.c
+++ b/src/tests/clutter/interactive/test-shader-effects.c
@@ -49,7 +49,8 @@ test_shader_effects_main (int argc, char *argv[])
"opacity", 128,
NULL);
- rect = clutter_rectangle_new_with_color (CLUTTER_COLOR_DarkOrange);
+ rect = clutter_actor_new ();
+ clutter_actor_set_background_color (rect, CLUTTER_COLOR_DarkOrange);
clutter_actor_add_effect_with_name (rect, "blur", clutter_blur_effect_new ());
clutter_actor_set_position (rect, 415, 215);
clutter_actor_set_size (rect, 150, 150);
diff --git a/src/tests/clutter/interactive/test-swipe-action.c
b/src/tests/clutter/interactive/test-swipe-action.c
index 3c218bd17e..546185590a 100644
--- a/src/tests/clutter/interactive/test-swipe-action.c
+++ b/src/tests/clutter/interactive/test-swipe-action.c
@@ -123,7 +123,8 @@ test_swipe_action_main (int argc, char *argv[])
clutter_actor_set_size (stage, 640, 480);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
- rect = clutter_rectangle_new_with_color (CLUTTER_COLOR_Red);
+ rect = clutter_actor_new ();
+ clutter_actor_set_background_color (rect, CLUTTER_COLOR_Red);
clutter_actor_set_name (rect, "Vertical swipes");
clutter_actor_set_size (rect, 150, 150);
clutter_actor_set_position (rect, 10, 100);
@@ -131,7 +132,8 @@ test_swipe_action_main (int argc, char *argv[])
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
attach_action (rect, VERTICAL);
- rect = clutter_rectangle_new_with_color (CLUTTER_COLOR_Blue);
+ rect = clutter_actor_new ();
+ clutter_actor_set_background_color (rect, CLUTTER_COLOR_Blue);
clutter_actor_set_name (rect, "Horizontal swipes");
clutter_actor_set_size (rect, 150, 150);
clutter_actor_set_position (rect, 170, 100);
@@ -139,7 +141,8 @@ test_swipe_action_main (int argc, char *argv[])
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
attach_action (rect, HORIZONTAL);
- rect = clutter_rectangle_new_with_color (CLUTTER_COLOR_Green);
+ rect = clutter_actor_new ();
+ clutter_actor_set_background_color (rect, CLUTTER_COLOR_Green);
clutter_actor_set_name (rect, "All swipes");
clutter_actor_set_size (rect, 150, 150);
clutter_actor_set_position (rect, 330, 100);
diff --git a/src/tests/clutter/interactive/test-touch-events.c
b/src/tests/clutter/interactive/test-touch-events.c
index 14ad6d314b..88e9a2cbc5 100644
--- a/src/tests/clutter/interactive/test-touch-events.c
+++ b/src/tests/clutter/interactive/test-touch-events.c
@@ -112,7 +112,7 @@ rect_event_cb (ClutterActor *actor, ClutterEvent *event, gpointer data)
return FALSE;
color = static_colors[g_random_int_range (0, NUM_COLORS)];
- clutter_rectangle_set_color (CLUTTER_RECTANGLE (actor), &color);
+ clutter_actor_set_background_color (actor, &color);
return TRUE;
}
@@ -152,7 +152,9 @@ test_touch_events_main (int argc, char *argv[])
{
gfloat size = STAGE_HEIGHT / NUM_ACTORS;
ClutterColor color = static_colors[i % NUM_COLORS];
- ClutterActor *rectangle = clutter_rectangle_new_with_color (&color);
+ ClutterActor *rectangle = clutter_actor_new ();
+
+ clutter_actor_set_background_color (rectangle, &color);
/* Test that event delivery to actors work */
g_signal_connect (rectangle, "event", G_CALLBACK (rect_event_cb), NULL);
diff --git a/src/tests/clutter/micro-bench/test-picking.c b/src/tests/clutter/micro-bench/test-picking.c
index 16d6934918..1ba61d5407 100644
--- a/src/tests/clutter/micro-bench/test-picking.c
+++ b/src/tests/clutter/micro-bench/test-picking.c
@@ -112,7 +112,8 @@ main (int argc, char **argv)
fmod ((i + (n_actors/3.0)), n_actors)))) /
(gdouble)(n_actors/4.0) - 1.0)) * 255.0;
- rect = clutter_rectangle_new_with_color (&color);
+ rect = clutter_actor_new ();
+ clutter_actor_set_background_color (rect, &color);
clutter_actor_set_size (rect, 100, 100);
clutter_actor_set_anchor_point_from_gravity (rect,
CLUTTER_GRAVITY_CENTER);
diff --git a/src/tests/clutter/performance/test-picking.c b/src/tests/clutter/performance/test-picking.c
index 1cf40e3652..6940ef0b5f 100644
--- a/src/tests/clutter/performance/test-picking.c
+++ b/src/tests/clutter/performance/test-picking.c
@@ -107,7 +107,8 @@ main (int argc, char **argv)
fmod ((i + (n_actors/3.0)), n_actors)))) /
(gdouble)(n_actors/4.0) - 1.0)) * 255.0;
- rect = clutter_rectangle_new_with_color (&color);
+ rect = clutter_actor_new ();
+ clutter_actor_set_background_color (rect, &color);
clutter_actor_set_size (rect, 100, 100);
clutter_actor_set_anchor_point_from_gravity (rect,
CLUTTER_GRAVITY_CENTER);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]