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
|
|
|
|
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 { \
|
2008-11-07 19:32:28 +00:00
|
|
|
extern void FUNC (TestConformSimpleFixture *fixture, gconstpointer data); \
|
|
|
|
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
|
|
|
|
* "/skip" namespace and execute a dummy function that will always
|
|
|
|
* pass.
|
|
|
|
*/
|
|
|
|
#define TEST_CONFORM_SKIP(CONDITION, NAMESPACE, FUNC) G_STMT_START { \
|
|
|
|
if (CONDITION) { \
|
|
|
|
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); \
|
|
|
|
} else { TEST_CONFORM_SIMPLE (NAMESPACE, FUNC); } } 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 { \
|
|
|
|
g_test_add ("/todo" NAMESPACE "/" #FUNC, \
|
|
|
|
TestConformSimpleFixture, \
|
|
|
|
shared_state, \
|
|
|
|
test_conform_simple_fixture_setup, \
|
|
|
|
test_conform_skip_test, \
|
|
|
|
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
|
|
|
{
|
2008-11-18 13:06:02 +00:00
|
|
|
#ifdef HAVE_CLUTTER_GLX
|
|
|
|
/* on X11 we need a display connection to run the test suite */
|
2009-05-27 22:39:18 +00:00
|
|
|
const gchar *display = g_getenv ("DISPLAY");
|
2008-11-18 13:06:02 +00:00
|
|
|
if (!display || *display == '\0')
|
|
|
|
{
|
|
|
|
g_print ("No DISPLAY found. Unable to run the conformance "
|
|
|
|
"test suite without a display.");
|
2009-08-14 14:58:00 +00:00
|
|
|
|
|
|
|
exit (EXIT_SUCCESS);
|
2008-11-18 13:06:02 +00:00
|
|
|
}
|
|
|
|
#endif
|
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
|
|
|
|
2008-11-07 19:32:28 +00:00
|
|
|
g_test_bug_base ("http://bugzilla.openedhand.com/show_bug.cgi?id=%s");
|
|
|
|
|
|
|
|
/* 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;
|
2009-01-20 21:12:44 +00:00
|
|
|
|
2009-05-22 15:59:14 +00:00
|
|
|
g_assert (clutter_init (shared_state->argc_addr, shared_state->argv_addr)
|
|
|
|
== CLUTTER_INIT_SUCCESS);
|
2009-08-14 14:58:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main (int argc, char **argv)
|
|
|
|
{
|
|
|
|
clutter_test_init (&argc, &argv);
|
2009-05-22 15:59:14 +00:00
|
|
|
|
2008-11-10 11:48:00 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/timeline", test_timeline);
|
2009-02-14 11:41:55 +00:00
|
|
|
TEST_CONFORM_SKIP (!g_test_slow (), "/timeline", test_timeline_interpolate);
|
|
|
|
TEST_CONFORM_SKIP (!g_test_slow (), "/timeline", test_timeline_rewind);
|
2009-01-20 21:12:44 +00:00
|
|
|
|
2008-11-07 19:32:28 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/picking", test_pick);
|
|
|
|
|
2008-12-11 11:45:37 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/text", test_text_utf8_validation);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", test_text_empty);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", test_text_set_empty);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", test_text_set_text);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", test_text_append_some);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", test_text_prepend_some);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", test_text_insert);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", test_text_delete_chars);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", test_text_delete_text);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", test_text_cursor);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", test_text_event);
|
2008-12-11 11:59:50 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/text", test_text_get_chars);
|
2008-12-11 12:13:26 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/text", test_text_cache);
|
2009-01-06 15:30:31 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/text", test_text_password_char);
|
2008-12-11 11:45:37 +00:00
|
|
|
|
2008-11-07 19:32:28 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/rectangle", test_rect_set_size);
|
|
|
|
TEST_CONFORM_SIMPLE ("/rectangle", test_rect_set_color);
|
|
|
|
|
2008-11-08 15:56:22 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/invariants", test_initial_state);
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/invariants", test_shown_not_parented);
|
2008-11-18 12:16:00 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/invariants", test_realized);
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/invariants", test_realize_not_recursive);
|
|
|
|
TEST_CONFORM_SIMPLE ("/invariants", test_map_recursive);
|
2008-11-08 15:56:22 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/invariants", test_mapped);
|
|
|
|
TEST_CONFORM_SIMPLE ("/invariants", test_show_on_set_parent);
|
2009-06-12 02:46:38 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/invariants", test_clone_no_map);
|
2008-11-08 15:56:22 +00:00
|
|
|
|
2008-11-12 14:41:01 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/opacity", test_label_opacity);
|
|
|
|
TEST_CONFORM_SIMPLE ("/opacity", test_rectangle_opacity);
|
|
|
|
TEST_CONFORM_SIMPLE ("/opacity", test_paint_opacity);
|
2008-11-07 19:32:28 +00:00
|
|
|
|
2009-09-17 13:25:29 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/texture", test_texture_fbo);
|
2010-05-10 16:43:17 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/texture/cairo", test_clutter_cairo_texture);
|
2008-11-28 17:36:37 +00:00
|
|
|
|
2008-12-05 13:13:37 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/path", test_path);
|
|
|
|
|
2008-12-08 13:57:10 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/binding-pool", test_binding_pool);
|
|
|
|
|
2010-01-22 15:38:31 +00:00
|
|
|
#if 0
|
2009-01-22 13:14:02 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor", test_anchors);
|
2010-01-22 15:38:31 +00:00
|
|
|
#endif
|
2009-12-18 23:29:11 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor", test_actor_destruction);
|
2009-01-22 13:14:02 +00:00
|
|
|
|
2009-02-14 11:45:27 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/model", test_list_model_populate);
|
|
|
|
TEST_CONFORM_SIMPLE ("/model", test_list_model_iterate);
|
2009-04-29 14:39:23 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/model", test_list_model_filter);
|
2010-02-25 22:47:49 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/model", test_list_model_from_script);
|
2009-02-14 11:45:27 +00:00
|
|
|
|
2009-06-01 17:43:47 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/color", test_color_from_string);
|
|
|
|
TEST_CONFORM_SIMPLE ("/color", test_color_to_string);
|
2009-07-27 10:46:26 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/color", test_color_hls_roundtrip);
|
2010-01-14 14:07:04 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/color", test_color_operators);
|
2009-06-01 17:43:47 +00:00
|
|
|
|
2009-06-03 10:12:09 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/units", test_units_constructors);
|
|
|
|
TEST_CONFORM_SIMPLE ("/units", test_units_string);
|
2009-10-16 14:25:37 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/units", test_units_cache);
|
2009-06-03 10:12:09 +00:00
|
|
|
|
2009-08-25 16:55:51 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/group", test_group_depth_sorting);
|
|
|
|
|
2009-09-14 20:45:51 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/sizing", test_fixed_size);
|
2009-09-15 10:09:49 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/sizing", test_preferred_size);
|
2009-09-14 20:45:51 +00:00
|
|
|
|
2009-11-04 11:50:45 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/script", test_script_single);
|
2009-11-04 16:45:44 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/script", test_script_child);
|
2009-11-06 10:53:43 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/script", test_script_implicit_alpha);
|
2009-11-06 11:32:28 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/script", test_script_object_property);
|
2009-11-13 14:10:29 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/script", test_script_animation);
|
2009-11-30 18:22:26 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/script", test_script_named_object);
|
2010-02-08 15:52:18 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/script", test_animator_base);
|
|
|
|
TEST_CONFORM_SIMPLE ("/script", test_animator_properties);
|
2010-02-24 16:43:17 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/script", test_animator_multi_properties);
|
2009-11-04 11:50:45 +00:00
|
|
|
|
2010-02-02 12:56:04 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/behaviours", test_behaviours);
|
|
|
|
|
2009-11-27 00:28:39 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_fixed);
|
|
|
|
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_backface_culling);
|
|
|
|
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_materials);
|
|
|
|
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_blend_strings);
|
|
|
|
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_premult);
|
|
|
|
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_readpixels);
|
2010-04-08 16:18:40 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_path);
|
2009-11-27 00:28:39 +00:00
|
|
|
|
|
|
|
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-01-18 09:22:04 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_sub_texture);
|
2010-01-22 15:38:31 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_pixel_buffer);
|
2010-03-02 15:18:00 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_texture_rectangle);
|
2010-03-31 17:54:34 +00:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_wrap_modes);
|
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);
|
|
|
|
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_offscreen);
|
|
|
|
|
2008-11-12 14:41:01 +00:00
|
|
|
return g_test_run ();
|
|
|
|
}
|