2009-11-04 06:50:45 -05:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <clutter/clutter.h>
|
|
|
|
|
|
|
|
#include "test-conform-common.h"
|
|
|
|
|
|
|
|
void
|
|
|
|
test_script_single (TestConformSimpleFixture *fixture,
|
|
|
|
gconstpointer dummy)
|
|
|
|
{
|
|
|
|
ClutterScript *script = clutter_script_new ();
|
2009-11-04 10:21:03 -05:00
|
|
|
ClutterColor color = { 0, };
|
2009-11-04 06:50:45 -05:00
|
|
|
GObject *actor = NULL;
|
|
|
|
GError *error = NULL;
|
|
|
|
ClutterActor *rect;
|
|
|
|
gchar *test_file;
|
|
|
|
|
|
|
|
test_file = clutter_test_get_data_file ("test-script-single.json");
|
|
|
|
clutter_script_load_from_file (script, test_file, &error);
|
|
|
|
g_assert (error == NULL);
|
|
|
|
|
|
|
|
actor = clutter_script_get_object (script, "test");
|
|
|
|
g_assert (CLUTTER_IS_RECTANGLE (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);
|
|
|
|
|
2009-11-04 10:21:03 -05:00
|
|
|
clutter_rectangle_get_color (CLUTTER_RECTANGLE (rect), &color);
|
|
|
|
g_assert_cmpint (color.red, ==, 255);
|
|
|
|
g_assert_cmpint (color.green, ==, 0xcc);
|
|
|
|
g_assert_cmpint (color.alpha, ==, 0xff);
|
|
|
|
|
2009-11-04 06:50:45 -05:00
|
|
|
g_object_unref (script);
|
|
|
|
|
|
|
|
clutter_actor_destroy (rect);
|
|
|
|
g_free (test_file);
|
|
|
|
}
|