mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
Move tests to static colors where possible
This commit is contained in:
parent
985518c601
commit
6ed6b2a54b
@ -10,7 +10,8 @@
|
||||
|
||||
typedef struct SuperOH
|
||||
{
|
||||
ClutterActor **hand, *bgtex;
|
||||
ClutterActor **hand;
|
||||
ClutterActor *bgtex;
|
||||
ClutterActor *real_hand;
|
||||
ClutterActor *group;
|
||||
ClutterActor *stage;
|
||||
@ -133,7 +134,6 @@ test_actors_main (int argc, char *argv[])
|
||||
{
|
||||
ClutterAlpha *alpha;
|
||||
ClutterActor *stage;
|
||||
ClutterColor stage_color = { 0x61, 0x64, 0x8c, 0xff };
|
||||
SuperOH *oh;
|
||||
gint i;
|
||||
GError *error;
|
||||
@ -156,12 +156,13 @@ test_actors_main (int argc, char *argv[])
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
clutter_actor_set_size (stage, 800, 600);
|
||||
clutter_actor_set_name (stage, "Default Stage");
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Clone Test");
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Actors");
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_LightSkyBlue);
|
||||
clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
|
||||
|
||||
oh = g_new (SuperOH, 1);
|
||||
|
@ -73,9 +73,6 @@ test_behave_main (int argc, char *argv[])
|
||||
ClutterBehaviour *o_behave, *p_behave;
|
||||
ClutterActor *stage;
|
||||
ClutterActor *group, *rect, *hand;
|
||||
ClutterColor stage_color = { 0xcc, 0xcc, 0xcc, 0xff };
|
||||
ClutterColor rect_bg_color = { 0x33, 0x22, 0x22, 0xff };
|
||||
ClutterColor rect_border_color = { 0, 0, 0, 0 };
|
||||
gchar *file;
|
||||
int i;
|
||||
path_t path_type = PATH_POLY;
|
||||
@ -119,9 +116,11 @@ test_behave_main (int argc, char *argv[])
|
||||
|
||||
clutter_init (&argc, &argv);
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Behaviours");
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Aluminium2);
|
||||
clutter_stage_hide_cursor (CLUTTER_STAGE (stage));
|
||||
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
g_signal_connect (stage, "button-press-event",
|
||||
G_CALLBACK (button_press_cb),
|
||||
NULL);
|
||||
@ -132,9 +131,6 @@ test_behave_main (int argc, char *argv[])
|
||||
G_CALLBACK (clutter_main_quit),
|
||||
NULL);
|
||||
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage),
|
||||
&stage_color);
|
||||
|
||||
/* Make a hand */
|
||||
group = clutter_group_new ();
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
|
||||
@ -155,12 +151,10 @@ test_behave_main (int argc, char *argv[])
|
||||
clutter_actor_set_size (rect,
|
||||
clutter_actor_get_width (hand),
|
||||
clutter_actor_get_height (hand));
|
||||
clutter_rectangle_set_color (CLUTTER_RECTANGLE (rect),
|
||||
&rect_bg_color);
|
||||
clutter_rectangle_set_color (CLUTTER_RECTANGLE (rect), CLUTTER_COLOR_Transparent);
|
||||
clutter_rectangle_set_border_width (CLUTTER_RECTANGLE (rect), 10);
|
||||
clutter_color_from_string (&rect_border_color, "DarkSlateGray");
|
||||
clutter_rectangle_set_border_color (CLUTTER_RECTANGLE (rect),
|
||||
&rect_border_color);
|
||||
CLUTTER_COLOR_Chameleon);
|
||||
clutter_actor_show (rect);
|
||||
|
||||
clutter_container_add (CLUTTER_CONTAINER (group), rect, hand, NULL);
|
||||
|
@ -245,9 +245,6 @@ G_MODULE_EXPORT int
|
||||
test_binding_pool_main (int argc, char *argv[])
|
||||
{
|
||||
ClutterActor *stage, *key_group;
|
||||
ClutterColor red_color = { 255, 0, 0, 255 };
|
||||
ClutterColor green_color = { 0, 255, 0, 255 };
|
||||
ClutterColor blue_color = { 0, 0, 255, 255 };
|
||||
gint group_x, group_y;
|
||||
|
||||
clutter_init (&argc, &argv);
|
||||
@ -263,21 +260,21 @@ test_binding_pool_main (int argc, char *argv[])
|
||||
/* add three rectangles to the key group */
|
||||
clutter_container_add (CLUTTER_CONTAINER (key_group),
|
||||
g_object_new (CLUTTER_TYPE_RECTANGLE,
|
||||
"color", &red_color,
|
||||
"color", CLUTTER_COLOR_Red,
|
||||
"width", 50.0,
|
||||
"height", 50.0,
|
||||
"x", 0.0,
|
||||
"y", 0.0,
|
||||
NULL),
|
||||
g_object_new (CLUTTER_TYPE_RECTANGLE,
|
||||
"color", &green_color,
|
||||
"color", CLUTTER_COLOR_Green,
|
||||
"width", 50.0,
|
||||
"height", 50.0,
|
||||
"x", 75.0,
|
||||
"y", 0.0,
|
||||
NULL),
|
||||
g_object_new (CLUTTER_TYPE_RECTANGLE,
|
||||
"color", &blue_color,
|
||||
"color", CLUTTER_COLOR_Blue,
|
||||
"width", 50.0,
|
||||
"height", 50.0,
|
||||
"x", 150.0,
|
||||
|
@ -71,10 +71,9 @@ enter_event (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
ClutterColor color = { 0x00, 0x00, 0x00, 0xff };
|
||||
|
||||
clutter_rectangle_set_border_width (CLUTTER_RECTANGLE (actor), 2);
|
||||
clutter_rectangle_set_border_color (CLUTTER_RECTANGLE (actor), &color);
|
||||
clutter_rectangle_set_border_color (CLUTTER_RECTANGLE (actor),
|
||||
CLUTTER_COLOR_Black);
|
||||
|
||||
hover_actor = actor;
|
||||
}
|
||||
@ -132,13 +131,14 @@ add_actor (ClutterBoxLayout *layout,
|
||||
guint index_)
|
||||
{
|
||||
ClutterActor *rect;
|
||||
ClutterColor color = { 0xff, 0xff, 0xff, 255 };
|
||||
static gboolean expand = TRUE;
|
||||
ClutterColor color;
|
||||
|
||||
clutter_color_from_hls (&color,
|
||||
g_random_double_range (0.0, 360.0),
|
||||
0.5,
|
||||
0.5);
|
||||
color.alpha = 255;
|
||||
|
||||
rect = clutter_rectangle_new_with_color (&color);
|
||||
clutter_actor_set_size (rect, 32, 64);
|
||||
|
@ -75,19 +75,16 @@ static ClutterActor *
|
||||
janus_group (const gchar *front_text,
|
||||
const gchar *back_text)
|
||||
{
|
||||
ClutterColor slide_color = {0x00, 0x00, 0x00, 0xff};
|
||||
ClutterColor red = {0xff, 0x00, 0x00, 0xff};
|
||||
ClutterColor green = {0x00, 0xff, 0x00, 0xff};
|
||||
ClutterActor *group, *rectangle, *front, *back;
|
||||
gfloat width, height;
|
||||
gfloat width2, height2;
|
||||
|
||||
group = clutter_group_new ();
|
||||
rectangle = clutter_rectangle_new_with_color (&slide_color);
|
||||
rectangle = clutter_rectangle_new_with_color (CLUTTER_COLOR_White);
|
||||
front = clutter_text_new_with_text ("Sans 50px", front_text);
|
||||
back = clutter_text_new_with_text ("Sans 50px", back_text);
|
||||
clutter_text_set_color (CLUTTER_TEXT (front), &red);
|
||||
clutter_text_set_color (CLUTTER_TEXT (back), &green);
|
||||
clutter_text_set_color (CLUTTER_TEXT (front), CLUTTER_COLOR_Red);
|
||||
clutter_text_set_color (CLUTTER_TEXT (back), CLUTTER_COLOR_Green);
|
||||
|
||||
clutter_actor_get_size (front, &width, &height);
|
||||
clutter_actor_get_size (back, &width2, &height2);
|
||||
@ -117,22 +114,22 @@ test_depth_main (int argc, char *argv[])
|
||||
ClutterBehaviour *r_behave;
|
||||
ClutterActor *stage;
|
||||
ClutterActor *group, *hand, *label, *rect, *janus, *box;
|
||||
ClutterColor stage_color = { 0xcc, 0xcc, 0xcc, 0xff };
|
||||
ClutterColor rect_color = { 0, 0, 0, 0x88 };
|
||||
GError *error;
|
||||
|
||||
clutter_init (&argc, &argv);
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
|
||||
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Depth Test");
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Aluminium2);
|
||||
g_signal_connect (stage,
|
||||
"destroy", G_CALLBACK (clutter_main_quit),
|
||||
NULL);
|
||||
g_signal_connect (stage,
|
||||
"button-press-event", G_CALLBACK (clutter_main_quit),
|
||||
NULL);
|
||||
|
||||
group = clutter_group_new ();
|
||||
clutter_stage_add (stage, group);
|
||||
clutter_actor_show (group);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
|
||||
|
||||
label = clutter_text_new_with_text ("Mono 26", "Clutter");
|
||||
clutter_actor_set_position (label, 120, 200);
|
||||
@ -148,9 +145,10 @@ test_depth_main (int argc, char *argv[])
|
||||
clutter_actor_set_position (hand, 240, 100);
|
||||
clutter_actor_show (hand);
|
||||
|
||||
rect = clutter_rectangle_new_with_color (&rect_color);
|
||||
rect = clutter_rectangle_new_with_color (CLUTTER_COLOR_Black);
|
||||
clutter_actor_set_position (rect, 340, 100);
|
||||
clutter_actor_set_size (rect, 200, 200);
|
||||
clutter_actor_set_opacity (rect, 128);
|
||||
clutter_actor_show (rect);
|
||||
|
||||
clutter_container_add (CLUTTER_CONTAINER (group), hand, rect, NULL);
|
||||
|
@ -37,13 +37,12 @@ on_drag_begin (ClutterDragAction *action,
|
||||
if (is_copy)
|
||||
{
|
||||
ClutterActor *stage = clutter_actor_get_stage (actor);
|
||||
ClutterColor handle_color;
|
||||
|
||||
drag_handle = clutter_rectangle_new ();
|
||||
clutter_actor_set_size (drag_handle, 48, 48);
|
||||
|
||||
clutter_color_from_string (&handle_color, "#204a87aa");
|
||||
clutter_rectangle_set_color (CLUTTER_RECTANGLE (drag_handle), &handle_color);
|
||||
clutter_rectangle_set_color (CLUTTER_RECTANGLE (drag_handle),
|
||||
CLUTTER_COLOR_DarkSkyBlue);
|
||||
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), drag_handle);
|
||||
clutter_actor_set_position (drag_handle, event_x, event_y);
|
||||
@ -154,7 +153,6 @@ test_drag_main (int argc, char *argv[])
|
||||
{
|
||||
ClutterActor *stage, *handle;
|
||||
ClutterAction *action;
|
||||
ClutterColor handle_color;
|
||||
GError *error;
|
||||
|
||||
error = NULL;
|
||||
@ -176,10 +174,9 @@ test_drag_main (int argc, char *argv[])
|
||||
clutter_actor_set_size (stage, 800, 600);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
clutter_color_from_string (&handle_color, "#729fcfff");
|
||||
|
||||
handle = clutter_rectangle_new ();
|
||||
clutter_rectangle_set_color (CLUTTER_RECTANGLE (handle), &handle_color);
|
||||
clutter_rectangle_set_color (CLUTTER_RECTANGLE (handle),
|
||||
CLUTTER_COLOR_SkyBlue);
|
||||
clutter_actor_set_size (handle, 128, 128);
|
||||
clutter_actor_set_position (handle, (800 - 128) / 2, (600 - 128) / 2);
|
||||
clutter_actor_set_reactive (handle, TRUE);
|
||||
|
@ -566,8 +566,6 @@ static ClutterActor *icon = NULL;
|
||||
static ClutterTimeline *main_timeline = NULL;
|
||||
static ClutterBehaviour *behaviour = NULL;
|
||||
|
||||
static ClutterColor bg_color;
|
||||
|
||||
static void
|
||||
toggle_property_value (ClutterActor *actor,
|
||||
const gchar *property_name)
|
||||
@ -752,8 +750,6 @@ test_layout_main (int argc, char *argv[])
|
||||
stage = clutter_stage_get_default ();
|
||||
clutter_actor_set_size (stage, 800, 600);
|
||||
|
||||
clutter_color_from_string (&bg_color, "Red");
|
||||
|
||||
main_timeline = clutter_timeline_new (2000);
|
||||
clutter_timeline_set_loop (main_timeline, TRUE);
|
||||
g_signal_connect (main_timeline, "new-frame",
|
||||
|
@ -22,20 +22,15 @@ on_button_press (ClutterActor *actor,
|
||||
ClutterActor *label, *tex;
|
||||
gint width, height;
|
||||
gchar *stage_label, *win_title;
|
||||
ClutterColor color = { 0xdd, 0x33, 0xdd, 0xff };
|
||||
ClutterColor white = { 0x99, 0x99, 0x99, 0xff };
|
||||
ClutterTimeline *timeline;
|
||||
ClutterAlpha *alpha;
|
||||
ClutterBehaviour *r_behave;
|
||||
|
||||
new_stage = clutter_stage_new ();
|
||||
if (!new_stage)
|
||||
if (new_stage == NULL)
|
||||
return FALSE;
|
||||
|
||||
/* FIXME: below should really be automatic */
|
||||
/* clutter_stage_ensure_cogl_context (CLUTTER_STAGE(new_stage)); */
|
||||
|
||||
clutter_stage_set_color (CLUTTER_STAGE (new_stage), &color);
|
||||
clutter_stage_set_color (CLUTTER_STAGE (new_stage), CLUTTER_COLOR_DarkScarletRed);
|
||||
clutter_actor_set_size (new_stage, 320, 240);
|
||||
|
||||
tex = clutter_texture_new_from_file (TESTS_DATADIR
|
||||
@ -55,7 +50,7 @@ on_button_press (ClutterActor *actor,
|
||||
stage_label = g_strdup_printf ("<b>Stage: %d</b>", ++n_stages);
|
||||
label = clutter_text_new_with_text ("Mono 12", stage_label);
|
||||
|
||||
clutter_text_set_color (CLUTTER_TEXT (label), &white);
|
||||
clutter_text_set_color (CLUTTER_TEXT (label), CLUTTER_COLOR_White);
|
||||
clutter_text_set_use_markup (CLUTTER_TEXT (label), TRUE);
|
||||
width = (clutter_actor_get_width (new_stage)
|
||||
- clutter_actor_get_width (label)) / 2;
|
||||
|
@ -15,8 +15,6 @@ test_rotate_main (int argc, char *argv[])
|
||||
ClutterBehaviour *r_behave;
|
||||
ClutterActor *stage;
|
||||
ClutterActor *hand, *label, *rect;
|
||||
ClutterColor stage_color = { 0xcc, 0xcc, 0xcc, 0xff };
|
||||
ClutterColor rect_color;
|
||||
gchar *file;
|
||||
|
||||
clutter_init (&argc, &argv);
|
||||
@ -25,10 +23,10 @@ test_rotate_main (int argc, char *argv[])
|
||||
timeline = clutter_timeline_new (7692);
|
||||
clutter_timeline_set_loop (timeline, TRUE);
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage),
|
||||
&stage_color);
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Rotations");
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Aluminium3);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
/* Make a hand */
|
||||
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||
@ -38,8 +36,7 @@ test_rotate_main (int argc, char *argv[])
|
||||
|
||||
g_free (file);
|
||||
|
||||
clutter_color_from_string (&rect_color, "#ce5c00ff");
|
||||
rect = clutter_rectangle_new_with_color (&rect_color);
|
||||
rect = clutter_rectangle_new_with_color (CLUTTER_COLOR_DarkOrange);
|
||||
clutter_actor_add_effect_with_name (rect, "blur", clutter_blur_effect_new ());
|
||||
clutter_actor_set_position (rect, 340, 140);
|
||||
clutter_actor_set_size (rect, 150, 150);
|
||||
|
@ -39,7 +39,6 @@ G_MODULE_EXPORT int
|
||||
test_stage_sizing_main (int argc, char *argv[])
|
||||
{
|
||||
gfloat width;
|
||||
ClutterColor color;
|
||||
ClutterActor *stage, *rect, *label;
|
||||
|
||||
clutter_init (&argc, &argv);
|
||||
@ -47,8 +46,7 @@ test_stage_sizing_main (int argc, char *argv[])
|
||||
stage = clutter_stage_get_default ();
|
||||
|
||||
label = clutter_text_new_with_text ("Sans 16", "Toggle fullscreen");
|
||||
clutter_color_from_string (&color, "light red");
|
||||
rect = clutter_rectangle_new_with_color (&color);
|
||||
rect = clutter_rectangle_new_with_color (CLUTTER_COLOR_LightScarletRed);
|
||||
clutter_actor_set_size (rect,
|
||||
clutter_actor_get_width (label) + 20,
|
||||
clutter_actor_get_height (label) + 20);
|
||||
@ -60,8 +58,7 @@ test_stage_sizing_main (int argc, char *argv[])
|
||||
width = clutter_actor_get_width (rect);
|
||||
|
||||
label = clutter_text_new_with_text ("Sans 16", "Toggle resizable");
|
||||
clutter_color_from_string (&color, "light green");
|
||||
rect = clutter_rectangle_new_with_color (&color);
|
||||
rect = clutter_rectangle_new_with_color (CLUTTER_COLOR_Chameleon);
|
||||
clutter_actor_set_size (rect,
|
||||
clutter_actor_get_width (label) + 20,
|
||||
clutter_actor_get_height (label) + 20);
|
||||
@ -74,8 +71,7 @@ test_stage_sizing_main (int argc, char *argv[])
|
||||
width += clutter_actor_get_width (rect);
|
||||
|
||||
label = clutter_text_new_with_text ("Sans 16", "Shrink");
|
||||
clutter_color_from_string (&color, "light blue");
|
||||
rect = clutter_rectangle_new_with_color (&color);
|
||||
rect = clutter_rectangle_new_with_color (CLUTTER_COLOR_SkyBlue);
|
||||
clutter_actor_set_size (rect,
|
||||
clutter_actor_get_width (label) + 20,
|
||||
clutter_actor_get_height (label) + 20);
|
||||
@ -88,8 +84,7 @@ test_stage_sizing_main (int argc, char *argv[])
|
||||
width += clutter_actor_get_width (rect);
|
||||
|
||||
label = clutter_text_new_with_text ("Sans 16", "Expand");
|
||||
clutter_color_from_string (&color, "light yellow");
|
||||
rect = clutter_rectangle_new_with_color (&color);
|
||||
rect = clutter_rectangle_new_with_color (CLUTTER_COLOR_Butter);
|
||||
clutter_actor_set_size (rect,
|
||||
clutter_actor_get_width (label) + 20,
|
||||
clutter_actor_get_height (label) + 20);
|
||||
|
@ -179,9 +179,6 @@ test_threads_main (int argc, char *argv[])
|
||||
{
|
||||
ClutterActor *stage;
|
||||
ClutterActor *rect;
|
||||
ClutterColor stage_color = { 0xcc, 0xcc, 0xcc, 0xff };
|
||||
ClutterColor rect_color = { 0xee, 0x55, 0x55, 0x99 };
|
||||
ClutterColor progress_color = { 0x55, 0xee, 0x55, 0xbb };
|
||||
ClutterBehaviour *r_behaviour, *p_behaviour;
|
||||
ClutterAlpha *alpha;
|
||||
const ClutterKnot knots[] = {
|
||||
@ -193,9 +190,11 @@ test_threads_main (int argc, char *argv[])
|
||||
clutter_threads_init ();
|
||||
clutter_init (&argc, &argv);
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Threading");
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Aluminium3);
|
||||
clutter_actor_set_size (stage, 600, 300);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
count_label = clutter_text_new_with_text ("Mono 12", "Counter");
|
||||
clutter_actor_set_position (count_label, 350, 50);
|
||||
@ -203,12 +202,13 @@ test_threads_main (int argc, char *argv[])
|
||||
help_label = clutter_text_new_with_text ("Mono 12", "Press 's' to start");
|
||||
clutter_actor_set_position (help_label, 50, 50);
|
||||
|
||||
rect = clutter_rectangle_new_with_color (&rect_color);
|
||||
rect = clutter_rectangle_new_with_color (CLUTTER_COLOR_LightScarletRed);
|
||||
clutter_actor_set_position (rect, 75, 150);
|
||||
clutter_actor_set_size (rect, 50, 50);
|
||||
clutter_actor_set_anchor_point (rect, 25, 25);
|
||||
clutter_actor_set_opacity (rect, 224);
|
||||
|
||||
progress_rect = clutter_rectangle_new_with_color (&progress_color);
|
||||
progress_rect = clutter_rectangle_new_with_color (CLUTTER_COLOR_DarkChameleon);
|
||||
clutter_actor_set_position (progress_rect, 50, 225);
|
||||
clutter_actor_set_size (progress_rect, 350, 50);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user