mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
conformance: Add more tests
Add back some deprecated and general purpose API tests. These are the ones that were written already pretty much conforming to the GTest API and style, and thus require minimal porting.
This commit is contained in:
parent
7ec337f26f
commit
526d0ea884
@ -12,6 +12,7 @@ AM_CPPFLAGS = \
|
||||
$(CLUTTER_DEBUG_CFLAGS) \
|
||||
$(CLUTTER_PROFILE_CFLAGS)
|
||||
|
||||
# Basic actor API
|
||||
actor_tests = \
|
||||
actor-anchors \
|
||||
actor-destroy \
|
||||
@ -28,10 +29,29 @@ actor_tests = \
|
||||
actor-size \
|
||||
$(NULL)
|
||||
|
||||
general_tests = \
|
||||
# Actor classes
|
||||
classes_tests = \
|
||||
text \
|
||||
$(NULL)
|
||||
|
||||
# General API
|
||||
general_tests = \
|
||||
binding-pool \
|
||||
color \
|
||||
events-touch \
|
||||
interval \
|
||||
model \
|
||||
script-parser \
|
||||
units \
|
||||
$(NULL)
|
||||
|
||||
# Test for deprecated functionality
|
||||
deprecated_tests = \
|
||||
animator \
|
||||
behaviours \
|
||||
group \
|
||||
rectangle \
|
||||
texture \
|
||||
$(NULL)
|
||||
|
||||
test_programs = $(actor_tests) $(general_tests) $(deprecated_tests)
|
||||
@ -54,3 +74,16 @@ script_tests = \
|
||||
test-script-single.json \
|
||||
test-script-timeline-markers.json \
|
||||
test-state-1.json
|
||||
|
||||
# simple rules for generating a Git ignore file for the conformance test suite
|
||||
$(srcdir)/.gitignore: Makefile
|
||||
$(AM_V_GEN)( echo "/*.trs" ; \
|
||||
echo "/*.log" ; \
|
||||
echo "/.gitignore" ; \
|
||||
for p in $(test_programs); do \
|
||||
echo "/$$p" ; \
|
||||
done ) > $(@F)
|
||||
|
||||
gitignore: $(srcdir)/.gitignore
|
||||
|
||||
all-am: gitignore
|
||||
|
@ -1,10 +1,8 @@
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include "test-conform-common.h"
|
||||
|
||||
void
|
||||
animator_multi_properties (TestConformSimpleFixture *fixture,
|
||||
gconstpointer dummy)
|
||||
static void
|
||||
animator_multi_properties (void)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
GObject *animator = NULL, *foo = NULL;
|
||||
@ -14,16 +12,15 @@ animator_multi_properties (TestConformSimpleFixture *fixture,
|
||||
ClutterAnimatorKey *key;
|
||||
GValue value = { 0, };
|
||||
|
||||
test_file = clutter_test_get_data_file ("test-animator-3.json");
|
||||
test_file = g_test_build_filename (G_TEST_DIST,
|
||||
"scripts",
|
||||
"test-animator-3.json",
|
||||
NULL);
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_print ("Error: %s", error->message);
|
||||
|
||||
#if GLIB_CHECK_VERSION (2, 20, 0)
|
||||
g_assert_no_error (error);
|
||||
#else
|
||||
g_assert (error == NULL);
|
||||
#endif
|
||||
|
||||
foo = clutter_script_get_object (script, "foo");
|
||||
g_assert (G_IS_OBJECT (foo));
|
||||
@ -105,9 +102,8 @@ animator_multi_properties (TestConformSimpleFixture *fixture,
|
||||
g_free (test_file);
|
||||
}
|
||||
|
||||
void
|
||||
animator_properties (TestConformSimpleFixture *fixture,
|
||||
gconstpointer dummy)
|
||||
static void
|
||||
animator_properties (void)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
GObject *animator = NULL;
|
||||
@ -117,16 +113,15 @@ animator_properties (TestConformSimpleFixture *fixture,
|
||||
ClutterAnimatorKey *key;
|
||||
GValue value = { 0, };
|
||||
|
||||
test_file = clutter_test_get_data_file ("test-animator-2.json");
|
||||
test_file = g_test_build_filename (G_TEST_DIST,
|
||||
"scripts",
|
||||
"test-animator-2.json",
|
||||
NULL);
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_print ("Error: %s", error->message);
|
||||
|
||||
#if GLIB_CHECK_VERSION (2, 20, 0)
|
||||
g_assert_no_error (error);
|
||||
#else
|
||||
g_assert (error == NULL);
|
||||
#endif
|
||||
|
||||
animator = clutter_script_get_object (script, "animator");
|
||||
g_assert (CLUTTER_IS_ANIMATOR (animator));
|
||||
@ -168,9 +163,8 @@ animator_properties (TestConformSimpleFixture *fixture,
|
||||
g_free (test_file);
|
||||
}
|
||||
|
||||
void
|
||||
animator_base (TestConformSimpleFixture *fixture,
|
||||
gconstpointer dummy)
|
||||
static void
|
||||
animator_base (void)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
GObject *animator = NULL;
|
||||
@ -178,16 +172,15 @@ animator_base (TestConformSimpleFixture *fixture,
|
||||
guint duration = 0;
|
||||
gchar *test_file;
|
||||
|
||||
test_file = clutter_test_get_data_file ("test-animator-1.json");
|
||||
test_file = g_test_build_filename (G_TEST_DIST,
|
||||
"scripts",
|
||||
"test-animator-1.json",
|
||||
NULL);
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_print ("Error: %s", error->message);
|
||||
|
||||
#if GLIB_CHECK_VERSION (2, 20, 0)
|
||||
g_assert_no_error (error);
|
||||
#else
|
||||
g_assert (error == NULL);
|
||||
#endif
|
||||
|
||||
animator = clutter_script_get_object (script, "animator");
|
||||
g_assert (CLUTTER_IS_ANIMATOR (animator));
|
||||
@ -198,3 +191,9 @@ animator_base (TestConformSimpleFixture *fixture,
|
||||
g_object_unref (script);
|
||||
g_free (test_file);
|
||||
}
|
||||
|
||||
CLUTTER_TEST_SUITE (
|
||||
CLUTTER_TEST_UNIT ("/script/animator/base", animator_base)
|
||||
CLUTTER_TEST_UNIT ("/script/animator/properties", animator_properties)
|
||||
CLUTTER_TEST_UNIT ("/script/animator/multi-properties", animator_multi_properties)
|
||||
)
|
||||
|
@ -1,28 +1,21 @@
|
||||
#include <glib.h>
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include "test-conform-common.h"
|
||||
|
||||
typedef struct _BehaviourFixture BehaviourFixture;
|
||||
|
||||
typedef void (* BehaviourTestFunc) (BehaviourFixture *fixture);
|
||||
|
||||
struct _BehaviourFixture
|
||||
{
|
||||
ClutterTimeline *timeline;
|
||||
ClutterAlpha *alpha;
|
||||
ClutterActor *rect;
|
||||
};
|
||||
|
||||
static void
|
||||
opacity_behaviour (BehaviourFixture *fixture)
|
||||
behaviour_opacity (void)
|
||||
{
|
||||
ClutterBehaviour *behaviour;
|
||||
ClutterTimeline *timeline;
|
||||
ClutterAlpha *alpha;
|
||||
guint8 start, end;
|
||||
guint starti;
|
||||
|
||||
behaviour = clutter_behaviour_opacity_new (fixture->alpha, 0, 255);
|
||||
timeline = clutter_timeline_new (500);
|
||||
alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR);
|
||||
behaviour = clutter_behaviour_opacity_new (alpha, 0, 255);
|
||||
g_assert (CLUTTER_IS_BEHAVIOUR_OPACITY (behaviour));
|
||||
g_object_add_weak_pointer (G_OBJECT (behaviour), (gpointer *) &behaviour);
|
||||
g_object_add_weak_pointer (G_OBJECT (timeline), (gpointer *) &timeline);
|
||||
|
||||
clutter_behaviour_opacity_get_bounds (CLUTTER_BEHAVIOUR_OPACITY (behaviour),
|
||||
&start,
|
||||
@ -51,40 +44,37 @@ opacity_behaviour (BehaviourFixture *fixture)
|
||||
g_assert_cmpint (starti, ==, 255);
|
||||
|
||||
g_object_unref (behaviour);
|
||||
g_object_unref (timeline);
|
||||
|
||||
g_assert_null (behaviour);
|
||||
g_assert_null (timeline);
|
||||
}
|
||||
|
||||
static const struct
|
||||
static struct
|
||||
{
|
||||
const gchar *desc;
|
||||
BehaviourTestFunc func;
|
||||
const gchar *path;
|
||||
GTestFunc func;
|
||||
} behaviour_tests[] = {
|
||||
{ "BehaviourOpacity", opacity_behaviour }
|
||||
{ "opacity", behaviour_opacity },
|
||||
};
|
||||
|
||||
static const gint n_behaviour_tests = G_N_ELEMENTS (behaviour_tests);
|
||||
static const int n_behaviour_tests = G_N_ELEMENTS (behaviour_tests);
|
||||
|
||||
void
|
||||
behaviours_base (TestConformSimpleFixture *fixture,
|
||||
gconstpointer dummy)
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
BehaviourFixture b_fixture;
|
||||
gint i;
|
||||
int i;
|
||||
|
||||
b_fixture.timeline = clutter_timeline_new (1000);
|
||||
b_fixture.alpha = clutter_alpha_new_full (b_fixture.timeline, CLUTTER_LINEAR);
|
||||
b_fixture.rect = clutter_rectangle_new ();
|
||||
|
||||
g_object_ref_sink (b_fixture.alpha);
|
||||
g_object_unref (b_fixture.timeline);
|
||||
clutter_test_init (&argc, &argv);
|
||||
|
||||
for (i = 0; i < n_behaviour_tests; i++)
|
||||
{
|
||||
if (g_test_verbose ())
|
||||
g_print ("Testing: %s\n", behaviour_tests[i].desc);
|
||||
char *path = g_strconcat ("/behaviours/", behaviour_tests[i].path, NULL);
|
||||
|
||||
behaviour_tests[i].func (&b_fixture);
|
||||
clutter_test_add (path, behaviour_tests[i].func);
|
||||
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
g_object_unref (b_fixture.alpha);
|
||||
clutter_actor_destroy (b_fixture.rect);
|
||||
return clutter_test_run ();
|
||||
}
|
||||
|
@ -1,11 +1,6 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include <clutter/clutter.h>
|
||||
#include <clutter/clutter-keysyms.h>
|
||||
|
||||
#include "test-conform-common.h"
|
||||
|
||||
#define TYPE_KEY_GROUP (key_group_get_type ())
|
||||
#define KEY_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_KEY_GROUP, KeyGroup))
|
||||
@ -18,20 +13,22 @@ typedef struct _KeyGroupClass KeyGroupClass;
|
||||
|
||||
struct _KeyGroup
|
||||
{
|
||||
ClutterGroup parent_instance;
|
||||
ClutterActor parent_instance;
|
||||
|
||||
gint selected_index;
|
||||
};
|
||||
|
||||
struct _KeyGroupClass
|
||||
{
|
||||
ClutterGroupClass parent_class;
|
||||
ClutterActorClass parent_class;
|
||||
|
||||
void (* activate) (KeyGroup *group,
|
||||
ClutterActor *child);
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (KeyGroup, key_group, CLUTTER_TYPE_GROUP);
|
||||
GType key_group_get_type (void);
|
||||
|
||||
G_DEFINE_TYPE (KeyGroup, key_group, CLUTTER_TYPE_ACTOR)
|
||||
|
||||
enum
|
||||
{
|
||||
@ -53,7 +50,7 @@ key_group_action_move_left (KeyGroup *self,
|
||||
g_assert_cmpstr (action_name, ==, "move-left");
|
||||
g_assert_cmpint (key_val, ==, CLUTTER_KEY_Left);
|
||||
|
||||
n_children = clutter_group_get_n_children (CLUTTER_GROUP (self));
|
||||
n_children = clutter_actor_get_n_children (CLUTTER_ACTOR (self));
|
||||
|
||||
self->selected_index -= 1;
|
||||
|
||||
@ -74,7 +71,7 @@ key_group_action_move_right (KeyGroup *self,
|
||||
g_assert_cmpstr (action_name, ==, "move-right");
|
||||
g_assert_cmpint (key_val, ==, CLUTTER_KEY_Right);
|
||||
|
||||
n_children = clutter_group_get_n_children (CLUTTER_GROUP (self));
|
||||
n_children = clutter_actor_get_n_children (CLUTTER_ACTOR (self));
|
||||
|
||||
self->selected_index += 1;
|
||||
|
||||
@ -100,10 +97,8 @@ key_group_action_activate (KeyGroup *self,
|
||||
if (self->selected_index == -1)
|
||||
return FALSE;
|
||||
|
||||
child = clutter_group_get_nth_child (CLUTTER_GROUP (self),
|
||||
self->selected_index);
|
||||
|
||||
if (child)
|
||||
child = clutter_actor_get_child_at_index (CLUTTER_ACTOR (self), self->selected_index);
|
||||
if (child != NULL)
|
||||
{
|
||||
g_signal_emit (self, group_signals[ACTIVATE], 0, child);
|
||||
return TRUE;
|
||||
@ -138,15 +133,13 @@ static void
|
||||
key_group_paint (ClutterActor *actor)
|
||||
{
|
||||
KeyGroup *self = KEY_GROUP (actor);
|
||||
GList *children, *l;
|
||||
gint i;
|
||||
ClutterActorIter iter;
|
||||
ClutterActor *child;
|
||||
gint i = 0;
|
||||
|
||||
children = clutter_container_get_children (CLUTTER_CONTAINER (self));
|
||||
|
||||
for (l = children, i = 0; l != NULL; l = l->next, i++)
|
||||
clutter_actor_iter_init (&iter, actor);
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
{
|
||||
ClutterActor *child = l->data;
|
||||
|
||||
/* paint the selection rectangle */
|
||||
if (i == self->selected_index)
|
||||
{
|
||||
@ -165,14 +158,6 @@ key_group_paint (ClutterActor *actor)
|
||||
|
||||
clutter_actor_paint (child);
|
||||
}
|
||||
|
||||
g_list_free (children);
|
||||
}
|
||||
|
||||
static void
|
||||
key_group_finalize (GObject *gobject)
|
||||
{
|
||||
G_OBJECT_CLASS (key_group_parent_class)->finalize (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -182,8 +167,6 @@ key_group_class_init (KeyGroupClass *klass)
|
||||
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
||||
ClutterBindingPool *binding_pool;
|
||||
|
||||
gobject_class->finalize = key_group_finalize;
|
||||
|
||||
actor_class->paint = key_group_paint;
|
||||
actor_class->key_press_event = key_group_key_press;
|
||||
|
||||
@ -261,29 +244,30 @@ on_activate (KeyGroup *key_group,
|
||||
g_assert_cmpint (key_group->selected_index, ==, _index);
|
||||
}
|
||||
|
||||
void
|
||||
binding_pool (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
static void
|
||||
binding_pool (void)
|
||||
{
|
||||
KeyGroup *key_group = g_object_new (TYPE_KEY_GROUP, NULL);
|
||||
g_object_ref_sink (key_group);
|
||||
|
||||
clutter_container_add (CLUTTER_CONTAINER (key_group),
|
||||
g_object_new (CLUTTER_TYPE_RECTANGLE,
|
||||
"width", 50.0,
|
||||
"height", 50.0,
|
||||
"x", 0.0, "y", 0.0,
|
||||
NULL),
|
||||
g_object_new (CLUTTER_TYPE_RECTANGLE,
|
||||
"width", 50.0,
|
||||
"height", 50.0,
|
||||
"x", 75.0, "y", 0.0,
|
||||
NULL),
|
||||
g_object_new (CLUTTER_TYPE_RECTANGLE,
|
||||
"width", 50.0,
|
||||
"height", 50.0,
|
||||
"x", 150.0, "y", 0.0,
|
||||
NULL),
|
||||
NULL);
|
||||
clutter_actor_add_child (CLUTTER_ACTOR (key_group),
|
||||
g_object_new (CLUTTER_TYPE_ACTOR,
|
||||
"width", 50.0,
|
||||
"height", 50.0,
|
||||
"x", 0.0, "y", 0.0,
|
||||
NULL));
|
||||
clutter_actor_add_child (CLUTTER_ACTOR (key_group),
|
||||
g_object_new (CLUTTER_TYPE_ACTOR,
|
||||
"width", 50.0,
|
||||
"height", 50.0,
|
||||
"x", 75.0, "y", 0.0,
|
||||
NULL));
|
||||
clutter_actor_add_child (CLUTTER_ACTOR (key_group),
|
||||
g_object_new (CLUTTER_TYPE_ACTOR,
|
||||
"width", 50.0,
|
||||
"height", 50.0,
|
||||
"x", 150.0, "y", 0.0,
|
||||
NULL));
|
||||
|
||||
g_assert_cmpint (key_group->selected_index, ==, -1);
|
||||
|
||||
@ -307,3 +291,7 @@ binding_pool (TestConformSimpleFixture *fixture,
|
||||
|
||||
clutter_actor_destroy (CLUTTER_ACTOR (key_group));
|
||||
}
|
||||
|
||||
CLUTTER_TEST_SUITE (
|
||||
CLUTTER_TEST_UNIT ("/binding-pool", binding_pool)
|
||||
)
|
||||
|
@ -1,20 +1,16 @@
|
||||
#include <stdio.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include "test-conform-common.h"
|
||||
|
||||
void
|
||||
color_hls_roundtrip (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
static void
|
||||
color_hls_roundtrip (void)
|
||||
{
|
||||
ClutterColor color;
|
||||
gfloat hue, luminance, saturation;
|
||||
|
||||
/* test luminance only */
|
||||
clutter_color_from_string (&color, "#7f7f7f");
|
||||
g_assert_cmpint (color.red, ==, 0x7f);
|
||||
g_assert_cmpint (color.green, ==, 0x7f);
|
||||
g_assert_cmpint (color.blue, ==, 0x7f);
|
||||
g_assert_cmpuint (color.red, ==, 0x7f);
|
||||
g_assert_cmpuint (color.green, ==, 0x7f);
|
||||
g_assert_cmpuint (color.blue, ==, 0x7f);
|
||||
|
||||
clutter_color_to_hls (&color, &hue, &luminance, &saturation);
|
||||
g_assert_cmpfloat (hue, ==, 0.0);
|
||||
@ -34,17 +30,17 @@ color_hls_roundtrip (TestConformSimpleFixture *fixture,
|
||||
color.red = color.green = color.blue = 0;
|
||||
clutter_color_from_hls (&color, hue, luminance, saturation);
|
||||
|
||||
g_assert_cmpint (color.red, ==, 0x7f);
|
||||
g_assert_cmpint (color.green, ==, 0x7f);
|
||||
g_assert_cmpint (color.blue, ==, 0x7f);
|
||||
g_assert_cmpuint (color.red, ==, 0x7f);
|
||||
g_assert_cmpuint (color.green, ==, 0x7f);
|
||||
g_assert_cmpuint (color.blue, ==, 0x7f);
|
||||
|
||||
/* full conversion */
|
||||
clutter_color_from_string (&color, "#7f8f7f");
|
||||
color.alpha = 255;
|
||||
|
||||
g_assert_cmpint (color.red, ==, 0x7f);
|
||||
g_assert_cmpint (color.green, ==, 0x8f);
|
||||
g_assert_cmpint (color.blue, ==, 0x7f);
|
||||
g_assert_cmpuint (color.red, ==, 0x7f);
|
||||
g_assert_cmpuint (color.green, ==, 0x8f);
|
||||
g_assert_cmpuint (color.blue, ==, 0x7f);
|
||||
|
||||
clutter_color_to_hls (&color, &hue, &luminance, &saturation);
|
||||
g_assert (hue >= 0.0 && hue < 360.0);
|
||||
@ -64,17 +60,16 @@ color_hls_roundtrip (TestConformSimpleFixture *fixture,
|
||||
color.red = color.green = color.blue = 0;
|
||||
clutter_color_from_hls (&color, hue, luminance, saturation);
|
||||
|
||||
g_assert_cmpint (color.red, ==, 0x7f);
|
||||
g_assert_cmpint (color.green, ==, 0x8f);
|
||||
g_assert_cmpint (color.blue, ==, 0x7f);
|
||||
g_assert_cmpuint (color.red, ==, 0x7f);
|
||||
g_assert_cmpuint (color.green, ==, 0x8f);
|
||||
g_assert_cmpuint (color.blue, ==, 0x7f);
|
||||
|
||||
/* the alpha channel should be untouched */
|
||||
g_assert_cmpint (color.alpha, ==, 255);
|
||||
g_assert_cmpuint (color.alpha, ==, 255);
|
||||
}
|
||||
|
||||
void
|
||||
color_from_string_invalid (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
static void
|
||||
color_from_string_invalid (void)
|
||||
{
|
||||
ClutterColor color;
|
||||
|
||||
@ -88,9 +83,8 @@ color_from_string_invalid (TestConformSimpleFixture *fixture,
|
||||
g_assert (!clutter_color_from_string (&color, "hsla(100%, 0%, 50%, 20%)"));
|
||||
}
|
||||
|
||||
void
|
||||
color_from_string_valid (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
static void
|
||||
color_from_string_valid (void)
|
||||
{
|
||||
ClutterColor color;
|
||||
|
||||
@ -103,10 +97,10 @@ color_from_string_valid (TestConformSimpleFixture *fixture,
|
||||
color.blue,
|
||||
color.alpha);
|
||||
}
|
||||
g_assert (color.red == 0xff);
|
||||
g_assert (color.green == 0);
|
||||
g_assert (color.blue == 0);
|
||||
g_assert (color.alpha == 0xff);
|
||||
g_assert_cmpuint (color.red, ==, 0xff);
|
||||
g_assert_cmpuint (color.green, ==, 0);
|
||||
g_assert_cmpuint (color.blue, ==, 0);
|
||||
g_assert_cmpuint (color.alpha, ==, 0xff);
|
||||
|
||||
g_assert (clutter_color_from_string (&color, "#0f0f"));
|
||||
if (g_test_verbose ())
|
||||
@ -117,10 +111,10 @@ color_from_string_valid (TestConformSimpleFixture *fixture,
|
||||
color.blue,
|
||||
color.alpha);
|
||||
}
|
||||
g_assert (color.red == 0);
|
||||
g_assert (color.green == 0xff);
|
||||
g_assert (color.blue == 0);
|
||||
g_assert (color.alpha == 0xff);
|
||||
g_assert_cmpuint (color.red, ==, 0);
|
||||
g_assert_cmpuint (color.green, ==, 0xff);
|
||||
g_assert_cmpuint (color.blue, ==, 0);
|
||||
g_assert_cmpuint (color.alpha, ==, 0xff);
|
||||
|
||||
g_assert (clutter_color_from_string (&color, "#0000ff"));
|
||||
if (g_test_verbose ())
|
||||
@ -131,10 +125,10 @@ color_from_string_valid (TestConformSimpleFixture *fixture,
|
||||
color.blue,
|
||||
color.alpha);
|
||||
}
|
||||
g_assert (color.red == 0);
|
||||
g_assert (color.green == 0);
|
||||
g_assert (color.blue == 0xff);
|
||||
g_assert (color.alpha == 0xff);
|
||||
g_assert_cmpuint (color.red, ==, 0);
|
||||
g_assert_cmpuint (color.green, ==, 0);
|
||||
g_assert_cmpuint (color.blue, ==, 0xff);
|
||||
g_assert_cmpuint (color.alpha, ==, 0xff);
|
||||
|
||||
g_assert (clutter_color_from_string (&color, "#abc"));
|
||||
if (g_test_verbose ())
|
||||
@ -145,10 +139,10 @@ color_from_string_valid (TestConformSimpleFixture *fixture,
|
||||
color.blue,
|
||||
color.alpha);
|
||||
}
|
||||
g_assert (color.red == 0xaa);
|
||||
g_assert (color.green == 0xbb);
|
||||
g_assert (color.blue == 0xcc);
|
||||
g_assert (color.alpha == 0xff);
|
||||
g_assert_cmpuint (color.red, ==, 0xaa);
|
||||
g_assert_cmpuint (color.green, ==, 0xbb);
|
||||
g_assert_cmpuint (color.blue, ==, 0xcc);
|
||||
g_assert_cmpuint (color.alpha, ==, 0xff);
|
||||
|
||||
g_assert (clutter_color_from_string (&color, "#123abc"));
|
||||
if (g_test_verbose ())
|
||||
@ -173,10 +167,10 @@ color_from_string_valid (TestConformSimpleFixture *fixture,
|
||||
color.blue,
|
||||
color.alpha);
|
||||
}
|
||||
g_assert_cmpint (color.red, ==, 255);
|
||||
g_assert_cmpint (color.green, ==, 128);
|
||||
g_assert_cmpint (color.blue, ==, 64);
|
||||
g_assert_cmpint (color.alpha, ==, 255);
|
||||
g_assert_cmpuint (color.red, ==, 255);
|
||||
g_assert_cmpuint (color.green, ==, 128);
|
||||
g_assert_cmpuint (color.blue, ==, 64);
|
||||
g_assert_cmpuint (color.alpha, ==, 255);
|
||||
|
||||
g_assert (clutter_color_from_string (&color, "rgba ( 30%, 0, 25%, 0.5 ) "));
|
||||
if (g_test_verbose ())
|
||||
@ -189,10 +183,10 @@ color_from_string_valid (TestConformSimpleFixture *fixture,
|
||||
CLAMP (255.0 / 100.0 * 30.0, 0, 255),
|
||||
CLAMP (255.0 / 100.0 * 25.0, 0, 255));
|
||||
}
|
||||
g_assert_cmpint (color.red, ==, (255.0 / 100.0 * 30.0));
|
||||
g_assert_cmpint (color.green, ==, 0);
|
||||
g_assert_cmpint (color.blue, ==, (255.0 / 100.0 * 25.0));
|
||||
g_assert_cmpint (color.alpha, ==, 127);
|
||||
g_assert_cmpuint (color.red, ==, (255.0 / 100.0 * 30.0));
|
||||
g_assert_cmpuint (color.green, ==, 0);
|
||||
g_assert_cmpuint (color.blue, ==, (255.0 / 100.0 * 25.0));
|
||||
g_assert_cmpuint (color.alpha, ==, 127);
|
||||
|
||||
g_assert (clutter_color_from_string (&color, "rgb( 50%, -50%, 150% )"));
|
||||
if (g_test_verbose ())
|
||||
@ -203,10 +197,10 @@ color_from_string_valid (TestConformSimpleFixture *fixture,
|
||||
color.blue,
|
||||
color.alpha);
|
||||
}
|
||||
g_assert_cmpint (color.red, ==, 127);
|
||||
g_assert_cmpint (color.green, ==, 0);
|
||||
g_assert_cmpint (color.blue, ==, 255);
|
||||
g_assert_cmpint (color.alpha, ==, 255);
|
||||
g_assert_cmpuint (color.red, ==, 127);
|
||||
g_assert_cmpuint (color.green, ==, 0);
|
||||
g_assert_cmpuint (color.blue, ==, 255);
|
||||
g_assert_cmpuint (color.alpha, ==, 255);
|
||||
|
||||
g_assert (clutter_color_from_string (&color, "hsl( 0, 100%, 50% )"));
|
||||
if (g_test_verbose ())
|
||||
@ -217,10 +211,10 @@ color_from_string_valid (TestConformSimpleFixture *fixture,
|
||||
color.blue,
|
||||
color.alpha);
|
||||
}
|
||||
g_assert_cmpint (color.red, ==, 255);
|
||||
g_assert_cmpint (color.green, ==, 0);
|
||||
g_assert_cmpint (color.blue, ==, 0);
|
||||
g_assert_cmpint (color.alpha, ==, 255);
|
||||
g_assert_cmpuint (color.red, ==, 255);
|
||||
g_assert_cmpuint (color.green, ==, 0);
|
||||
g_assert_cmpuint (color.blue, ==, 0);
|
||||
g_assert_cmpuint (color.alpha, ==, 255);
|
||||
|
||||
g_assert (clutter_color_from_string (&color, "hsla( 0, 100%, 50%, 0.5 )"));
|
||||
if (g_test_verbose ())
|
||||
@ -231,15 +225,14 @@ color_from_string_valid (TestConformSimpleFixture *fixture,
|
||||
color.blue,
|
||||
color.alpha);
|
||||
}
|
||||
g_assert_cmpint (color.red, ==, 255);
|
||||
g_assert_cmpint (color.green, ==, 0);
|
||||
g_assert_cmpint (color.blue, ==, 0);
|
||||
g_assert_cmpint (color.alpha, ==, 127);
|
||||
g_assert_cmpuint (color.red, ==, 255);
|
||||
g_assert_cmpuint (color.green, ==, 0);
|
||||
g_assert_cmpuint (color.blue, ==, 0);
|
||||
g_assert_cmpuint (color.alpha, ==, 127);
|
||||
}
|
||||
|
||||
void
|
||||
color_to_string (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
static void
|
||||
color_to_string (void)
|
||||
{
|
||||
ClutterColor color;
|
||||
gchar *str;
|
||||
@ -255,24 +248,23 @@ color_to_string (TestConformSimpleFixture *fixture,
|
||||
g_free (str);
|
||||
}
|
||||
|
||||
void
|
||||
color_operators (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
static void
|
||||
color_operators (void)
|
||||
{
|
||||
ClutterColor op1, op2;
|
||||
ClutterColor res;
|
||||
|
||||
clutter_color_from_pixel (&op1, 0xff0000ff);
|
||||
g_assert_cmpint (op1.red, ==, 0xff);
|
||||
g_assert_cmpint (op1.green, ==, 0);
|
||||
g_assert_cmpint (op1.blue, ==, 0);
|
||||
g_assert_cmpint (op1.alpha, ==, 0xff);
|
||||
g_assert_cmpuint (op1.red, ==, 0xff);
|
||||
g_assert_cmpuint (op1.green, ==, 0);
|
||||
g_assert_cmpuint (op1.blue, ==, 0);
|
||||
g_assert_cmpuint (op1.alpha, ==, 0xff);
|
||||
|
||||
clutter_color_from_pixel (&op2, 0x00ff00ff);
|
||||
g_assert_cmpint (op2.red, ==, 0);
|
||||
g_assert_cmpint (op2.green, ==, 0xff);
|
||||
g_assert_cmpint (op2.blue, ==, 0);
|
||||
g_assert_cmpint (op2.alpha, ==, 0xff);
|
||||
g_assert_cmpuint (op2.red, ==, 0);
|
||||
g_assert_cmpuint (op2.green, ==, 0xff);
|
||||
g_assert_cmpuint (op2.blue, ==, 0);
|
||||
g_assert_cmpuint (op2.alpha, ==, 0xff);
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("Adding %x, %x; expected result: %x\n",
|
||||
@ -281,7 +273,7 @@ color_operators (TestConformSimpleFixture *fixture,
|
||||
0xffff00ff);
|
||||
|
||||
clutter_color_add (&op1, &op2, &res);
|
||||
g_assert_cmpint (clutter_color_to_pixel (&res), ==, 0xffff00ff);
|
||||
g_assert_cmpuint (clutter_color_to_pixel (&res), ==, 0xffff00ff);
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("Checking alpha channel on color add\n");
|
||||
@ -289,7 +281,7 @@ color_operators (TestConformSimpleFixture *fixture,
|
||||
op1.alpha = 0xdd;
|
||||
op2.alpha = 0xcc;
|
||||
clutter_color_add (&op1, &op2, &res);
|
||||
g_assert_cmpint (clutter_color_to_pixel (&res), ==, 0xffff00dd);
|
||||
g_assert_cmpuint (clutter_color_to_pixel (&res), ==, 0xffff00dd);
|
||||
|
||||
clutter_color_from_pixel (&op1, 0xffffffff);
|
||||
clutter_color_from_pixel (&op2, 0xff00ffff);
|
||||
@ -301,7 +293,7 @@ color_operators (TestConformSimpleFixture *fixture,
|
||||
0x00ff00ff);
|
||||
|
||||
clutter_color_subtract (&op1, &op2, &res);
|
||||
g_assert_cmpint (clutter_color_to_pixel (&res), ==, 0x00ff00ff);
|
||||
g_assert_cmpuint (clutter_color_to_pixel (&res), ==, 0x00ff00ff);
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("Checking alpha channel on color subtract\n");
|
||||
@ -309,5 +301,13 @@ color_operators (TestConformSimpleFixture *fixture,
|
||||
op1.alpha = 0xdd;
|
||||
op2.alpha = 0xcc;
|
||||
clutter_color_subtract (&op1, &op2, &res);
|
||||
g_assert_cmpint (clutter_color_to_pixel (&res), ==, 0x00ff00cc);
|
||||
g_assert_cmpuint (clutter_color_to_pixel (&res), ==, 0x00ff00cc);
|
||||
}
|
||||
|
||||
CLUTTER_TEST_SUITE (
|
||||
CLUTTER_TEST_UNIT ("/color/hls-roundtrip", color_hls_roundtrip)
|
||||
CLUTTER_TEST_UNIT ("/color/from-string/invalid", color_from_string_invalid)
|
||||
CLUTTER_TEST_UNIT ("/color/from-string/valid", color_from_string_valid)
|
||||
CLUTTER_TEST_UNIT ("/color/to-string", color_to_string)
|
||||
CLUTTER_TEST_UNIT ("/color/operators", color_operators)
|
||||
)
|
||||
|
@ -19,7 +19,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#if defined CLUTTER_WINDOWING_X11 && OS_LINUX && HAVE_XINPUT_2_2
|
||||
@ -36,8 +35,6 @@
|
||||
|
||||
#include <clutter/x11/clutter-x11.h>
|
||||
|
||||
#include "test-conform-common.h"
|
||||
|
||||
#define ABS_MAX_X 32768
|
||||
#define ABS_MAX_Y 32768
|
||||
|
||||
@ -360,7 +357,7 @@ error:
|
||||
|
||||
#endif /* defined CLUTTER_WINDOWING_X11 && OS_LINUX && HAVE_XINPUT_2_2 */
|
||||
|
||||
void
|
||||
static void
|
||||
events_touch (void)
|
||||
{
|
||||
#if defined CLUTTER_WINDOWING_X11 && OS_LINUX && HAVE_XINPUT_2_2
|
||||
@ -374,7 +371,7 @@ events_touch (void)
|
||||
state.pass = TRUE;
|
||||
state.gesture_points = 0;
|
||||
|
||||
stage = clutter_stage_new ();
|
||||
stage = clutter_test_get_stage ();
|
||||
g_signal_connect (stage, "event", G_CALLBACK (event_cb), &state);
|
||||
clutter_stage_set_fullscreen (CLUTTER_STAGE (stage), TRUE);
|
||||
clutter_actor_show (stage);
|
||||
@ -387,7 +384,9 @@ events_touch (void)
|
||||
g_print ("end result: %s\n", state.pass ? "pass" : "FAIL");
|
||||
|
||||
g_assert (state.pass);
|
||||
|
||||
clutter_actor_destroy (stage);
|
||||
#endif /* defined CLUTTER_WINDOWING_X11 && OS_LINUX && HAVE_XINPUT_2_2 */
|
||||
}
|
||||
|
||||
CLUTTER_TEST_SUITE (
|
||||
CLUTTER_TEST_UNIT ("/events/touch", events_touch)
|
||||
)
|
||||
|
@ -1,9 +1,8 @@
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include <clutter/clutter.h>
|
||||
#include "test-conform-common.h"
|
||||
|
||||
void
|
||||
group_depth_sorting (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
static void
|
||||
group_depth_sorting (void)
|
||||
{
|
||||
ClutterActor *group;
|
||||
ClutterActor *child, *test;
|
||||
@ -55,3 +54,7 @@ group_depth_sorting (TestConformSimpleFixture *fixture,
|
||||
|
||||
clutter_actor_destroy (group);
|
||||
}
|
||||
|
||||
CLUTTER_TEST_SUITE (
|
||||
CLUTTER_TEST_UNIT ("/group/depth-sorting", group_depth_sorting)
|
||||
)
|
||||
|
@ -1,10 +1,7 @@
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include "test-conform-common.h"
|
||||
|
||||
void
|
||||
interval_initial_state (TestConformSimpleFixture *fixture G_GNUC_UNUSED,
|
||||
gconstpointer dummy G_GNUC_UNUSED)
|
||||
static void
|
||||
interval_initial_state (void)
|
||||
{
|
||||
ClutterInterval *interval;
|
||||
int initial, final;
|
||||
@ -38,9 +35,8 @@ interval_initial_state (TestConformSimpleFixture *fixture G_GNUC_UNUSED,
|
||||
g_object_unref (interval);
|
||||
}
|
||||
|
||||
void
|
||||
interval_transform (TestConformSimpleFixture *fixture G_GNUC_UNUSED,
|
||||
gconstpointer dummy G_GNUC_UNUSED)
|
||||
static void
|
||||
interval_transform (void)
|
||||
{
|
||||
ClutterInterval *interval;
|
||||
GValue value = G_VALUE_INIT;
|
||||
@ -68,3 +64,54 @@ interval_transform (TestConformSimpleFixture *fixture G_GNUC_UNUSED,
|
||||
|
||||
g_object_unref (interval);
|
||||
}
|
||||
|
||||
static void
|
||||
interval_from_script (void)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
ClutterInterval *interval;
|
||||
gchar *test_file;
|
||||
GError *error = NULL;
|
||||
GValue *initial, *final;
|
||||
|
||||
test_file = g_test_build_filename (G_TEST_DIST,
|
||||
"scripts",
|
||||
"test-script-interval.json",
|
||||
NULL);
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_printerr ("\tError: %s", error->message);
|
||||
|
||||
g_assert_no_error (error);
|
||||
|
||||
interval = CLUTTER_INTERVAL (clutter_script_get_object (script, "int-1"));
|
||||
initial = clutter_interval_peek_initial_value (interval);
|
||||
if (g_test_verbose ())
|
||||
g_test_message ("\tinitial ['%s'] = '%.2f'",
|
||||
g_type_name (G_VALUE_TYPE (initial)),
|
||||
g_value_get_float (initial));
|
||||
g_assert (G_VALUE_HOLDS (initial, G_TYPE_FLOAT));
|
||||
g_assert_cmpfloat (g_value_get_float (initial), ==, 23.3f);
|
||||
final = clutter_interval_peek_final_value (interval);
|
||||
if (g_test_verbose ())
|
||||
g_test_message ("\tfinal ['%s'] = '%.2f'",
|
||||
g_type_name (G_VALUE_TYPE (final)),
|
||||
g_value_get_float (final));
|
||||
g_assert (G_VALUE_HOLDS (final, G_TYPE_FLOAT));
|
||||
g_assert_cmpfloat (g_value_get_float (final), ==, 42.2f);
|
||||
|
||||
interval = CLUTTER_INTERVAL (clutter_script_get_object (script, "int-2"));
|
||||
initial = clutter_interval_peek_initial_value (interval);
|
||||
g_assert (G_VALUE_HOLDS (initial, CLUTTER_TYPE_COLOR));
|
||||
final = clutter_interval_peek_final_value (interval);
|
||||
g_assert (G_VALUE_HOLDS (final, CLUTTER_TYPE_COLOR));
|
||||
|
||||
g_object_unref (script);
|
||||
g_free (test_file);
|
||||
}
|
||||
|
||||
CLUTTER_TEST_SUITE (
|
||||
CLUTTER_TEST_UNIT ("/interval/initial-state", interval_initial_state)
|
||||
CLUTTER_TEST_UNIT ("/interval/transform", interval_transform)
|
||||
CLUTTER_TEST_UNIT ("/interval/from-script", interval_from_script)
|
||||
)
|
||||
|
@ -2,8 +2,6 @@
|
||||
#include <string.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include "test-conform-common.h"
|
||||
|
||||
typedef struct _ModelData
|
||||
{
|
||||
ClutterModel *model;
|
||||
@ -171,9 +169,8 @@ filter_odd_rows (ClutterModel *model,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
list_model_filter (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
static void
|
||||
list_model_filter (void)
|
||||
{
|
||||
ModelData test_data = { NULL, 0 };
|
||||
ClutterModelIter *iter;
|
||||
@ -259,9 +256,8 @@ list_model_filter (TestConformSimpleFixture *fixture,
|
||||
g_object_unref (test_data.model);
|
||||
}
|
||||
|
||||
void
|
||||
list_model_iterate (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
static void
|
||||
list_model_iterate (void)
|
||||
{
|
||||
ModelData test_data = { NULL, 0 };
|
||||
ClutterModelIter *iter;
|
||||
@ -334,9 +330,8 @@ list_model_iterate (TestConformSimpleFixture *fixture,
|
||||
g_object_unref (test_data.model);
|
||||
}
|
||||
|
||||
void
|
||||
list_model_populate (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
static void
|
||||
list_model_populate (void)
|
||||
{
|
||||
ModelData test_data = { NULL, 0 };
|
||||
gint i;
|
||||
@ -365,9 +360,8 @@ list_model_populate (TestConformSimpleFixture *fixture,
|
||||
g_object_unref (test_data.model);
|
||||
}
|
||||
|
||||
void
|
||||
list_model_from_script (TestConformSimpleFixture *fixture,
|
||||
gconstpointer dummy)
|
||||
static void
|
||||
list_model_from_script (void)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
GObject *model;
|
||||
@ -378,7 +372,7 @@ list_model_from_script (TestConformSimpleFixture *fixture,
|
||||
ClutterModelIter *iter;
|
||||
GValue value = { 0, };
|
||||
|
||||
test_file = clutter_test_get_data_file ("test-script-model.json");
|
||||
test_file = g_test_build_filename (G_TEST_DIST, "scripts", "test-script-model.json", NULL);
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_print ("Error: %s", error->message);
|
||||
@ -406,7 +400,7 @@ list_model_from_script (TestConformSimpleFixture *fixture,
|
||||
g_print ("column[2]: %s, type: %s\n", name, g_type_name (type));
|
||||
|
||||
g_assert (strcmp (name, "actor-column") == 0);
|
||||
g_assert (type == CLUTTER_TYPE_RECTANGLE);
|
||||
g_assert (g_type_is_a (type, CLUTTER_TYPE_ACTOR));
|
||||
|
||||
g_assert (clutter_model_get_n_rows (CLUTTER_MODEL (model)) == 3);
|
||||
|
||||
@ -429,13 +423,13 @@ list_model_from_script (TestConformSimpleFixture *fixture,
|
||||
iter = clutter_model_iter_next (iter);
|
||||
clutter_model_iter_get_value (iter, 2, &value);
|
||||
g_assert (G_VALUE_HOLDS_OBJECT (&value));
|
||||
g_assert (CLUTTER_IS_RECTANGLE (g_value_get_object (&value)));
|
||||
g_assert (CLUTTER_IS_ACTOR (g_value_get_object (&value)));
|
||||
g_value_unset (&value);
|
||||
|
||||
iter = clutter_model_iter_next (iter);
|
||||
clutter_model_iter_get_value (iter, 2, &value);
|
||||
g_assert (G_VALUE_HOLDS_OBJECT (&value));
|
||||
g_assert (CLUTTER_IS_RECTANGLE (g_value_get_object (&value)));
|
||||
g_assert (CLUTTER_IS_ACTOR (g_value_get_object (&value)));
|
||||
g_assert (strcmp (clutter_actor_get_name (g_value_get_object (&value)),
|
||||
"actor-row-3") == 0);
|
||||
g_value_unset (&value);
|
||||
@ -460,9 +454,8 @@ on_row_changed (ClutterModel *model,
|
||||
data->n_emissions += 1;
|
||||
}
|
||||
|
||||
void
|
||||
list_model_row_changed (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
static void
|
||||
list_model_row_changed (void)
|
||||
{
|
||||
ChangedData test_data = { NULL, NULL, 0, 0 };
|
||||
GValue value = { 0, };
|
||||
@ -524,3 +517,11 @@ list_model_row_changed (TestConformSimpleFixture *fixture,
|
||||
g_object_unref (test_data.iter);
|
||||
g_object_unref (test_data.model);
|
||||
}
|
||||
|
||||
CLUTTER_TEST_SUITE (
|
||||
CLUTTER_TEST_UNIT ("/list-model/populate", list_model_populate)
|
||||
CLUTTER_TEST_UNIT ("/list-model/iterate", list_model_iterate)
|
||||
CLUTTER_TEST_UNIT ("/list-model/filter", list_model_filter)
|
||||
CLUTTER_TEST_UNIT ("/list-model/row-changed", list_model_row_changed)
|
||||
CLUTTER_TEST_UNIT ("/list-model/from-script", list_model_from_script)
|
||||
)
|
||||
|
@ -1,16 +1,8 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include "test-conform-common.h"
|
||||
|
||||
void
|
||||
rectangle_set_size (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
static void
|
||||
rectangle_set_size (void)
|
||||
{
|
||||
ClutterActor *rect = clutter_rectangle_new ();
|
||||
|
||||
@ -32,9 +24,8 @@ rectangle_set_size (TestConformSimpleFixture *fixture,
|
||||
clutter_actor_destroy (rect);
|
||||
}
|
||||
|
||||
void
|
||||
rectangle_set_color (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
static void
|
||||
rectangle_set_color (void)
|
||||
{
|
||||
ClutterActor *rect = clutter_rectangle_new ();
|
||||
ClutterColor white = { 255, 255, 255, 255 };
|
||||
@ -54,3 +45,7 @@ rectangle_set_color (TestConformSimpleFixture *fixture,
|
||||
clutter_actor_destroy (rect);
|
||||
}
|
||||
|
||||
CLUTTER_TEST_SUITE (
|
||||
CLUTTER_TEST_UNIT ("/rectangle/set-size", rectangle_set_size)
|
||||
CLUTTER_TEST_UNIT ("/rectangle/set-color", rectangle_set_color)
|
||||
)
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include "test-conform-common.h"
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#define TEST_TYPE_GROUP (test_group_get_type ())
|
||||
#define TEST_TYPE_GROUP_META (test_group_meta_get_type ())
|
||||
@ -13,7 +13,8 @@
|
||||
#define TEST_GROUP_META(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_TYPE_GROUP_META, TestGroupMeta))
|
||||
#define TEST_IS_GROUP_META(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_TYPE_GROUP_META))
|
||||
|
||||
typedef struct _ClutterGroup TestGroup;
|
||||
typedef struct _ClutterActor TestGroup;
|
||||
typedef struct _ClutterActorClass TestGroupClass;
|
||||
|
||||
typedef struct _TestGroupMeta {
|
||||
ClutterChildMeta parent_instance;
|
||||
@ -21,10 +22,11 @@ typedef struct _TestGroupMeta {
|
||||
guint is_focus : 1;
|
||||
} TestGroupMeta;
|
||||
|
||||
typedef struct _ClutterGroupClass TestGroupClass;
|
||||
typedef struct _ClutterChildMetaClass TestGroupMetaClass;
|
||||
|
||||
G_DEFINE_TYPE (TestGroupMeta, test_group_meta, CLUTTER_TYPE_CHILD_META);
|
||||
GType test_group_meta_get_type (void);
|
||||
|
||||
G_DEFINE_TYPE (TestGroupMeta, test_group_meta, CLUTTER_TYPE_CHILD_META)
|
||||
|
||||
enum
|
||||
{
|
||||
@ -100,9 +102,11 @@ clutter_container_iface_init (ClutterContainerIface *iface)
|
||||
iface->child_meta_type = TEST_TYPE_GROUP_META;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (TestGroup, test_group, CLUTTER_TYPE_GROUP,
|
||||
GType test_group_get_type (void);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (TestGroup, test_group, CLUTTER_TYPE_ACTOR,
|
||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER,
|
||||
clutter_container_iface_init));
|
||||
clutter_container_iface_init))
|
||||
|
||||
static void
|
||||
test_group_class_init (TestGroupClass *klass)
|
||||
@ -114,9 +118,8 @@ test_group_init (TestGroup *self)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
script_child (TestConformSimpleFixture *fixture,
|
||||
gconstpointer dummy)
|
||||
static void
|
||||
script_child (void)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
GObject *container, *actor;
|
||||
@ -124,16 +127,12 @@ script_child (TestConformSimpleFixture *fixture,
|
||||
gboolean focus_ret;
|
||||
gchar *test_file;
|
||||
|
||||
test_file = clutter_test_get_data_file ("test-script-child.json");
|
||||
test_file = g_test_build_filename (G_TEST_DIST, "scripts", "test-script-child.json", NULL);
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_print ("Error: %s", error->message);
|
||||
|
||||
#if GLIB_CHECK_VERSION (2, 20, 0)
|
||||
g_assert_no_error (error);
|
||||
#else
|
||||
g_assert (error == NULL);
|
||||
#endif
|
||||
|
||||
container = actor = NULL;
|
||||
clutter_script_get_objects (script,
|
||||
@ -164,9 +163,8 @@ script_child (TestConformSimpleFixture *fixture,
|
||||
g_free (test_file);
|
||||
}
|
||||
|
||||
void
|
||||
script_single (TestConformSimpleFixture *fixture,
|
||||
gconstpointer dummy)
|
||||
static void
|
||||
script_single (void)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
ClutterColor color = { 0, };
|
||||
@ -175,16 +173,12 @@ script_single (TestConformSimpleFixture *fixture,
|
||||
ClutterActor *rect;
|
||||
gchar *test_file;
|
||||
|
||||
test_file = clutter_test_get_data_file ("test-script-single.json");
|
||||
test_file = g_test_build_filename (G_TEST_DIST, "scripts", "test-script-single.json", NULL);
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_print ("Error: %s", error->message);
|
||||
|
||||
#if GLIB_CHECK_VERSION (2, 20, 0)
|
||||
g_assert_no_error (error);
|
||||
#else
|
||||
g_assert (error == NULL);
|
||||
#endif
|
||||
|
||||
actor = clutter_script_get_object (script, "test");
|
||||
g_assert (CLUTTER_IS_RECTANGLE (actor));
|
||||
@ -202,9 +196,8 @@ script_single (TestConformSimpleFixture *fixture,
|
||||
g_free (test_file);
|
||||
}
|
||||
|
||||
void
|
||||
script_implicit_alpha (TestConformSimpleFixture *fixture,
|
||||
gconstpointer dummy)
|
||||
static void
|
||||
script_implicit_alpha (void)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
ClutterTimeline *timeline;
|
||||
@ -213,7 +206,7 @@ script_implicit_alpha (TestConformSimpleFixture *fixture,
|
||||
ClutterAlpha *alpha;
|
||||
gchar *test_file;
|
||||
|
||||
test_file = clutter_test_get_data_file ("test-script-implicit-alpha.json");
|
||||
test_file = g_test_build_filename (G_TEST_DIST, "scripts", "test-script-implicit-alpha.json", NULL);
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_print ("Error: %s", error->message);
|
||||
@ -241,9 +234,8 @@ script_implicit_alpha (TestConformSimpleFixture *fixture,
|
||||
g_free (test_file);
|
||||
}
|
||||
|
||||
void
|
||||
script_object_property (TestConformSimpleFixture *fixture,
|
||||
gconstpointer dummy)
|
||||
static void
|
||||
script_object_property (void)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
ClutterLayoutManager *manager;
|
||||
@ -251,16 +243,12 @@ script_object_property (TestConformSimpleFixture *fixture,
|
||||
GError *error = NULL;
|
||||
gchar *test_file;
|
||||
|
||||
test_file = clutter_test_get_data_file ("test-script-object-property.json");
|
||||
test_file = g_test_build_filename (G_TEST_DIST, "scripts", "test-script-object-property.json", NULL);
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_print ("Error: %s", error->message);
|
||||
|
||||
#if GLIB_CHECK_VERSION (2, 20, 0)
|
||||
g_assert_no_error (error);
|
||||
#else
|
||||
g_assert (error == NULL);
|
||||
#endif
|
||||
|
||||
actor = clutter_script_get_object (script, "test");
|
||||
g_assert (CLUTTER_IS_BOX (actor));
|
||||
@ -272,9 +260,8 @@ script_object_property (TestConformSimpleFixture *fixture,
|
||||
g_free (test_file);
|
||||
}
|
||||
|
||||
void
|
||||
script_named_object (TestConformSimpleFixture *fixture,
|
||||
gconstpointer dummy)
|
||||
static void
|
||||
script_named_object (void)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
ClutterLayoutManager *manager;
|
||||
@ -282,16 +269,12 @@ script_named_object (TestConformSimpleFixture *fixture,
|
||||
GError *error = NULL;
|
||||
gchar *test_file;
|
||||
|
||||
test_file = clutter_test_get_data_file ("test-script-named-object.json");
|
||||
test_file = g_test_build_filename (G_TEST_DIST, "scripts", "test-script-named-object.json", NULL);
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_print ("Error: %s", error->message);
|
||||
|
||||
#if GLIB_CHECK_VERSION (2, 20, 0)
|
||||
g_assert_no_error (error);
|
||||
#else
|
||||
g_assert (error == NULL);
|
||||
#endif
|
||||
|
||||
actor = clutter_script_get_object (script, "test");
|
||||
g_assert (CLUTTER_IS_BOX (actor));
|
||||
@ -304,25 +287,20 @@ script_named_object (TestConformSimpleFixture *fixture,
|
||||
g_free (test_file);
|
||||
}
|
||||
|
||||
void
|
||||
script_animation (TestConformSimpleFixture *fixture,
|
||||
gconstpointer dummy)
|
||||
static void
|
||||
script_animation (void)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
GObject *animation = NULL;
|
||||
GError *error = NULL;
|
||||
gchar *test_file;
|
||||
|
||||
test_file = clutter_test_get_data_file ("test-script-animation.json");
|
||||
test_file = g_test_build_filename (G_TEST_DIST, "scripts", "test-script-animation.json", NULL);
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_print ("Error: %s", error->message);
|
||||
|
||||
#if GLIB_CHECK_VERSION (2, 20, 0)
|
||||
g_assert_no_error (error);
|
||||
#else
|
||||
g_assert (error == NULL);
|
||||
#endif
|
||||
|
||||
animation = clutter_script_get_object (script, "test");
|
||||
g_assert (CLUTTER_IS_ANIMATION (animation));
|
||||
@ -331,9 +309,8 @@ script_animation (TestConformSimpleFixture *fixture,
|
||||
g_free (test_file);
|
||||
}
|
||||
|
||||
void
|
||||
script_layout_property (TestConformSimpleFixture *fixture,
|
||||
gconstpointer dummy G_GNUC_UNUSED)
|
||||
static void
|
||||
script_layout_property (void)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
GObject *manager, *container, *actor1, *actor2;
|
||||
@ -342,16 +319,12 @@ script_layout_property (TestConformSimpleFixture *fixture,
|
||||
gboolean x_fill, expand;
|
||||
ClutterBoxAlignment y_align;
|
||||
|
||||
test_file = clutter_test_get_data_file ("test-script-layout-property.json");
|
||||
test_file = g_test_build_filename (G_TEST_DIST, "scripts", "test-script-layout-property.json", NULL);
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_print ("Error: %s", error->message);
|
||||
|
||||
#if GLIB_CHECK_VERSION (2, 20, 0)
|
||||
g_assert_no_error (error);
|
||||
#else
|
||||
g_assert (error == NULL);
|
||||
#endif
|
||||
|
||||
manager = container = actor1 = actor2 = NULL;
|
||||
clutter_script_get_objects (script,
|
||||
@ -399,16 +372,15 @@ script_layout_property (TestConformSimpleFixture *fixture,
|
||||
g_object_unref (script);
|
||||
}
|
||||
|
||||
void
|
||||
script_margin (TestConformSimpleFixture *fixture,
|
||||
gpointer dummy)
|
||||
static void
|
||||
script_margin (void)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
ClutterActor *actor;
|
||||
gchar *test_file;
|
||||
GError *error = NULL;
|
||||
|
||||
test_file = clutter_test_get_data_file ("test-script-margin.json");
|
||||
test_file = g_test_build_filename (G_TEST_DIST, "scripts", "test-script-margin.json", NULL);
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_print ("Error: %s", error->message);
|
||||
@ -443,37 +415,13 @@ script_margin (TestConformSimpleFixture *fixture,
|
||||
g_free (test_file);
|
||||
}
|
||||
|
||||
void
|
||||
script_interval (TestConformSimpleFixture *fixture,
|
||||
gpointer dummy)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
ClutterInterval *interval;
|
||||
gchar *test_file;
|
||||
GError *error = NULL;
|
||||
GValue *initial, *final;
|
||||
|
||||
test_file = clutter_test_get_data_file ("test-script-interval.json");
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_print ("Error: %s", error->message);
|
||||
|
||||
g_assert_no_error (error);
|
||||
|
||||
interval = CLUTTER_INTERVAL (clutter_script_get_object (script, "int-1"));
|
||||
initial = clutter_interval_peek_initial_value (interval);
|
||||
g_assert (G_VALUE_HOLDS (initial, G_TYPE_FLOAT));
|
||||
g_assert_cmpfloat (g_value_get_float (initial), ==, 23.3f);
|
||||
final = clutter_interval_peek_final_value (interval);
|
||||
g_assert (G_VALUE_HOLDS (final, G_TYPE_FLOAT));
|
||||
g_assert_cmpfloat (g_value_get_float (final), ==, 42.2f);
|
||||
|
||||
interval = CLUTTER_INTERVAL (clutter_script_get_object (script, "int-2"));
|
||||
initial = clutter_interval_peek_initial_value (interval);
|
||||
g_assert (G_VALUE_HOLDS (initial, CLUTTER_TYPE_COLOR));
|
||||
final = clutter_interval_peek_final_value (interval);
|
||||
g_assert (G_VALUE_HOLDS (final, CLUTTER_TYPE_COLOR));
|
||||
|
||||
g_object_unref (script);
|
||||
g_free (test_file);
|
||||
}
|
||||
CLUTTER_TEST_SUITE (
|
||||
CLUTTER_TEST_UNIT ("/script/single-object", script_single)
|
||||
CLUTTER_TEST_UNIT ("/script/container-child", script_child)
|
||||
CLUTTER_TEST_UNIT ("/script/named-object", script_named_object)
|
||||
CLUTTER_TEST_UNIT ("/script/animation", script_animation)
|
||||
CLUTTER_TEST_UNIT ("/script/implicit-alpha", script_implicit_alpha)
|
||||
CLUTTER_TEST_UNIT ("/script/object-property", script_object_property)
|
||||
CLUTTER_TEST_UNIT ("/script/layout-property", script_layout_property)
|
||||
CLUTTER_TEST_UNIT ("/script/actor-margin", script_margin)
|
||||
)
|
||||
|
@ -2,8 +2,6 @@
|
||||
#include <clutter/clutter.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "test-conform-common.h"
|
||||
|
||||
typedef struct {
|
||||
gunichar unichar;
|
||||
const char bytes[6];
|
||||
@ -16,7 +14,7 @@ test_text_data[] = {
|
||||
{ 0x2665, "\xe2\x99\xa5", 3 } /* BLACK HEART SUIT */
|
||||
};
|
||||
|
||||
void
|
||||
static void
|
||||
text_utf8_validation (void)
|
||||
{
|
||||
int i;
|
||||
@ -32,11 +30,11 @@ text_utf8_validation (void)
|
||||
|
||||
nbytes = g_unichar_to_utf8 (t->unichar, bytes);
|
||||
bytes[nbytes] = '\0';
|
||||
g_assert (nbytes == t->nbytes);
|
||||
g_assert_cmpint (nbytes, ==, t->nbytes);
|
||||
g_assert (memcmp (t->bytes, bytes, nbytes) == 0);
|
||||
|
||||
unichar = g_utf8_get_char_validated (bytes, nbytes);
|
||||
g_assert (unichar == t->unichar);
|
||||
g_assert_cmpint (unichar, ==, t->unichar);
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,10 +67,11 @@ insert_unichar (ClutterText *text, gunichar unichar, int position)
|
||||
clutter_text_insert_unichar (text, unichar);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
text_set_empty (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
g_object_ref_sink (text);
|
||||
|
||||
g_assert_cmpstr (clutter_text_get_text (text), ==, "");
|
||||
g_assert_cmpint (*clutter_text_get_text (text), ==, '\0');
|
||||
@ -86,10 +85,11 @@ text_set_empty (void)
|
||||
clutter_actor_destroy (CLUTTER_ACTOR (text));
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
text_set_text (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
g_object_ref_sink (text);
|
||||
|
||||
clutter_text_set_text (text, "abcdef");
|
||||
g_assert_cmpint (get_nchars (text), ==, 6);
|
||||
@ -107,12 +107,14 @@ text_set_text (void)
|
||||
clutter_actor_destroy (CLUTTER_ACTOR (text));
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
text_append_some (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
int i;
|
||||
|
||||
g_object_ref_sink (text);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (test_text_data); i++)
|
||||
{
|
||||
const TestData *t = &test_text_data[i];
|
||||
@ -133,12 +135,14 @@ text_append_some (void)
|
||||
clutter_actor_destroy (CLUTTER_ACTOR (text));
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
text_prepend_some (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
int i;
|
||||
|
||||
g_object_ref_sink (text);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (test_text_data); i++)
|
||||
{
|
||||
const TestData *t = &test_text_data[i];
|
||||
@ -165,12 +169,14 @@ text_prepend_some (void)
|
||||
clutter_actor_destroy (CLUTTER_ACTOR (text));
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
text_insert (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
int i;
|
||||
|
||||
g_object_ref_sink (text);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (test_text_data); i++)
|
||||
{
|
||||
const TestData *t = &test_text_data[i];
|
||||
@ -190,12 +196,14 @@ text_insert (void)
|
||||
clutter_actor_destroy (CLUTTER_ACTOR (text));
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
text_delete_chars (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
int i;
|
||||
|
||||
g_object_ref_sink (text);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (test_text_data); i++)
|
||||
{
|
||||
const TestData *t = &test_text_data[i];
|
||||
@ -222,12 +230,14 @@ text_delete_chars (void)
|
||||
clutter_actor_destroy (CLUTTER_ACTOR (text));
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
text_get_chars (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
gchar *chars;
|
||||
|
||||
g_object_ref_sink (text);
|
||||
|
||||
clutter_text_set_text (text, "00abcdef11");
|
||||
g_assert_cmpint (get_nchars (text), ==, 10);
|
||||
g_assert_cmpint (get_nbytes (text), ==, 10);
|
||||
@ -252,12 +262,14 @@ text_get_chars (void)
|
||||
clutter_actor_destroy (CLUTTER_ACTOR (text));
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
text_delete_text (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
int i;
|
||||
|
||||
g_object_ref_sink (text);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (test_text_data); i++)
|
||||
{
|
||||
const TestData *t = &test_text_data[i];
|
||||
@ -282,11 +294,13 @@ text_delete_text (void)
|
||||
clutter_actor_destroy (CLUTTER_ACTOR (text));
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
text_password_char (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
|
||||
g_object_ref_sink (text);
|
||||
|
||||
g_assert_cmpint (clutter_text_get_password_char (text), ==, 0);
|
||||
|
||||
clutter_text_set_text (text, "hello");
|
||||
@ -339,12 +353,14 @@ send_unichar (ClutterText *text, gunichar unichar)
|
||||
clutter_event_free (event);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
text_cursor (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
int i;
|
||||
|
||||
g_object_ref_sink (text);
|
||||
|
||||
/* only editable entries listen to events */
|
||||
clutter_text_set_editable (text, TRUE);
|
||||
|
||||
@ -385,12 +401,14 @@ text_cursor (void)
|
||||
clutter_actor_destroy (CLUTTER_ACTOR (text));
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
text_event (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
int i;
|
||||
|
||||
g_object_ref_sink (text);
|
||||
|
||||
/* only editable entries listen to events */
|
||||
clutter_text_set_editable (text, TRUE);
|
||||
|
||||
@ -449,7 +467,7 @@ validate_markup_attributes (ClutterText *text,
|
||||
pango_attr_iterator_destroy (iter);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
text_idempotent_use_markup (void)
|
||||
{
|
||||
ClutterText *text;
|
||||
@ -465,6 +483,7 @@ text_idempotent_use_markup (void)
|
||||
text = g_object_new (CLUTTER_TYPE_TEXT,
|
||||
"text", contents, "use-markup", TRUE,
|
||||
NULL);
|
||||
g_object_ref_sink (text);
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("Contents: '%s' (expected: '%s')\n",
|
||||
@ -502,3 +521,19 @@ text_idempotent_use_markup (void)
|
||||
|
||||
clutter_actor_destroy (CLUTTER_ACTOR (text));
|
||||
}
|
||||
|
||||
CLUTTER_TEST_SUITE (
|
||||
CLUTTER_TEST_UNIT ("/text/utf8-validation", text_utf8_validation)
|
||||
CLUTTER_TEST_UNIT ("/text/set-empty", text_set_empty)
|
||||
CLUTTER_TEST_UNIT ("/text/set-text", text_set_text)
|
||||
CLUTTER_TEST_UNIT ("/text/append-some", text_append_some)
|
||||
CLUTTER_TEST_UNIT ("/text/prepend-some", text_prepend_some)
|
||||
CLUTTER_TEST_UNIT ("/text/insert", text_insert)
|
||||
CLUTTER_TEST_UNIT ("/text/delete-chars", text_delete_chars)
|
||||
CLUTTER_TEST_UNIT ("/text/get-chars", text_get_chars)
|
||||
CLUTTER_TEST_UNIT ("/text/delete-text", text_delete_text)
|
||||
CLUTTER_TEST_UNIT ("/text/password-char", text_password_char)
|
||||
CLUTTER_TEST_UNIT ("/text/cursor", text_cursor)
|
||||
CLUTTER_TEST_UNIT ("/text/event", text_event)
|
||||
CLUTTER_TEST_UNIT ("/text/idempotent-use-markup", text_idempotent_use_markup)
|
||||
)
|
||||
|
@ -1,9 +1,7 @@
|
||||
#include <glib.h>
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include <clutter/clutter.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "test-conform-common.h"
|
||||
|
||||
static CoglHandle
|
||||
make_texture (void)
|
||||
{
|
||||
@ -28,17 +26,16 @@ make_texture (void)
|
||||
(guchar *)data);
|
||||
}
|
||||
|
||||
void
|
||||
texture_pick_with_alpha (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
static void
|
||||
texture_pick_with_alpha (void)
|
||||
{
|
||||
ClutterTexture *tex = CLUTTER_TEXTURE (clutter_texture_new ());
|
||||
ClutterStage *stage = CLUTTER_STAGE (clutter_stage_new ());
|
||||
ClutterStage *stage = CLUTTER_STAGE (clutter_test_get_stage ());
|
||||
ClutterActor *actor;
|
||||
|
||||
clutter_texture_set_cogl_texture (tex, make_texture ());
|
||||
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), CLUTTER_ACTOR (tex));
|
||||
clutter_actor_add_child (CLUTTER_ACTOR (stage), CLUTTER_ACTOR (tex));
|
||||
|
||||
clutter_actor_show (CLUTTER_ACTOR (stage));
|
||||
|
||||
@ -80,10 +77,8 @@ texture_pick_with_alpha (TestConformSimpleFixture *fixture,
|
||||
if (g_test_verbose ())
|
||||
g_print ("actor @ (10, 10) = %p\n", actor);
|
||||
g_assert (actor == CLUTTER_ACTOR (tex));
|
||||
|
||||
clutter_actor_destroy (CLUTTER_ACTOR (stage));
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("OK\n");
|
||||
}
|
||||
|
||||
CLUTTER_TEST_SUITE (
|
||||
CLUTTER_TEST_UNIT ("/texture/pick-with-alpha", texture_pick_with_alpha)
|
||||
)
|
||||
|
@ -1,11 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include "test-conform-common.h"
|
||||
|
||||
void
|
||||
units_cache (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
static void
|
||||
units_cache (void)
|
||||
{
|
||||
ClutterUnits units;
|
||||
ClutterSettings *settings;
|
||||
@ -28,9 +24,8 @@ units_cache (TestConformSimpleFixture *fixture,
|
||||
g_object_set (settings, "font-dpi", old_dpi, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
units_constructors (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
static void
|
||||
units_constructors (void)
|
||||
{
|
||||
ClutterUnits units, units_cm;
|
||||
|
||||
@ -56,9 +51,8 @@ units_constructors (TestConformSimpleFixture *fixture,
|
||||
clutter_units_to_pixels (&units_cm));
|
||||
}
|
||||
|
||||
void
|
||||
units_string (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
static void
|
||||
units_string (void)
|
||||
{
|
||||
ClutterUnits units;
|
||||
gchar *string;
|
||||
@ -129,3 +123,9 @@ units_string (TestConformSimpleFixture *fixture,
|
||||
|
||||
g_free (string);
|
||||
}
|
||||
|
||||
CLUTTER_TEST_SUITE (
|
||||
CLUTTER_TEST_UNIT ("/units/string", units_string)
|
||||
CLUTTER_TEST_UNIT ("/units/cache", units_cache)
|
||||
CLUTTER_TEST_UNIT ("/units/constructors", units_constructors)
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user