2008-11-18 13:06:02 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2008-11-07 19:32:28 +00:00
|
|
|
#include <clutter/clutter.h>
|
|
|
|
|
|
|
|
#include <glib.h>
|
2009-08-14 14:58:00 +00:00
|
|
|
#include <locale.h>
|
2008-11-07 19:32:28 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "test-conform-common.h"
|
|
|
|
|
2009-02-14 11:41:55 +00:00
|
|
|
static void
|
|
|
|
test_conform_skip_test (TestConformSimpleFixture *fixture,
|
|
|
|
gconstpointer data)
|
|
|
|
{
|
|
|
|
/* void */
|
|
|
|
}
|
2008-11-07 19:32:28 +00:00
|
|
|
|
2010-10-12 16:11:52 +00:00
|
|
|
static void
|
|
|
|
test_conform_todo_test (TestConformSimpleFixture *fixture,
|
|
|
|
gconstpointer data)
|
|
|
|
{
|
|
|
|
#ifdef G_OS_UNIX
|
|
|
|
const TestConformTodo *todo = data;
|
|
|
|
|
|
|
|
if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
|
|
|
|
{
|
|
|
|
todo->func (fixture, NULL);
|
|
|
|
exit (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_test_trap_assert_failed ();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2010-10-12 16:31:15 +00:00
|
|
|
void
|
|
|
|
verify_failure (TestConformSimpleFixture *fixture,
|
|
|
|
gconstpointer data)
|
|
|
|
{
|
|
|
|
g_assert (FALSE);
|
|
|
|
}
|
|
|
|
|
2009-08-14 14:58:00 +00:00
|
|
|
static TestConformSharedState *shared_state = NULL;
|
|
|
|
|
2008-11-07 19:32:28 +00:00
|
|
|
/* This is a bit of sugar for adding new conformance tests:
|
|
|
|
*
|
|
|
|
* - It adds an extern function definition just to save maintaining a header
|
|
|
|
* that lists test entry points.
|
|
|
|
* - It sets up callbacks for a fixture, which lets us share initialization
|
|
|
|
* *code* between tests. (see test-conform-common.c)
|
|
|
|
* - It passes in a shared *data* pointer that is initialised once in main(),
|
|
|
|
* that gets passed to the fixture setup and test functions. (See the
|
|
|
|
* definition in test-conform-common.h)
|
|
|
|
*/
|
2009-02-14 11:41:55 +00:00
|
|
|
#define TEST_CONFORM_SIMPLE(NAMESPACE, FUNC) G_STMT_START { \
|
2010-10-12 16:31:15 +00:00
|
|
|
extern void FUNC (TestConformSimpleFixture *, gconstpointer); \
|
|
|
|
g_test_add ("/conform" NAMESPACE "/" #FUNC, \
|
|
|
|
TestConformSimpleFixture, \
|
|
|
|
shared_state, /* data argument for test */ \
|
|
|
|
test_conform_simple_fixture_setup, \
|
|
|
|
FUNC, \
|
2009-02-14 11:41:55 +00:00
|
|
|
test_conform_simple_fixture_teardown); } G_STMT_END
|
2008-11-07 19:32:28 +00:00
|
|
|
|
2009-02-14 11:41:55 +00:00
|
|
|
/* this is a macro that conditionally executes a test if CONDITION
|
|
|
|
* evaluates to TRUE; otherwise, it will put the test under the
|
2012-02-27 12:54:23 +00:00
|
|
|
* "/skipped" namespace and execute a dummy function that will always
|
2009-02-14 11:41:55 +00:00
|
|
|
* pass.
|
|
|
|
*/
|
|
|
|
#define TEST_CONFORM_SKIP(CONDITION, NAMESPACE, FUNC) G_STMT_START { \
|
2012-02-27 12:54:23 +00:00
|
|
|
if (CONDITION) { TEST_CONFORM_SIMPLE (NAMESPACE, FUNC); } \
|
|
|
|
else { \
|
2009-02-14 11:41:55 +00:00
|
|
|
g_test_add ("/skipped" NAMESPACE "/" #FUNC, \
|
|
|
|
TestConformSimpleFixture, \
|
|
|
|
shared_state, /* data argument for test */ \
|
|
|
|
test_conform_simple_fixture_setup, \
|
|
|
|
test_conform_skip_test, \
|
|
|
|
test_conform_simple_fixture_teardown); \
|
2012-02-27 12:54:23 +00:00
|
|
|
} } G_STMT_END
|
2008-11-07 19:32:28 +00:00
|
|
|
|
2009-02-19 16:51:37 +00:00
|
|
|
#define TEST_CONFORM_TODO(NAMESPACE, FUNC) G_STMT_START { \
|
2010-10-12 16:11:52 +00:00
|
|
|
extern void FUNC (TestConformSimpleFixture *, gconstpointer); \
|
|
|
|
TestConformTodo *_clos = g_new0 (TestConformTodo, 1); \
|
|
|
|
_clos->name = g_strdup ( #FUNC ); \
|
|
|
|
_clos->func = FUNC; \
|
|
|
|
g_test_add ("/todo" NAMESPACE "/" #FUNC, \
|
2009-02-19 16:51:37 +00:00
|
|
|
TestConformSimpleFixture, \
|
2010-10-12 16:11:52 +00:00
|
|
|
_clos, \
|
2009-02-19 16:51:37 +00:00
|
|
|
test_conform_simple_fixture_setup, \
|
2010-10-12 16:11:52 +00:00
|
|
|
test_conform_todo_test, \
|
2009-02-19 16:51:37 +00:00
|
|
|
test_conform_simple_fixture_teardown); } G_STMT_END
|
|
|
|
|
2009-11-04 11:47:09 +00:00
|
|
|
gchar *
|
|
|
|
clutter_test_get_data_file (const gchar *filename)
|
|
|
|
{
|
|
|
|
return g_build_filename (TESTS_DATADIR, filename, NULL);
|
|
|
|
}
|
|
|
|
|
2009-08-14 14:58:00 +00:00
|
|
|
static void
|
|
|
|
clutter_test_init (gint *argc,
|
|
|
|
gchar ***argv)
|
2008-11-07 19:32:28 +00:00
|
|
|
{
|
2009-06-08 17:13:18 +00:00
|
|
|
/* Turning of sync-to-vblank removes a dependency on the specifics of the
|
|
|
|
* test environment. It also means that the timeline-only tests are
|
|
|
|
* throttled to a reasonable frame rate rather than running in tight
|
|
|
|
* infinite loop.
|
|
|
|
*/
|
|
|
|
g_setenv ("CLUTTER_VBLANK", "none", FALSE);
|
|
|
|
|
2009-08-14 14:58:00 +00:00
|
|
|
g_test_init (argc, argv, NULL);
|
2009-01-20 21:12:44 +00:00
|
|
|
|
2012-02-27 12:54:23 +00:00
|
|
|
g_test_bug_base ("http://bugzilla.gnome.org/show_bug.cgi?id=%s");
|
2008-11-07 19:32:28 +00:00
|
|
|
|
|
|
|
/* Initialise the state you need to share with everything.
|
|
|
|
*/
|
2009-08-14 14:58:00 +00:00
|
|
|
shared_state = g_new0 (TestConformSharedState, 1);
|
|
|
|
shared_state->argc_addr = argc;
|
|
|
|
shared_state->argv_addr = argv;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main (int argc, char **argv)
|
|
|
|
{
|
|
|
|
clutter_test_init (&argc, &argv);
|
2009-05-22 15:59:14 +00:00
|
|
|
|
2010-10-11 15:16:45 +00:00
|
|
|
/* This file is run through a sed script during the make step so the
|
|
|
|
lines containing the tests need to be formatted on a single line
|
|
|
|
each. To comment out a test use the SKIP or TODO macros. Using
|
|
|
|
#if 0 would break the script. */
|
|
|
|
|
2010-10-12 16:31:15 +00:00
|
|
|
/* sanity check for the test suite itself */
|
2010-10-12 16:11:52 +00:00
|
|
|
TEST_CONFORM_TODO ("/suite", verify_failure);
|
|
|
|
|
2011-12-18 20:59:07 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_add_child);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_insert_child);
|
2011-12-18 21:09:44 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_raise_child);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_lower_child);
|
2011-12-19 14:37:42 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_replace_child);
|
2011-12-19 18:01:04 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_remove_child);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_remove_all);
|
2012-02-09 16:44:28 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_container_signals);
|
2010-10-12 16:31:15 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_fixed_size);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_preferred_size);
|
2008-11-07 19:32:28 +00:00
|
|
|
|
2012-01-25 15:27:57 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor/iter", actor_iter_traverse_children);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor/iter", actor_iter_traverse_remove);
|
2012-06-27 11:44:22 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor/iter", actor_iter_assignment);
|
2012-01-25 15:27:57 +00:00
|
|
|
|
2012-02-15 13:43:15 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor/invariants", actor_initial_state);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor/invariants", actor_shown_not_parented);
|
2012-03-05 17:45:23 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor/invariants", actor_visibility_not_recursive);
|
2012-02-15 13:43:15 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor/invariants", actor_realized);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor/invariants", actor_realize_not_recursive);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor/invariants", actor_map_recursive);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor/invariants", actor_mapped);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor/invariants", clone_no_map);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor/invariants", actor_contains);
|
actor: rollback pivot translation even on explicit transforms
When setting an explicit transform with clutter_actor_set_transform()
and a non (0,0) pivot-point, clutter_actor_apply_transform() will fail
to roll back the pivot-point translation done before multiplying the
transformation matrix due to the "out:" label being slightly misplaced
in clutter_actor_real_apply_transform().
This works properly:
clutter_actor_set_pivot_point (actor, 0.5, 0.5);
clutter_actor_set_rotation_angle (actor, CLUTTER_Z_AXIS, 30);
This results in the actor being moved to the pivot-point position:
clutter_actor_set_pivot_point (actor, 0.5, 0.5);
clutter_matrix_init_identity(&matrix);
cogl_matrix_rotate (&matrix, 30, 0, 0, 1.0);
clutter_actor_set_transform (actor, &matrix);
This also add a conformance test checking that even when using a
pivot-point, no matter how a rotation is set the resulting
transformation matrix will be the same.
https://bugzilla.gnome.org/show_bug.cgi?id=690214
2012-12-14 17:05:26 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor/invariants", actor_pivot_transformation);
|
2012-01-25 15:27:57 +00:00
|
|
|
|
2010-10-12 16:31:15 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/text", text_utf8_validation);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", text_set_empty);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", text_set_text);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", text_append_some);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", text_prepend_some);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", text_insert);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", text_delete_chars);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", text_delete_text);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", text_cursor);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", text_event);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", text_get_chars);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", text_password_char);
|
2012-02-27 12:54:23 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/text", text_idempotent_use_markup);
|
2010-10-12 16:31:15 +00:00
|
|
|
|
2012-06-18 16:51:48 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/interval", interval_initial_state);
|
2012-06-18 17:04:10 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/interval", interval_transform);
|
2012-06-18 16:51:48 +00:00
|
|
|
|
2012-02-27 13:08:31 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/path", path_base);
|
2008-12-05 13:13:37 +00:00
|
|
|
|
2012-02-27 12:54:23 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/binding-pool", binding_pool);
|
|
|
|
|
|
|
|
TEST_CONFORM_SIMPLE ("/color", color_from_string_valid);
|
|
|
|
TEST_CONFORM_SIMPLE ("/color", color_from_string_invalid);
|
|
|
|
TEST_CONFORM_SIMPLE ("/color", color_to_string);
|
|
|
|
TEST_CONFORM_SIMPLE ("/color", color_hls_roundtrip);
|
|
|
|
TEST_CONFORM_SIMPLE ("/color", color_operators);
|
|
|
|
|
|
|
|
TEST_CONFORM_SIMPLE ("/units", units_constructors);
|
|
|
|
TEST_CONFORM_SIMPLE ("/units", units_string);
|
|
|
|
TEST_CONFORM_SIMPLE ("/units", units_cache);
|
|
|
|
|
|
|
|
TEST_CONFORM_SIMPLE ("/timeline", timeline_base);
|
|
|
|
TEST_CONFORM_SIMPLE ("/timeline", timeline_markers_from_script);
|
|
|
|
TEST_CONFORM_SKIP (g_test_slow (), "/timeline", timeline_interpolation);
|
|
|
|
TEST_CONFORM_SKIP (g_test_slow (), "/timeline", timeline_rewind);
|
timeline: Add support for step() progress
The CSS3 Transitions specification from the W3C defines the possibility
of using a parametrized step() timing function, with the following
prototype:
steps(n_steps, [ start | end ])
where @n_steps represents the number of steps used to divide an interval
between 0 and 1; the 'start' and 'end' tokens describe whether the value
change should happen at the start of the transition, or at the end.
For instance, the "steps(3, start)" timing function has the following
profile:
1 | x
| |
| x---|
| ' |
| x---' |
| ' |
0 |---' |
Whereas the "steps(3, end)" timing function has the following profile:
1 | x---|
| ' |
| x---' |
| ' |
x---' |
| |
0 | |
Since ClutterTimeline uses an enumeration for controlling the progress
mode, we need additional API to define the parameters of the steps()
progress; for this reason, we need a CLUTTER_STEPS enumeration value,
and a method for setting the number of steps and the value transition
policy.
The CSS3 Transitions spec helpfully also defines a step-start and a
step-end shorthands, which expand to step(1, start) and step(1, end)
respectively; we can provide a CLUTTER_STEP_START and CLUTTER_STEP_END
enumeration values for those.
2012-07-19 23:47:48 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/timeline", timeline_progress_mode);
|
|
|
|
TEST_CONFORM_SIMPLE ("/timeline", timeline_progress_step);
|
2012-02-27 12:54:23 +00:00
|
|
|
|
2012-06-07 11:23:49 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/events", events_touch);
|
|
|
|
|
2011-08-15 13:09:24 +00:00
|
|
|
/* FIXME - see bug https://bugzilla.gnome.org/show_bug.cgi?id=655588 */
|
|
|
|
TEST_CONFORM_TODO ("/cally", cally_text);
|
|
|
|
|
2013-02-20 23:31:17 +00:00
|
|
|
#if 0
|
2010-06-01 16:27:59 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_object);
|
2009-11-27 00:28:39 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_fixed);
|
|
|
|
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_materials);
|
|
|
|
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_premult);
|
|
|
|
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_readpixels);
|
|
|
|
|
|
|
|
TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_npot_texture);
|
2010-01-12 11:02:09 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_multitexture);
|
2010-01-15 12:02:09 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_texture_mipmaps);
|
2010-03-02 15:18:00 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_texture_rectangle);
|
2010-06-18 17:51:15 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_texture_pixmap_x11);
|
2010-07-08 13:25:23 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_texture_get_set_data);
|
2011-02-24 20:30:30 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_atlas_migration);
|
2009-11-27 00:28:39 +00:00
|
|
|
|
|
|
|
TEST_CONFORM_SIMPLE ("/cogl/vertex-buffer", test_cogl_vertex_buffer_contiguous);
|
|
|
|
TEST_CONFORM_SIMPLE ("/cogl/vertex-buffer", test_cogl_vertex_buffer_interleved);
|
|
|
|
TEST_CONFORM_SIMPLE ("/cogl/vertex-buffer", test_cogl_vertex_buffer_mutability);
|
|
|
|
|
|
|
|
/* left to the end because they aren't currently very orthogonal and tend to
|
|
|
|
* break subsequent tests! */
|
|
|
|
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_viewport);
|
2013-02-20 23:31:17 +00:00
|
|
|
#endif
|
2009-11-27 00:28:39 +00:00
|
|
|
|
2008-11-12 14:41:01 +00:00
|
|
|
return g_test_run ();
|
|
|
|
}
|