mirror of
https://github.com/brl/mutter.git
synced 2024-12-11 22:10:16 +00:00
eb906d85ca
This fixes segfaults when something goes wrong during init, but the test keeps going anyway. Except for test-easing and test-picking, these were fixed by sed magic: sed -i -s -e "s/clutter_init \?(&argc, &argv)/\ if (clutter_init (\&argc, \&argv) != CLUTTER_INIT_SUCCESS)\n\ return 1/" tests/*/*.c http://bugzilla.clutter-project.org/show_bug.cgi?id=2574
49 lines
1.5 KiB
C
49 lines
1.5 KiB
C
#include <stdlib.h>
|
|
#include <glib.h>
|
|
#include <gmodule.h>
|
|
#include <clutter/clutter.h>
|
|
|
|
G_MODULE_EXPORT int
|
|
test_texture_material_main (int argc, char *argv[])
|
|
{
|
|
ClutterActor *stage, *box;
|
|
ClutterLayoutManager *manager;
|
|
int i;
|
|
|
|
g_thread_init (NULL);
|
|
clutter_threads_init ();
|
|
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
|
return 1;
|
|
|
|
stage = clutter_stage_new ();
|
|
clutter_stage_set_title (CLUTTER_STAGE (stage), "Texture Material");
|
|
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
|
|
|
manager = clutter_flow_layout_new (CLUTTER_FLOW_HORIZONTAL);
|
|
box = clutter_box_new (manager);
|
|
clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_WIDTH, -25.0));
|
|
clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_HEIGHT, -25.0));
|
|
clutter_actor_set_position (box, 25.0, 25.0);
|
|
clutter_container_add_actor (CLUTTER_CONTAINER (stage), box);
|
|
|
|
for (i = 0; i < 48; i++)
|
|
{
|
|
ClutterActor *texture = clutter_texture_new ();
|
|
|
|
clutter_texture_set_load_data_async (CLUTTER_TEXTURE (texture), TRUE);
|
|
clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (texture), TRUE);
|
|
clutter_texture_set_from_file (CLUTTER_TEXTURE (texture),
|
|
TESTS_DATADIR "/redhand.png",
|
|
NULL);
|
|
clutter_actor_set_width (texture, 96);
|
|
|
|
clutter_container_add_actor (CLUTTER_CONTAINER (box), texture);
|
|
}
|
|
|
|
clutter_actor_show (stage);
|
|
|
|
clutter_main ();
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|