2008-11-18 08:06:02 -05:00
|
|
|
#include "config.h"
|
|
|
|
|
2008-11-07 14:32:28 -05:00
|
|
|
#include <clutter/clutter.h>
|
|
|
|
|
|
|
|
#include <glib.h>
|
2009-08-14 10:58:00 -04:00
|
|
|
#include <locale.h>
|
2008-11-07 14:32:28 -05:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "test-conform-common.h"
|
|
|
|
|
2009-02-14 06:41:55 -05:00
|
|
|
static void
|
|
|
|
test_conform_skip_test (TestConformSimpleFixture *fixture,
|
|
|
|
gconstpointer data)
|
|
|
|
{
|
|
|
|
/* void */
|
|
|
|
}
|
2008-11-07 14:32:28 -05:00
|
|
|
|
2010-10-12 12:11:52 -04: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 12:31:15 -04:00
|
|
|
void
|
|
|
|
verify_failure (TestConformSimpleFixture *fixture,
|
|
|
|
gconstpointer data)
|
|
|
|
{
|
|
|
|
g_assert (FALSE);
|
|
|
|
}
|
|
|
|
|
2009-08-14 10:58:00 -04:00
|
|
|
static TestConformSharedState *shared_state = NULL;
|
|
|
|
|
2008-11-07 14:32:28 -05: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 06:41:55 -05:00
|
|
|
#define TEST_CONFORM_SIMPLE(NAMESPACE, FUNC) G_STMT_START { \
|
2010-10-12 12:31:15 -04: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 06:41:55 -05:00
|
|
|
test_conform_simple_fixture_teardown); } G_STMT_END
|
2008-11-07 14:32:28 -05:00
|
|
|
|
2009-02-14 06:41:55 -05: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 14:32:28 -05:00
|
|
|
|
2009-02-19 11:51:37 -05:00
|
|
|
#define TEST_CONFORM_TODO(NAMESPACE, FUNC) G_STMT_START { \
|
2010-10-12 12:11:52 -04: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 11:51:37 -05:00
|
|
|
TestConformSimpleFixture, \
|
2010-10-12 12:11:52 -04:00
|
|
|
_clos, \
|
2009-02-19 11:51:37 -05:00
|
|
|
test_conform_simple_fixture_setup, \
|
2010-10-12 12:11:52 -04:00
|
|
|
test_conform_todo_test, \
|
2009-02-19 11:51:37 -05:00
|
|
|
test_conform_simple_fixture_teardown); } G_STMT_END
|
|
|
|
|
2009-11-04 06:47:09 -05:00
|
|
|
gchar *
|
|
|
|
clutter_test_get_data_file (const gchar *filename)
|
|
|
|
{
|
|
|
|
return g_build_filename (TESTS_DATADIR, filename, NULL);
|
|
|
|
}
|
|
|
|
|
2009-08-14 10:58:00 -04:00
|
|
|
static void
|
|
|
|
clutter_test_init (gint *argc,
|
|
|
|
gchar ***argv)
|
2008-11-07 14:32:28 -05:00
|
|
|
{
|
2009-06-08 13:13:18 -04: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 10:58:00 -04:00
|
|
|
g_test_init (argc, argv, NULL);
|
2009-01-20 16:12:44 -05:00
|
|
|
|
2008-11-07 14:32:28 -05: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 10:58:00 -04: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 11:59:14 -04:00
|
|
|
|
2010-10-11 11:16:45 -04: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 12:31:15 -04:00
|
|
|
/* sanity check for the test suite itself */
|
2010-10-12 12:11:52 -04:00
|
|
|
TEST_CONFORM_TODO ("/suite", verify_failure);
|
|
|
|
|
2011-12-18 15:59:07 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_add_child);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_insert_child);
|
2011-12-18 16:09:44 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_raise_child);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_lower_child);
|
2011-12-19 09:37:42 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_replace_child);
|
2011-12-19 13:01:04 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_remove_child);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_remove_all);
|
2012-02-09 11:44:28 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_container_signals);
|
2010-10-12 12:31:15 -04:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_destruction);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_anchors);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_picking);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_fixed_size);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor", actor_preferred_size);
|
2011-11-28 12:42:49 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor", basic_layout);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor", margin_layout);
|
2011-12-18 15:59:07 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor", test_offscreen_redirect);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor", test_shader_effect);
|
2008-11-07 14:32:28 -05:00
|
|
|
|
2012-01-25 10:27:57 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor/iter", actor_iter_traverse_children);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor/iter", actor_iter_traverse_remove);
|
|
|
|
|
2012-02-15 08:43:15 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor/invariants", actor_initial_state);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor/invariants", actor_shown_not_parented);
|
|
|
|
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", actor_show_on_set_parent);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor/invariants", clone_no_map);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor/invariants", actor_contains);
|
2012-01-25 10:27:57 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/actor/invariants", default_stage);
|
|
|
|
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor/opacity", test_label_opacity);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor/opacity", test_rectangle_opacity);
|
|
|
|
TEST_CONFORM_SIMPLE ("/actor/opacity", test_paint_opacity);
|
2008-11-07 14:32:28 -05:00
|
|
|
|
2010-10-12 12:31:15 -04: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_cache);
|
|
|
|
TEST_CONFORM_SIMPLE ("/text", text_password_char);
|
text: Make :use-markup set idempotent
Setting :use-markup and :text is currently not idempotent, and it
depends on the ordering, e.g.:
g_object_set (actor, "use-markup", TRUE, "text", value, NULL);
does not yield the same results as:
g_object_set (actor, "text", value, "use-markup", TRUE, NULL);
This is particularly jarring when using ClutterText from ClutterScript,
but in general GObject properties should not rely on the order when used
from g_object_set().
The fix is to store the contents of the ClutterText as a separate string
from the displayed text, and use the contents, instead of the displayed
text, when toggling the :use-markup property.
Let's also add a unit test for good measure, to try and catch
regressions.
https://bugzilla.gnome.org/show_bug.cgi?id=651940
2011-09-06 07:45:41 -04:00
|
|
|
TEST_CONFORM_SIMPLE ("/text", idempotent_use_markup);
|
2010-10-12 12:31:15 -04:00
|
|
|
|
|
|
|
TEST_CONFORM_SIMPLE ("/rectangle", test_rect_set_size);
|
|
|
|
TEST_CONFORM_SIMPLE ("/rectangle", test_rect_set_color);
|
|
|
|
|
2009-09-25 14:14:40 -04:00
|
|
|
TEST_CONFORM_SIMPLE ("/texture", test_texture_pick_with_alpha);
|
2009-09-17 09:25:29 -04:00
|
|
|
TEST_CONFORM_SIMPLE ("/texture", test_texture_fbo);
|
2010-05-10 12:43:17 -04:00
|
|
|
TEST_CONFORM_SIMPLE ("/texture/cairo", test_clutter_cairo_texture);
|
2008-11-28 12:36:37 -05:00
|
|
|
|
2008-12-05 08:13:37 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/path", test_path);
|
|
|
|
|
2008-12-08 08:57:10 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/binding-pool", test_binding_pool);
|
|
|
|
|
2009-02-14 06:45:27 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/model", test_list_model_populate);
|
|
|
|
TEST_CONFORM_SIMPLE ("/model", test_list_model_iterate);
|
2009-04-29 10:39:23 -04:00
|
|
|
TEST_CONFORM_SIMPLE ("/model", test_list_model_filter);
|
2010-02-25 17:47:49 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/model", test_list_model_from_script);
|
model: Make sure to emit ::row-changed
Currently, only clutter_model_iter_set_valist() is in charge of emitting
the ClutterModel::row-changed signal. Both the set() and the
set_valist() functions can be called with multiple columns, so we
coalesce the signal emission at the end of the set_valist(), to have a
single ::row-changed emission per change.
The clutter_model_iter_set_value() function is just a thin wrapper
around the set_value() virtual function, but since it's called
internally we cannot add the signal emission there as well, as we'd
break the signal coalescing.
For this reason, we need some code refactoring inside the various set()
variants of ClutterModelIter:
- we only use the internal va_arg variant for both the set() and
set_valist() public functions, to avoid multiple type checks;
- the internal set_valist() calls an internal set_value() method
which calls the virtual function from the iterator vtable;
- a new internal emit_row_changed() method is needed to retrieve
the ClutterModel from the iterator, and emit the signal;
Now, all three variants of the value setter will call an internal
ClutterModelIter::set_value() wrapper, and emit the ::row-changed
signal.
To check that the intended behaviour has been implemented, and it's not
going to be broken, the test suite has grown a new unit which populates
a model and changes a random row.
2011-07-28 10:00:18 -04:00
|
|
|
TEST_CONFORM_SIMPLE ("/model", test_list_model_row_changed);
|
2009-02-14 06:45:27 -05:00
|
|
|
|
2011-11-10 09:15:32 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/color", test_color_from_string_valid);
|
|
|
|
TEST_CONFORM_SIMPLE ("/color", test_color_from_string_invalid);
|
2009-06-01 13:43:47 -04:00
|
|
|
TEST_CONFORM_SIMPLE ("/color", test_color_to_string);
|
2009-07-27 06:46:26 -04:00
|
|
|
TEST_CONFORM_SIMPLE ("/color", test_color_hls_roundtrip);
|
2010-01-14 09:07:04 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/color", test_color_operators);
|
2009-06-01 13:43:47 -04:00
|
|
|
|
2009-06-03 06:12:09 -04:00
|
|
|
TEST_CONFORM_SIMPLE ("/units", test_units_constructors);
|
|
|
|
TEST_CONFORM_SIMPLE ("/units", test_units_string);
|
2009-10-16 10:25:37 -04:00
|
|
|
TEST_CONFORM_SIMPLE ("/units", test_units_cache);
|
2009-06-03 06:12:09 -04:00
|
|
|
|
2009-08-25 12:55:51 -04:00
|
|
|
TEST_CONFORM_SIMPLE ("/group", test_group_depth_sorting);
|
|
|
|
|
2009-11-04 06:50:45 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/script", test_script_single);
|
2009-11-04 11:45:44 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/script", test_script_child);
|
2009-11-06 05:53:43 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/script", test_script_implicit_alpha);
|
2009-11-06 06:32:28 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/script", test_script_object_property);
|
2009-11-13 09:10:29 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/script", test_script_animation);
|
2009-11-30 13:22:26 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/script", test_script_named_object);
|
2010-02-08 10:52:18 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/script", test_animator_base);
|
|
|
|
TEST_CONFORM_SIMPLE ("/script", test_animator_properties);
|
2010-02-24 11:43:17 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/script", test_animator_multi_properties);
|
2010-05-21 09:13:14 -04:00
|
|
|
TEST_CONFORM_SIMPLE ("/script", test_state_base);
|
2010-06-07 17:45:34 -04:00
|
|
|
TEST_CONFORM_SIMPLE ("/script", test_script_layout_property);
|
2009-11-04 06:50:45 -05:00
|
|
|
|
2010-10-12 12:31:15 -04:00
|
|
|
TEST_CONFORM_SIMPLE ("/timeline", test_timeline);
|
2011-11-27 07:18:49 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/timeline", markers_from_script);
|
2010-10-12 12:31:15 -04:00
|
|
|
TEST_CONFORM_SKIP (!g_test_slow (), "/timeline", timeline_interpolation);
|
|
|
|
TEST_CONFORM_SKIP (!g_test_slow (), "/timeline", timeline_rewind);
|
|
|
|
|
|
|
|
TEST_CONFORM_SIMPLE ("/score", test_score);
|
|
|
|
|
2010-02-02 07:56:04 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/behaviours", test_behaviours);
|
|
|
|
|
2011-08-15 09:09:24 -04:00
|
|
|
/* FIXME - see bug https://bugzilla.gnome.org/show_bug.cgi?id=655588 */
|
|
|
|
TEST_CONFORM_TODO ("/cally", cally_text);
|
|
|
|
|
2010-06-01 12:27:59 -04:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_object);
|
2009-11-26 19:28:39 -05: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 06:02:09 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_multitexture);
|
2010-01-15 07:02:09 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_texture_mipmaps);
|
2010-07-05 11:17:34 -04:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_pixel_array);
|
2010-03-02 10:18:00 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_texture_rectangle);
|
2010-06-18 13:51:15 -04:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_texture_pixmap_x11);
|
2010-07-08 09:25:23 -04:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_texture_get_set_data);
|
2011-02-24 15:30:30 -05:00
|
|
|
TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_atlas_migration);
|
2009-11-26 19:28:39 -05: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);
|
|
|
|
|
2008-11-12 09:41:01 -05:00
|
|
|
return g_test_run ();
|
|
|
|
}
|