mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
tests: Clean up interactive test build
The build for interactive tests creates symbolic links for the data under tests/data; it also uses symbolic links for creating "binaries" for each interactive test. This is less than ideal, though. Instead, the tests should build a path to the data files by using a pre-processor define like TESTS_DATADIR; both g_build_filename() and pre-processor string concatenation can be used to generate a valid file name with the full path to the files. The build system should also create wrapper scripts, just like we do inside the conformance test suite, to be able to launch single tests.
This commit is contained in:
parent
c3368c0d15
commit
0b4899ef23
1
.gitignore
vendored
1
.gitignore
vendored
@ -135,6 +135,7 @@ TAGS
|
|||||||
/tests/interactive/test-bin-layout
|
/tests/interactive/test-bin-layout
|
||||||
/tests/interactive/test-flow-layout
|
/tests/interactive/test-flow-layout
|
||||||
/tests/interactive/test-box-layout
|
/tests/interactive/test-box-layout
|
||||||
|
/tests/interactive/stamp-test-interactive
|
||||||
/tests/conform/stamp-test-conformance
|
/tests/conform/stamp-test-conformance
|
||||||
/tests/conform/test-anchors
|
/tests/conform/test-anchors
|
||||||
/tests/conform/test-conformance
|
/tests/conform/test-conformance
|
||||||
|
@ -53,44 +53,53 @@ UNIT_TESTS += test-pixmap.c
|
|||||||
UNIT_TESTS += test-devices.c
|
UNIT_TESTS += test-devices.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#FIXME - this is is a bit of a yukky way of ensuring the tests find our data:
|
|
||||||
test-script.json:
|
|
||||||
$(QUIET_LN)ln -sf $(top_srcdir)/tests/data/test-script.json
|
|
||||||
redhand.png:
|
|
||||||
$(QUIET_LN)ln -sf $(top_srcdir)/tests/data/redhand.png
|
|
||||||
redhand_alpha.png:
|
|
||||||
$(QUIET_LN)ln -sf $(top_srcdir)/tests/data/redhand_alpha.png
|
|
||||||
light0.png:
|
|
||||||
$(QUIET_LN)ln -sf $(top_srcdir)/tests/data/light0.png
|
|
||||||
|
|
||||||
# For convenience, this provides a way to easily run individual unit tests:
|
# For convenience, this provides a way to easily run individual unit tests:
|
||||||
.PHONY: wrappers
|
wrappers: stamp-test-interactive
|
||||||
wrappers: test-interactive$(EXEEXT)
|
@true
|
||||||
$(QUIET_GEN)for i in $(UNIT_TESTS); \
|
stamp-test-interactive: test-interactive$(EXEEXT)
|
||||||
|
@for i in $(UNIT_TESTS); \
|
||||||
do \
|
do \
|
||||||
ln -sf $(top_srcdir)/tests/interactive/wrapper.sh $${i%*.c}; \
|
test_bin=$${i%*.c} ; \
|
||||||
done
|
echo " GEN $$test_bin" ; \
|
||||||
|
( echo "#!/bin/sh" ; \
|
||||||
|
echo "$(top_srcdir)/tests/interactive/wrapper.sh $$test_bin" \
|
||||||
|
) > $$test_bin$(EXEEXT) ; \
|
||||||
|
chmod +x $$test_bin$(EXEEXT) ; \
|
||||||
|
done \
|
||||||
|
&& echo timestamp > $(@F)
|
||||||
|
|
||||||
# NB: BUILT_SOURCES here a misnomer. We aren't building source, just inserting
|
clean-wrappers:
|
||||||
# a phony rule that will generate symlink scripts for running individual tests
|
@for i in $(UNIT_TESTS); \
|
||||||
BUILT_SOURCES = wrappers redhand.png redhand_alpha.png light0.png test-script.json
|
do \
|
||||||
|
test_bin=$${i%*.c} ; \
|
||||||
|
echo " RM $$test_bin"; \
|
||||||
|
rm -f $$test_bin$(EXEEXT); \
|
||||||
|
done \
|
||||||
|
&& rm -f stamp-test-interactive
|
||||||
|
|
||||||
|
.PHONY: wrappers clean-wrappers
|
||||||
|
|
||||||
INCLUDES = \
|
INCLUDES = \
|
||||||
-I$(top_srcdir) \
|
-I$(top_srcdir) \
|
||||||
-I$(top_srcdir)/clutter \
|
-I$(top_srcdir)/clutter \
|
||||||
-I$(top_srcdir)/clutter/cogl \
|
-I$(top_srcdir)/clutter/cogl \
|
||||||
-I$(top_builddir)/clutter \
|
-I$(top_builddir)/clutter \
|
||||||
-I$(top_builddir)/clutter/cogl \
|
-I$(top_builddir)/clutter/cogl
|
||||||
-DG_DISABLE_SINGLE_INCLUDES
|
|
||||||
|
|
||||||
common_ldadd = $(top_builddir)/clutter/libclutter-@CLUTTER_WINSYS@-@CLUTTER_API_VERSION@.la
|
common_ldadd = $(top_builddir)/clutter/libclutter-@CLUTTER_WINSYS@-@CLUTTER_API_VERSION@.la
|
||||||
|
|
||||||
noinst_PROGRAMS = test-interactive
|
noinst_PROGRAMS = test-interactive
|
||||||
|
|
||||||
test_interactive_SOURCES = test-main.c $(UNIT_TESTS)
|
test_interactive_SOURCES = test-main.c $(UNIT_TESTS)
|
||||||
test_interactive_CPPFLAGS = $(CLUTTER_CFLAGS) $(MAINTAINER_CFLAGS)
|
test_interactive_CFLAGS = $(CLUTTER_CFLAGS) $(MAINTAINER_CFLAGS)
|
||||||
|
test_interactive_CPPFLAGS = \
|
||||||
|
-DTESTS_DATADIR=\""$(top_srcdir)/tests/data"\" \
|
||||||
|
-DG_DISABLE_SINGLE_INCLUDES
|
||||||
test_interactive_LDFLAGS = -export-dynamic
|
test_interactive_LDFLAGS = -export-dynamic
|
||||||
test_interactive_LDADD = $(CLUTTER_LIBS) $(common_ldadd)
|
test_interactive_LDADD = $(CLUTTER_LIBS) $(common_ldadd)
|
||||||
|
|
||||||
EXTRA_DIST = wrapper.sh
|
EXTRA_DIST = wrapper.sh
|
||||||
|
|
||||||
|
BUILT_SOURCES = wrappers
|
||||||
|
|
||||||
|
clean-local: clean-wrappers
|
||||||
|
@ -130,14 +130,15 @@ my_sine_wave (ClutterAlpha *alpha,
|
|||||||
G_MODULE_EXPORT int
|
G_MODULE_EXPORT int
|
||||||
test_actor_clone_main (int argc, char *argv[])
|
test_actor_clone_main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
ClutterAlpha *alpha;
|
ClutterAlpha *alpha;
|
||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
ClutterColor stage_color = { 0x61, 0x64, 0x8c, 0xff };
|
ClutterColor stage_color = { 0x61, 0x64, 0x8c, 0xff };
|
||||||
SuperOH *oh;
|
SuperOH *oh;
|
||||||
gint i;
|
gint i;
|
||||||
GError *error;
|
GError *error;
|
||||||
ClutterActor *real_hand, *tmp;
|
ClutterActor *real_hand, *tmp;
|
||||||
ClutterColor clr = { 0xff, 0xff, 0x00, 0xff };
|
ClutterColor clr = { 0xff, 0xff, 0x00, 0xff };
|
||||||
|
gchar *file;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
|
|
||||||
@ -176,12 +177,12 @@ test_actor_clone_main (int argc, char *argv[])
|
|||||||
oh->scaler_1 = clutter_behaviour_scale_new (alpha, 0.5, 0.5, 1.0, 1.0);
|
oh->scaler_1 = clutter_behaviour_scale_new (alpha, 0.5, 0.5, 1.0, 1.0);
|
||||||
oh->scaler_2 = clutter_behaviour_scale_new (alpha, 1.0, 1.0, 0.5, 0.5);
|
oh->scaler_2 = clutter_behaviour_scale_new (alpha, 1.0, 1.0, 0.5, 0.5);
|
||||||
|
|
||||||
tmp = clutter_texture_new_from_file ("redhand.png", &error);
|
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||||
|
tmp = clutter_texture_new_from_file (file, &error);
|
||||||
if (tmp == NULL)
|
if (tmp == NULL)
|
||||||
{
|
g_error ("image load failed: %s", error->message);
|
||||||
g_error ("image load failed: %s", error->message);
|
|
||||||
return EXIT_FAILURE;
|
g_free (file);
|
||||||
}
|
|
||||||
|
|
||||||
clutter_actor_set_size (tmp, 300, 500);
|
clutter_actor_set_size (tmp, 300, 500);
|
||||||
|
|
||||||
|
@ -137,6 +137,7 @@ test_actors_main (int argc, char *argv[])
|
|||||||
gint i;
|
gint i;
|
||||||
GError *error;
|
GError *error;
|
||||||
ClutterActor *real_hand;
|
ClutterActor *real_hand;
|
||||||
|
gchar *file;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
|
|
||||||
@ -177,12 +178,12 @@ test_actors_main (int argc, char *argv[])
|
|||||||
oh->scaler_1 = clutter_behaviour_scale_new (alpha, 0.5, 0.5, 1.0, 1.0);
|
oh->scaler_1 = clutter_behaviour_scale_new (alpha, 0.5, 0.5, 1.0, 1.0);
|
||||||
oh->scaler_2 = clutter_behaviour_scale_new (alpha, 1.0, 1.0, 0.5, 0.5);
|
oh->scaler_2 = clutter_behaviour_scale_new (alpha, 1.0, 1.0, 0.5, 0.5);
|
||||||
|
|
||||||
real_hand = clutter_texture_new_from_file ("redhand.png", &error);
|
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||||
|
real_hand = clutter_texture_new_from_file (file, &error);
|
||||||
if (real_hand == NULL)
|
if (real_hand == NULL)
|
||||||
{
|
g_error ("image load failed: %s", error->message);
|
||||||
g_error ("image load failed: %s", error->message);
|
|
||||||
return EXIT_FAILURE;
|
g_free (file);
|
||||||
}
|
|
||||||
|
|
||||||
/* create a new group to hold multiple actors in a group */
|
/* create a new group to hold multiple actors in a group */
|
||||||
oh->group = clutter_group_new();
|
oh->group = clutter_group_new();
|
||||||
|
@ -76,6 +76,7 @@ test_behave_main (int argc, char *argv[])
|
|||||||
ClutterColor stage_color = { 0xcc, 0xcc, 0xcc, 0xff };
|
ClutterColor stage_color = { 0xcc, 0xcc, 0xcc, 0xff };
|
||||||
ClutterColor rect_bg_color = { 0x33, 0x22, 0x22, 0xff };
|
ClutterColor rect_bg_color = { 0x33, 0x22, 0x22, 0xff };
|
||||||
ClutterColor rect_border_color = { 0, 0, 0, 0 };
|
ClutterColor rect_border_color = { 0, 0, 0, 0 };
|
||||||
|
gchar *file;
|
||||||
int i;
|
int i;
|
||||||
path_t path_type = PATH_POLY;
|
path_t path_type = PATH_POLY;
|
||||||
|
|
||||||
@ -138,13 +139,14 @@ test_behave_main (int argc, char *argv[])
|
|||||||
group = clutter_group_new ();
|
group = clutter_group_new ();
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
|
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
|
||||||
clutter_actor_show (group);
|
clutter_actor_show (group);
|
||||||
|
|
||||||
hand = clutter_texture_new_from_file ("redhand.png", NULL);
|
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||||
|
hand = clutter_texture_new_from_file (file, NULL);
|
||||||
if (hand == NULL)
|
if (hand == NULL)
|
||||||
{
|
g_error("Unable to load '%s'", file);
|
||||||
g_error("pixbuf load failed");
|
|
||||||
return 1;
|
g_free (file);
|
||||||
}
|
|
||||||
clutter_actor_set_position (hand, 0, 0);
|
clutter_actor_set_position (hand, 0, 0);
|
||||||
clutter_actor_show (hand);
|
clutter_actor_show (hand);
|
||||||
|
|
||||||
|
@ -131,9 +131,11 @@ test_bin_layout_main (int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
ClutterActor *tex;
|
ClutterActor *tex;
|
||||||
GError *error;
|
GError *error;
|
||||||
|
gchar *file;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
tex = clutter_texture_new_from_file ("redhand.png", &error);
|
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||||
|
tex = clutter_texture_new_from_file (file, &error);
|
||||||
if (error)
|
if (error)
|
||||||
g_error ("Unable to create texture: %s", error->message);
|
g_error ("Unable to create texture: %s", error->message);
|
||||||
|
|
||||||
@ -147,6 +149,8 @@ test_bin_layout_main (int argc, char *argv[])
|
|||||||
clutter_actor_raise (tex, rect);
|
clutter_actor_raise (tex, rect);
|
||||||
clutter_actor_set_width (tex, 175);
|
clutter_actor_set_width (tex, 175);
|
||||||
clutter_actor_set_name (tex, "texture");
|
clutter_actor_set_name (tex, "texture");
|
||||||
|
|
||||||
|
g_free (file);
|
||||||
}
|
}
|
||||||
|
|
||||||
color = clutter_color_new (g_random_int_range (0, 255),
|
color = clutter_color_new (g_random_int_range (0, 255),
|
||||||
|
@ -289,6 +289,7 @@ test_clip_main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
CallbackData data;
|
CallbackData data;
|
||||||
ClutterActor *stub_actor, *label;
|
ClutterActor *stub_actor, *label;
|
||||||
|
gchar *file;
|
||||||
|
|
||||||
clutter_init (&argc, &argv);
|
clutter_init (&argc, &argv);
|
||||||
|
|
||||||
@ -300,10 +301,12 @@ test_clip_main (int argc, char **argv)
|
|||||||
stub_actor = clutter_rectangle_new ();
|
stub_actor = clutter_rectangle_new ();
|
||||||
clutter_container_add (CLUTTER_CONTAINER (data.stage), stub_actor, NULL);
|
clutter_container_add (CLUTTER_CONTAINER (data.stage), stub_actor, NULL);
|
||||||
|
|
||||||
data.hand = cogl_texture_new_from_file ("redhand.png",
|
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||||
|
data.hand = cogl_texture_new_from_file (file,
|
||||||
COGL_TEXTURE_NONE,
|
COGL_TEXTURE_NONE,
|
||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
NULL);
|
NULL);
|
||||||
|
g_free (file);
|
||||||
|
|
||||||
label = clutter_text_new_with_text ("Sans 12px", instructions);
|
label = clutter_text_new_with_text ("Sans 12px", instructions);
|
||||||
clutter_text_set_line_wrap (CLUTTER_TEXT (label), TRUE);
|
clutter_text_set_line_wrap (CLUTTER_TEXT (label), TRUE);
|
||||||
|
@ -58,6 +58,7 @@ test_cogl_multitexture_main (int argc, char *argv[])
|
|||||||
ClutterColor stage_color = { 0x61, 0x56, 0x56, 0xff };
|
ClutterColor stage_color = { 0x61, 0x56, 0x56, 0xff };
|
||||||
TestMultiLayerMaterialState *state = g_new0 (TestMultiLayerMaterialState, 1);
|
TestMultiLayerMaterialState *state = g_new0 (TestMultiLayerMaterialState, 1);
|
||||||
ClutterGeometry geom;
|
ClutterGeometry geom;
|
||||||
|
gchar **files;
|
||||||
gfloat tex_coords[] =
|
gfloat tex_coords[] =
|
||||||
{
|
{
|
||||||
/* tx1 ty1 tx2 ty2 */
|
/* tx1 ty1 tx2 ty2 */
|
||||||
@ -82,8 +83,14 @@ test_cogl_multitexture_main (int argc, char *argv[])
|
|||||||
g_signal_connect (state->group, "paint",
|
g_signal_connect (state->group, "paint",
|
||||||
G_CALLBACK(material_rectangle_paint), state);
|
G_CALLBACK(material_rectangle_paint), state);
|
||||||
|
|
||||||
|
files = g_new (gchar*, 4);
|
||||||
|
files[0] = g_build_filename (TESTS_DATADIR, "redhand_alpha.png", NULL);
|
||||||
|
files[1] = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||||
|
files[2] = g_build_filename (TESTS_DATADIR, "light0.png", NULL);
|
||||||
|
files[3] = NULL;
|
||||||
|
|
||||||
state->alpha_tex =
|
state->alpha_tex =
|
||||||
cogl_texture_new_from_file ("redhand_alpha.png",
|
cogl_texture_new_from_file (files[0],
|
||||||
COGL_TEXTURE_NO_SLICING,
|
COGL_TEXTURE_NO_SLICING,
|
||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
&error);
|
&error);
|
||||||
@ -91,7 +98,7 @@ test_cogl_multitexture_main (int argc, char *argv[])
|
|||||||
g_critical ("Failed to load redhand_alpha.png: %s", error->message);
|
g_critical ("Failed to load redhand_alpha.png: %s", error->message);
|
||||||
|
|
||||||
state->redhand_tex =
|
state->redhand_tex =
|
||||||
cogl_texture_new_from_file ("redhand.png",
|
cogl_texture_new_from_file (files[1],
|
||||||
COGL_TEXTURE_NO_SLICING,
|
COGL_TEXTURE_NO_SLICING,
|
||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
&error);
|
&error);
|
||||||
@ -99,13 +106,15 @@ test_cogl_multitexture_main (int argc, char *argv[])
|
|||||||
g_critical ("Failed to load redhand.png: %s", error->message);
|
g_critical ("Failed to load redhand.png: %s", error->message);
|
||||||
|
|
||||||
state->light_tex0 =
|
state->light_tex0 =
|
||||||
cogl_texture_new_from_file ("light0.png",
|
cogl_texture_new_from_file (files[2],
|
||||||
COGL_TEXTURE_NO_SLICING,
|
COGL_TEXTURE_NO_SLICING,
|
||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
&error);
|
&error);
|
||||||
if (!state->light_tex0)
|
if (!state->light_tex0)
|
||||||
g_critical ("Failed to load light0.png: %s", error->message);
|
g_critical ("Failed to load light0.png: %s", error->message);
|
||||||
|
|
||||||
|
g_strfreev (files);
|
||||||
|
|
||||||
state->material = cogl_material_new ();
|
state->material = cogl_material_new ();
|
||||||
cogl_material_set_layer (state->material, 0, state->alpha_tex);
|
cogl_material_set_layer (state->material, 0, state->alpha_tex);
|
||||||
cogl_material_set_layer (state->material, 1, state->redhand_tex);
|
cogl_material_set_layer (state->material, 1, state->redhand_tex);
|
||||||
|
@ -140,13 +140,17 @@ static void
|
|||||||
test_coglbox_init (TestCoglbox *self)
|
test_coglbox_init (TestCoglbox *self)
|
||||||
{
|
{
|
||||||
TestCoglboxPrivate *priv;
|
TestCoglboxPrivate *priv;
|
||||||
|
gchar *file;
|
||||||
|
|
||||||
self->priv = priv = TEST_COGLBOX_GET_PRIVATE(self);
|
self->priv = priv = TEST_COGLBOX_GET_PRIVATE(self);
|
||||||
|
|
||||||
printf ("Loading redhand.png\n");
|
printf ("Loading redhand.png\n");
|
||||||
priv->texhand_id = cogl_texture_new_from_file ("redhand.png",
|
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||||
|
priv->texhand_id = cogl_texture_new_from_file (file,
|
||||||
COGL_TEXTURE_NONE,
|
COGL_TEXTURE_NONE,
|
||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
NULL);
|
NULL);
|
||||||
|
g_free (file);
|
||||||
|
|
||||||
printf ("Creating texture with size\n");
|
printf ("Creating texture with size\n");
|
||||||
priv->texture_id = cogl_texture_new_with_size (200, 200,
|
priv->texture_id = cogl_texture_new_with_size (200, 200,
|
||||||
|
@ -141,27 +141,37 @@ static void
|
|||||||
test_coglbox_init (TestCoglbox *self)
|
test_coglbox_init (TestCoglbox *self)
|
||||||
{
|
{
|
||||||
TestCoglboxPrivate *priv;
|
TestCoglboxPrivate *priv;
|
||||||
|
gchar *file;
|
||||||
|
|
||||||
self->priv = priv = TEST_COGLBOX_GET_PRIVATE(self);
|
self->priv = priv = TEST_COGLBOX_GET_PRIVATE(self);
|
||||||
|
|
||||||
|
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||||
|
|
||||||
priv->cogl_tex_id[0] =
|
priv->cogl_tex_id[0] =
|
||||||
cogl_texture_new_from_file ("redhand.png",
|
cogl_texture_new_from_file (file,
|
||||||
COGL_TEXTURE_NONE,
|
COGL_TEXTURE_NONE,
|
||||||
COGL_PIXEL_FORMAT_ANY, NULL);
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
|
NULL);
|
||||||
|
|
||||||
priv->cogl_tex_id[1] =
|
priv->cogl_tex_id[1] =
|
||||||
cogl_texture_new_from_file ("redhand.png",
|
cogl_texture_new_from_file (file,
|
||||||
COGL_TEXTURE_NONE,
|
COGL_TEXTURE_NONE,
|
||||||
COGL_PIXEL_FORMAT_BGRA_8888, NULL);
|
COGL_PIXEL_FORMAT_BGRA_8888,
|
||||||
|
NULL);
|
||||||
|
|
||||||
priv->cogl_tex_id[2] =
|
priv->cogl_tex_id[2] =
|
||||||
cogl_texture_new_from_file ("redhand.png",
|
cogl_texture_new_from_file (file,
|
||||||
COGL_TEXTURE_NONE,
|
COGL_TEXTURE_NONE,
|
||||||
COGL_PIXEL_FORMAT_ARGB_8888, NULL);
|
COGL_PIXEL_FORMAT_ARGB_8888,
|
||||||
|
NULL);
|
||||||
|
|
||||||
priv->cogl_tex_id[3] =
|
priv->cogl_tex_id[3] =
|
||||||
cogl_texture_new_from_file ("redhand.png",
|
cogl_texture_new_from_file (file,
|
||||||
COGL_TEXTURE_NONE,
|
COGL_TEXTURE_NONE,
|
||||||
COGL_PIXEL_FORMAT_G_8, NULL);
|
COGL_PIXEL_FORMAT_G_8,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
g_free (file);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -126,22 +126,26 @@ test_coglbox_init (TestCoglbox *self)
|
|||||||
guchar *data;
|
guchar *data;
|
||||||
gint x,y,t;
|
gint x,y,t;
|
||||||
guchar *pixel;
|
guchar *pixel;
|
||||||
|
gchar *file;
|
||||||
|
|
||||||
self->priv = priv = TEST_COGLBOX_GET_PRIVATE(self);
|
self->priv = priv = TEST_COGLBOX_GET_PRIVATE(self);
|
||||||
|
|
||||||
/* Load image from file */
|
/* Load image from file */
|
||||||
|
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||||
priv->cogl_tex_id[0] =
|
priv->cogl_tex_id[0] =
|
||||||
cogl_texture_new_from_file ("redhand.png",
|
cogl_texture_new_from_file (file,
|
||||||
COGL_TEXTURE_NONE,
|
COGL_TEXTURE_NONE,
|
||||||
COGL_PIXEL_FORMAT_ANY, NULL);
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
|
NULL);
|
||||||
|
|
||||||
if (priv->cogl_tex_id[0] == COGL_INVALID_HANDLE)
|
if (priv->cogl_tex_id[0] == COGL_INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
printf ("Failed loading redhand.png image!\n");
|
printf ("Failed loading redhand.png image!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free (file);
|
||||||
|
|
||||||
printf("Texture loaded from file.\n");
|
printf("Texture loaded from file.\n");
|
||||||
|
|
||||||
/* Obtain pixel data */
|
/* Obtain pixel data */
|
||||||
|
@ -248,13 +248,16 @@ test_coglbox_init (TestCoglbox *self)
|
|||||||
{
|
{
|
||||||
TestCoglboxPrivate *priv;
|
TestCoglboxPrivate *priv;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
gchar *file;
|
||||||
|
|
||||||
self->priv = priv = TEST_COGLBOX_GET_PRIVATE (self);
|
self->priv = priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||||
|
|
||||||
priv->use_linear_filtering = FALSE;
|
priv->use_linear_filtering = FALSE;
|
||||||
priv->use_sliced = FALSE;
|
priv->use_sliced = FALSE;
|
||||||
|
|
||||||
|
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||||
priv->sliced_tex =
|
priv->sliced_tex =
|
||||||
cogl_texture_new_from_file ("redhand.png",
|
cogl_texture_new_from_file (file,
|
||||||
COGL_TEXTURE_NONE,
|
COGL_TEXTURE_NONE,
|
||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
&error);
|
&error);
|
||||||
@ -271,7 +274,7 @@ test_coglbox_init (TestCoglbox *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
priv->not_sliced_tex =
|
priv->not_sliced_tex =
|
||||||
cogl_texture_new_from_file ("redhand.png",
|
cogl_texture_new_from_file (file,
|
||||||
COGL_TEXTURE_NO_SLICING,
|
COGL_TEXTURE_NO_SLICING,
|
||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
&error);
|
&error);
|
||||||
@ -285,6 +288,8 @@ test_coglbox_init (TestCoglbox *self)
|
|||||||
else
|
else
|
||||||
g_warning ("Texture loading failed: <unknown>");
|
g_warning ("Texture loading failed: <unknown>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free (file);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -138,12 +138,16 @@ static void
|
|||||||
test_coglbox_init (TestCoglbox *self)
|
test_coglbox_init (TestCoglbox *self)
|
||||||
{
|
{
|
||||||
TestCoglboxPrivate *priv;
|
TestCoglboxPrivate *priv;
|
||||||
|
gchar *file;
|
||||||
|
|
||||||
self->priv = priv = TEST_COGLBOX_GET_PRIVATE(self);
|
self->priv = priv = TEST_COGLBOX_GET_PRIVATE(self);
|
||||||
|
|
||||||
priv->cogl_tex_id = cogl_texture_new_from_file ("redhand.png",
|
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||||
|
priv->cogl_tex_id = cogl_texture_new_from_file (file,
|
||||||
COGL_TEXTURE_NONE,
|
COGL_TEXTURE_NONE,
|
||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
NULL);
|
NULL);
|
||||||
|
g_free (file);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -139,7 +139,10 @@ test_depth_main (int argc, char *argv[])
|
|||||||
clutter_actor_show (label);
|
clutter_actor_show (label);
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
hand = clutter_texture_new_from_file ("redhand.png", &error);
|
hand = clutter_texture_new_from_file (TESTS_DATADIR
|
||||||
|
G_DIR_SEPARATOR_S
|
||||||
|
"redhand.png",
|
||||||
|
&error);
|
||||||
if (error)
|
if (error)
|
||||||
g_error ("Unable to load redhand.png: %s", error->message);
|
g_error ("Unable to load redhand.png: %s", error->message);
|
||||||
clutter_actor_set_position (hand, 240, 100);
|
clutter_actor_set_position (hand, 240, 100);
|
||||||
|
@ -80,7 +80,10 @@ test_devices_main (int argc, char **argv)
|
|||||||
g_print ("got a pointer device with id %d...\n",
|
g_print ("got a pointer device with id %d...\n",
|
||||||
clutter_input_device_get_device_id (device));
|
clutter_input_device_get_device_id (device));
|
||||||
|
|
||||||
hand = clutter_texture_new_from_file ("redhand.png", NULL);
|
hand = clutter_texture_new_from_file (TESTS_DATADIR
|
||||||
|
G_DIR_SEPARATOR_S
|
||||||
|
"redhand.png",
|
||||||
|
NULL);
|
||||||
g_hash_table_insert (app->devices, device, hand);
|
g_hash_table_insert (app->devices, device, hand);
|
||||||
|
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), hand);
|
clutter_container_add_actor (CLUTTER_CONTAINER (stage), hand);
|
||||||
|
@ -13,15 +13,20 @@ ClutterActor *
|
|||||||
make_source (void)
|
make_source (void)
|
||||||
{
|
{
|
||||||
ClutterActor *source, *actor;
|
ClutterActor *source, *actor;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
gchar *file;
|
||||||
|
|
||||||
ClutterColor yellow = {0xff, 0xff, 0x00, 0xff};
|
ClutterColor yellow = {0xff, 0xff, 0x00, 0xff};
|
||||||
|
|
||||||
source = clutter_group_new();
|
source = clutter_group_new ();
|
||||||
actor = clutter_texture_new_from_file ("redhand.png", &error);
|
|
||||||
|
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||||
|
actor = clutter_texture_new_from_file (file, &error);
|
||||||
if (!actor)
|
if (!actor)
|
||||||
g_error("pixbuf load failed: %s", error ? error->message : "Unknown");
|
g_error("pixbuf load failed: %s", error ? error->message : "Unknown");
|
||||||
|
|
||||||
|
g_free (file);
|
||||||
|
|
||||||
clutter_group_add (source, actor);
|
clutter_group_add (source, actor);
|
||||||
|
|
||||||
actor = clutter_text_new_with_text ("Sans Bold 50px", "Clutter");
|
actor = clutter_text_new_with_text ("Sans Bold 50px", "Clutter");
|
||||||
|
@ -769,7 +769,10 @@ test_layout_main (int argc, char *argv[])
|
|||||||
clutter_actor_set_position (box, 20, 20);
|
clutter_actor_set_position (box, 20, 20);
|
||||||
clutter_actor_set_size (box, 350, -1);
|
clutter_actor_set_size (box, 350, -1);
|
||||||
|
|
||||||
icon = clutter_texture_new_from_file ("redhand.png", &error);
|
icon = clutter_texture_new_from_file (TESTS_DATADIR
|
||||||
|
G_DIR_SEPARATOR_S
|
||||||
|
"redhand.png",
|
||||||
|
&error);
|
||||||
if (error)
|
if (error)
|
||||||
g_error ("Unable to load 'redhand.png': %s", error->message);
|
g_error ("Unable to load 'redhand.png': %s", error->message);
|
||||||
|
|
||||||
|
@ -38,7 +38,10 @@ on_button_press (ClutterActor *actor,
|
|||||||
clutter_stage_set_color (CLUTTER_STAGE (new_stage), &color);
|
clutter_stage_set_color (CLUTTER_STAGE (new_stage), &color);
|
||||||
clutter_actor_set_size (new_stage, 320, 240);
|
clutter_actor_set_size (new_stage, 320, 240);
|
||||||
|
|
||||||
tex = clutter_texture_new_from_file ("redhand.png", NULL);
|
tex = clutter_texture_new_from_file (TESTS_DATADIR
|
||||||
|
G_DIR_SEPARATOR_S
|
||||||
|
"redhand.png",
|
||||||
|
NULL);
|
||||||
|
|
||||||
if (!tex)
|
if (!tex)
|
||||||
g_error ("pixbuf load failed");
|
g_error ("pixbuf load failed");
|
||||||
|
@ -224,7 +224,10 @@ test_paint_wrapper_main (int argc, char *argv[])
|
|||||||
oh->scaler_1 = clutter_behaviour_scale_new (alpha, 0.5, 0.5, 1.0, 1.0);
|
oh->scaler_1 = clutter_behaviour_scale_new (alpha, 0.5, 0.5, 1.0, 1.0);
|
||||||
oh->scaler_2 = clutter_behaviour_scale_new (alpha, 1.0, 1.0, 0.5, 0.5);
|
oh->scaler_2 = clutter_behaviour_scale_new (alpha, 1.0, 1.0, 0.5, 0.5);
|
||||||
|
|
||||||
real_hand = clutter_texture_new_from_file ("redhand.png", &error);
|
real_hand = clutter_texture_new_from_file (TESTS_DATADIR
|
||||||
|
G_DIR_SEPARATOR_S
|
||||||
|
"redhand.png",
|
||||||
|
&error);
|
||||||
if (real_hand == NULL)
|
if (real_hand == NULL)
|
||||||
{
|
{
|
||||||
g_error ("image load failed: %s", error->message);
|
g_error ("image load failed: %s", error->message);
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/extensions/Xcomposite.h>
|
#include <X11/extensions/Xcomposite.h>
|
||||||
|
|
||||||
#define IMAGE "redhand.png"
|
#define IMAGE TESTS_DATADIR G_DIR_SEPARATOR_S "redhand.png"
|
||||||
|
|
||||||
# ifdef USE_GDKPIXBUF
|
# ifdef USE_GDKPIXBUF
|
||||||
# include <gdk-pixbuf/gdk-pixbuf.h>
|
# include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
|
@ -16,6 +16,7 @@ test_rotate_main (int argc, char *argv[])
|
|||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
ClutterActor *hand, *label;
|
ClutterActor *hand, *label;
|
||||||
ClutterColor stage_color = { 0xcc, 0xcc, 0xcc, 0xff };
|
ClutterColor stage_color = { 0xcc, 0xcc, 0xcc, 0xff };
|
||||||
|
gchar *file;
|
||||||
|
|
||||||
clutter_init (&argc, &argv);
|
clutter_init (&argc, &argv);
|
||||||
|
|
||||||
@ -25,9 +26,12 @@ test_rotate_main (int argc, char *argv[])
|
|||||||
&stage_color);
|
&stage_color);
|
||||||
|
|
||||||
/* Make a hand */
|
/* Make a hand */
|
||||||
hand = clutter_texture_new_from_file ("redhand.png", NULL);
|
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||||
|
hand = clutter_texture_new_from_file (file, NULL);
|
||||||
if (!hand)
|
if (!hand)
|
||||||
g_error("pixbuf load failed");
|
g_error("Unable to load '%s'", file);
|
||||||
|
|
||||||
|
g_free (file);
|
||||||
|
|
||||||
clutter_actor_set_position (hand, 240, 140);
|
clutter_actor_set_position (hand, 240, 140);
|
||||||
clutter_actor_show (hand);
|
clutter_actor_show (hand);
|
||||||
|
@ -136,6 +136,7 @@ test_script_main (int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
GObject *stage, *blue_button, *red_button;
|
GObject *stage, *blue_button, *red_button;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
gchar *file;
|
||||||
gint res;
|
gint res;
|
||||||
|
|
||||||
clutter_init (&argc, &argv);
|
clutter_init (&argc, &argv);
|
||||||
@ -152,17 +153,21 @@ test_script_main (int argc, char *argv[])
|
|||||||
g_object_unref (script);
|
g_object_unref (script);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
clutter_script_load_from_file (script, "test-script.json", &error);
|
file = g_build_filename (TESTS_DATADIR, "test-script.json", NULL);
|
||||||
|
clutter_script_load_from_file (script, file, &error);
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
g_print ("*** Error:\n"
|
g_print ("*** Error:\n"
|
||||||
"*** %s\n", error->message);
|
"*** %s\n", error->message);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
g_object_unref (script);
|
g_object_unref (script);
|
||||||
|
g_free (file);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free (file);
|
||||||
|
|
||||||
merge_id = clutter_script_load_from_data (script, test_unmerge, -1, &error);
|
merge_id = clutter_script_load_from_data (script, test_unmerge, -1, &error);
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
|
@ -304,11 +304,12 @@ timeout_cb (gpointer data)
|
|||||||
G_MODULE_EXPORT gint
|
G_MODULE_EXPORT gint
|
||||||
test_shader_main (gint argc, gchar *argv[])
|
test_shader_main (gint argc, gchar *argv[])
|
||||||
{
|
{
|
||||||
ClutterActor *actor;
|
ClutterActor *actor;
|
||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
ClutterColor stage_color = { 0x61, 0x64, 0x8c, 0xff };
|
ClutterColor stage_color = { 0x61, 0x64, 0x8c, 0xff };
|
||||||
ClutterShader *shader;
|
ClutterShader *shader;
|
||||||
GError *error;
|
GError *error;
|
||||||
|
gchar *file;
|
||||||
|
|
||||||
clutter_init (&argc, &argv);
|
clutter_init (&argc, &argv);
|
||||||
|
|
||||||
@ -338,45 +339,50 @@ test_shader_main (gint argc, gchar *argv[])
|
|||||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Shader Test");
|
clutter_stage_set_title (CLUTTER_STAGE (stage), "Shader Test");
|
||||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
|
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
|
||||||
|
|
||||||
|
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||||
|
|
||||||
#ifndef TEST_GROUP
|
#ifndef TEST_GROUP
|
||||||
actor = g_object_new (CLUTTER_TYPE_TEXTURE,
|
actor = clutter_texture_new_from_file (file, &error);
|
||||||
"filename", "redhand.png",
|
|
||||||
"disable-slicing", TRUE,
|
|
||||||
NULL);
|
|
||||||
actor = clutter_texture_new_from_file ("redhand.png", &error);
|
|
||||||
if (!actor)
|
if (!actor)
|
||||||
g_error("pixbuf load failed: %s", error ? error->message : "Unknown");
|
g_error("pixbuf load failed: %s", error ? error->message : "Unknown");
|
||||||
|
|
||||||
#else
|
#else
|
||||||
actor = clutter_group_new ();
|
actor = clutter_group_new ();
|
||||||
{
|
|
||||||
ClutterActor *child1, *child2, *child3, *child4;
|
|
||||||
ClutterColor color = { 0xff, 0x22, 0x66, 0x99 };
|
|
||||||
|
|
||||||
child1 = clutter_texture_new_from_file ("redhand.png", &error);
|
{
|
||||||
if (!child1)
|
ClutterActor *child1, *child2, *child3, *child4;
|
||||||
g_error("pixbuf load failed: %s", error ? error->message : "Unknown");
|
ClutterColor color = { 0xff, 0x22, 0x66, 0x99 };
|
||||||
child2 = clutter_texture_new_from_file ("redhand.png", &error);
|
|
||||||
if (!child2)
|
|
||||||
g_error("pixbuf load failed: %s", error ? error->message : "Unknown");
|
|
||||||
child3 = clutter_rectangle_new ();
|
|
||||||
child4 = clutter_text_new_with_text ("Sans 20px", "Shady stuff");
|
|
||||||
|
|
||||||
clutter_rectangle_set_color (child3, &color);
|
child1 = clutter_texture_new_from_file (file, &error);
|
||||||
clutter_actor_set_size (child3, 50, 50);
|
if (!child1)
|
||||||
clutter_actor_set_position (child1, 0, 0);
|
g_error("pixbuf load failed: %s", error ? error->message : "Unknown");
|
||||||
clutter_actor_set_position (child2, 50, 100);
|
|
||||||
clutter_actor_set_position (child3, 30, -30);
|
|
||||||
clutter_actor_set_position (child4, -50, 20);
|
|
||||||
|
|
||||||
clutter_group_add (CLUTTER_GROUP (actor), child1);
|
child2 = clutter_texture_new_from_file (file, &error);
|
||||||
clutter_group_add (CLUTTER_GROUP (actor), child2);
|
if (!child2)
|
||||||
clutter_group_add (CLUTTER_GROUP (actor), child3);
|
g_error("pixbuf load failed: %s", error ? error->message : "Unknown");
|
||||||
clutter_group_add (CLUTTER_GROUP (actor), child4);
|
|
||||||
|
|
||||||
clutter_actor_show_all (actor);
|
child3 = clutter_rectangle_new ();
|
||||||
}
|
child4 = clutter_text_new_with_text ("Sans 20px", "Shady stuff");
|
||||||
#endif
|
|
||||||
|
clutter_rectangle_set_color (CLUTTER_RECTANGLE (child3), &color);
|
||||||
|
clutter_actor_set_size (child3, 50, 50);
|
||||||
|
|
||||||
|
clutter_actor_set_position (child1, 0, 0);
|
||||||
|
clutter_actor_set_position (child2, 50, 100);
|
||||||
|
clutter_actor_set_position (child3, 30, -30);
|
||||||
|
clutter_actor_set_position (child4, -50, 20);
|
||||||
|
|
||||||
|
clutter_container_add (CLUTTER_CONTAINER (actor),
|
||||||
|
child1,
|
||||||
|
child2,
|
||||||
|
child3,
|
||||||
|
child4,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
clutter_actor_show_all (actor);
|
||||||
|
}
|
||||||
|
#endif /* !TEST_GROUP */
|
||||||
|
|
||||||
|
g_free (file);
|
||||||
|
|
||||||
clutter_actor_set_shader (actor, shader);
|
clutter_actor_set_shader (actor, shader);
|
||||||
clutter_actor_set_position (actor, 100, 100);
|
clutter_actor_set_position (actor, 100, 100);
|
||||||
|
@ -38,17 +38,17 @@ on_load_finished (ClutterTexture *texture,
|
|||||||
g_print ("%s successful\n", load_str);
|
g_print ("%s successful\n", load_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void size_change_cb (ClutterTexture *texture,
|
static void
|
||||||
gint width,
|
size_change_cb (ClutterTexture *texture,
|
||||||
gint height,
|
gint width,
|
||||||
gpointer user_data)
|
gint height,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
clutter_actor_set_size (user_data, width, height);
|
clutter_actor_set_size (user_data, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
const gchar *path = "redhand.png";
|
static
|
||||||
|
gboolean task (gpointer user_data)
|
||||||
static gboolean task (gpointer foo)
|
|
||||||
{
|
{
|
||||||
ClutterTimeline *timeline;
|
ClutterTimeline *timeline;
|
||||||
ClutterAlpha *alpha;
|
ClutterAlpha *alpha;
|
||||||
@ -56,18 +56,11 @@ static gboolean task (gpointer foo)
|
|||||||
ClutterActor *image[4];
|
ClutterActor *image[4];
|
||||||
ClutterActor *clone[4];
|
ClutterActor *clone[4];
|
||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
|
gchar *path = user_data;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
stage = clutter_stage_get_default ();
|
stage = clutter_stage_get_default ();
|
||||||
|
|
||||||
#if 0
|
|
||||||
for (i=0;i<4;i++)
|
|
||||||
image[i] = g_object_new (CLUTTER_TYPE_TEXTURE,
|
|
||||||
"filename", path,
|
|
||||||
"load-async", TRUE,
|
|
||||||
NULL);
|
|
||||||
#else
|
|
||||||
/*for (i=0;i<4;i++)*/
|
|
||||||
image[0] = g_object_new (CLUTTER_TYPE_TEXTURE, NULL);
|
image[0] = g_object_new (CLUTTER_TYPE_TEXTURE, NULL);
|
||||||
g_signal_connect (image[0], "load-finished",
|
g_signal_connect (image[0], "load-finished",
|
||||||
G_CALLBACK (on_load_finished),
|
G_CALLBACK (on_load_finished),
|
||||||
@ -85,19 +78,14 @@ static gboolean task (gpointer foo)
|
|||||||
g_signal_connect (image[2], "load-finished",
|
g_signal_connect (image[2], "load-finished",
|
||||||
G_CALLBACK (on_load_finished),
|
G_CALLBACK (on_load_finished),
|
||||||
GINT_TO_POINTER (LOAD_ASYNC));
|
GINT_TO_POINTER (LOAD_ASYNC));
|
||||||
#endif
|
|
||||||
|
|
||||||
for (i=0;i<3;i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
clutter_texture_set_from_file (CLUTTER_TEXTURE (image[i]), path, NULL);
|
||||||
clutter_texture_set_from_file (CLUTTER_TEXTURE (image[i]), path, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=0;i<3;i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
clutter_container_add (CLUTTER_CONTAINER (stage), image[i], NULL);
|
||||||
clutter_container_add (CLUTTER_CONTAINER (stage), image[i], NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=0;i<3;i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
clutter_actor_set_position (image[i], 50+i*100, 0+i*50);
|
clutter_actor_set_position (image[i], 50+i*100, 0+i*50);
|
||||||
clone[i]=clutter_clone_new (image[i]);
|
clone[i]=clutter_clone_new (image[i]);
|
||||||
@ -107,7 +95,7 @@ static gboolean task (gpointer foo)
|
|||||||
clutter_actor_set_position (clone[i], 50+i*100, 150+i*50+100);
|
clutter_actor_set_position (clone[i], 50+i*100, 150+i*50+100);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i<3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
timeline = clutter_timeline_new (5000);
|
timeline = clutter_timeline_new (5000);
|
||||||
alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR);
|
alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR);
|
||||||
@ -115,6 +103,7 @@ static gboolean task (gpointer foo)
|
|||||||
clutter_behaviour_apply (depth_behavior, image[i]);
|
clutter_behaviour_apply (depth_behavior, image[i]);
|
||||||
clutter_timeline_start (timeline);
|
clutter_timeline_start (timeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,9 +111,10 @@ static gboolean task (gpointer foo)
|
|||||||
G_MODULE_EXPORT gint
|
G_MODULE_EXPORT gint
|
||||||
test_texture_async_main (int argc, char *argv[])
|
test_texture_async_main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
ClutterColor stage_color = { 0x12, 0x34, 0x56, 0xff };
|
ClutterColor stage_color = { 0x12, 0x34, 0x56, 0xff };
|
||||||
GError *error;
|
GError *error;
|
||||||
|
gchar *path;
|
||||||
|
|
||||||
clutter_init (&argc, &argv);
|
clutter_init (&argc, &argv);
|
||||||
|
|
||||||
@ -139,13 +129,16 @@ test_texture_async_main (int argc, char *argv[])
|
|||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
|
|
||||||
path = argv[1]?argv[1]:"redhand.png";
|
path = (argc > 0)
|
||||||
|
? g_strdup (argv[1])
|
||||||
|
: g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||||
|
|
||||||
g_timeout_add (500, task, NULL);
|
g_timeout_add (500, task, path);
|
||||||
|
|
||||||
clutter_main ();
|
clutter_main ();
|
||||||
|
|
||||||
|
g_free (path);
|
||||||
|
|
||||||
/*g_object_unref (depth_behavior);
|
/*g_object_unref (depth_behavior);
|
||||||
g_object_unref (timeline);*/
|
g_object_unref (timeline);*/
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ test_texture_quality_main (int argc, char *argv[])
|
|||||||
ClutterColor stage_color = { 0x12, 0x34, 0x56, 0xff };
|
ClutterColor stage_color = { 0x12, 0x34, 0x56, 0xff };
|
||||||
ClutterFog stage_fog = { 10.0, -50.0 };
|
ClutterFog stage_fog = { 10.0, -50.0 };
|
||||||
GError *error;
|
GError *error;
|
||||||
|
gchar *file;
|
||||||
|
|
||||||
clutter_init (&argc, &argv);
|
clutter_init (&argc, &argv);
|
||||||
|
|
||||||
@ -62,14 +63,20 @@ test_texture_quality_main (int argc, char *argv[])
|
|||||||
"button-press-event", G_CALLBACK (clutter_main_quit),
|
"button-press-event", G_CALLBACK (clutter_main_quit),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
if (argc < 1)
|
||||||
|
g_print ("Hint: the redhand.png isn't a good test image for this test.\n"
|
||||||
|
"This test can take any image file as an argument\n");
|
||||||
|
|
||||||
|
file = (argc > 0)
|
||||||
|
? g_strdup (argv[1])
|
||||||
|
: g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
image = clutter_texture_new_from_file (argv[1]?argv[1]:"redhand.png", &error);
|
image = clutter_texture_new_from_file (file, &error);
|
||||||
if (error)
|
if (error)
|
||||||
g_error ("Unable to load image: %s", error->message);
|
g_error ("Unable to load image: %s", error->message);
|
||||||
|
|
||||||
if (!argv[1])
|
g_free (file);
|
||||||
g_print ("Hint: the redhand.png isn't a good test image for this test.\n"
|
|
||||||
"This test can take any clutter loadable image as an argument\n");
|
|
||||||
|
|
||||||
/* center the image */
|
/* center the image */
|
||||||
clutter_actor_set_position (image,
|
clutter_actor_set_position (image,
|
||||||
|
@ -16,6 +16,7 @@ test_viewport_main (int argc, char *argv[])
|
|||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
ClutterActor *hand;
|
ClutterActor *hand;
|
||||||
ClutterColor stage_color = { 0xcc, 0xcc, 0xcc, 0xff };
|
ClutterColor stage_color = { 0xcc, 0xcc, 0xcc, 0xff };
|
||||||
|
gchar *file;
|
||||||
|
|
||||||
clutter_init (&argc, &argv);
|
clutter_init (&argc, &argv);
|
||||||
|
|
||||||
@ -25,9 +26,12 @@ test_viewport_main (int argc, char *argv[])
|
|||||||
&stage_color);
|
&stage_color);
|
||||||
|
|
||||||
/* Make a hand */
|
/* Make a hand */
|
||||||
hand = clutter_texture_new_from_file ("redhand.png", NULL);
|
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||||
|
hand = clutter_texture_new_from_file (file, NULL);
|
||||||
if (!hand)
|
if (!hand)
|
||||||
g_error("pixbuf load failed");
|
g_error("Unable to load image '%s'", file);
|
||||||
|
|
||||||
|
g_free (file);
|
||||||
|
|
||||||
clutter_actor_set_position (hand, 300, 200);
|
clutter_actor_set_position (hand, 300, 200);
|
||||||
clutter_actor_set_clip (hand, 20, 21, 132, 170);
|
clutter_actor_set_clip (hand, 20, 21, 132, 170);
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
UNIT_TEST=`basename $0`
|
UNIT_TEST=$1
|
||||||
|
|
||||||
|
shift
|
||||||
|
|
||||||
echo "Running ./test-interactive $UNIT_TEST $@"
|
echo "Running ./test-interactive $UNIT_TEST $@"
|
||||||
echo ""
|
echo ""
|
||||||
|
Loading…
Reference in New Issue
Block a user