mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
conform: Start cleaning up the conformance test suite
Re-order the units into a sensible list, with basic tests at the beginning, and per-class tests at the end - with Cogl last. Also, start renaming the unit functions from test_<foo> to <foo>, so that the executable wrappers and the reports have sensible names.
This commit is contained in:
parent
b5d5b9628e
commit
d032b9b2bf
@ -151,18 +151,32 @@ test_destroy_init (TestDestroy *self)
|
||||
clutter_actor_set_name (self->tex, "Texture");
|
||||
}
|
||||
|
||||
static void
|
||||
on_destroy (ClutterActor *actor,
|
||||
gpointer data)
|
||||
{
|
||||
gboolean *destroy_called = data;
|
||||
|
||||
*destroy_called = TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
test_actor_destruction (TestConformSimpleFixture *fixture,
|
||||
gconstpointer dummy)
|
||||
actor_destruction (void)
|
||||
{
|
||||
ClutterActor *test = g_object_new (TEST_TYPE_DESTROY, NULL);
|
||||
ClutterActor *child = clutter_rectangle_new ();
|
||||
gboolean destroy_called = FALSE;
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("Adding external child...\n");
|
||||
|
||||
clutter_actor_set_name (child, "Child");
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (test), child);
|
||||
g_signal_connect (child, "destroy", G_CALLBACK (on_destroy), &destroy_called);
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("Calling destroy()...\n");
|
||||
|
||||
clutter_actor_destroy (test);
|
||||
g_assert (destroy_called);
|
||||
}
|
||||
|
@ -5,13 +5,6 @@
|
||||
|
||||
#include "test-conform-common.h"
|
||||
|
||||
void
|
||||
verify_failure (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
{
|
||||
g_assert (FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
test_initial_state (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
|
@ -79,8 +79,7 @@ test_actor_init (TestActor *self)
|
||||
}
|
||||
|
||||
void
|
||||
test_preferred_size (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
actor_preferred_size (void)
|
||||
{
|
||||
ClutterActor *test;
|
||||
TestActor *self;
|
||||
@ -140,8 +139,7 @@ test_preferred_size (TestConformSimpleFixture *fixture,
|
||||
}
|
||||
|
||||
void
|
||||
test_fixed_size (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
actor_fixed_size (void)
|
||||
{
|
||||
ClutterActor *rect;
|
||||
gboolean min_width_set, nat_width_set;
|
||||
|
@ -672,8 +672,7 @@ idle_cb (gpointer data)
|
||||
}
|
||||
|
||||
void
|
||||
test_anchors (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
actor_anchors (void)
|
||||
{
|
||||
TestState state;
|
||||
ClutterActor *stage;
|
||||
@ -701,8 +700,5 @@ test_anchors (TestConformSimpleFixture *fixture,
|
||||
g_idle_remove_by_data (&state);
|
||||
|
||||
clutter_actor_destroy (state.rect);
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("OK\n");
|
||||
}
|
||||
|
||||
|
@ -17,8 +17,7 @@ test_text_data[] = {
|
||||
};
|
||||
|
||||
void
|
||||
test_text_utf8_validation (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
text_utf8_validation (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -71,8 +70,7 @@ insert_unichar (ClutterText *text, gunichar unichar, int position)
|
||||
}
|
||||
|
||||
void
|
||||
test_text_empty (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
text_set_empty (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
|
||||
@ -80,16 +78,6 @@ test_text_empty (TestConformSimpleFixture *fixture,
|
||||
g_assert_cmpint (*clutter_text_get_text (text), ==, '\0');
|
||||
g_assert_cmpint (clutter_text_get_cursor_position (text), ==, -1);
|
||||
|
||||
clutter_actor_destroy (CLUTTER_ACTOR (text));
|
||||
}
|
||||
|
||||
void
|
||||
test_text_set_empty (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
|
||||
/* annoyingly slightly different from initially empty */
|
||||
clutter_text_set_text (text, "");
|
||||
g_assert_cmpint (get_nchars (text), ==, 0);
|
||||
g_assert_cmpint (get_nbytes (text), ==, 0);
|
||||
@ -99,8 +87,7 @@ test_text_set_empty (TestConformSimpleFixture *fixture,
|
||||
}
|
||||
|
||||
void
|
||||
test_text_set_text (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
text_set_text (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
|
||||
@ -121,8 +108,7 @@ test_text_set_text (TestConformSimpleFixture *fixture,
|
||||
}
|
||||
|
||||
void
|
||||
test_text_append_some (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
text_append_some (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
int i;
|
||||
@ -148,8 +134,7 @@ test_text_append_some (TestConformSimpleFixture *fixture,
|
||||
}
|
||||
|
||||
void
|
||||
test_text_prepend_some (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
text_prepend_some (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
int i;
|
||||
@ -181,8 +166,7 @@ test_text_prepend_some (TestConformSimpleFixture *fixture,
|
||||
}
|
||||
|
||||
void
|
||||
test_text_insert (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
text_insert (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
int i;
|
||||
@ -207,8 +191,7 @@ test_text_insert (TestConformSimpleFixture *fixture,
|
||||
}
|
||||
|
||||
void
|
||||
test_text_delete_chars (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
text_delete_chars (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
int i;
|
||||
@ -240,8 +223,7 @@ test_text_delete_chars (TestConformSimpleFixture *fixture,
|
||||
}
|
||||
|
||||
void
|
||||
test_text_get_chars (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
text_get_chars (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
gchar *chars;
|
||||
@ -271,8 +253,7 @@ test_text_get_chars (TestConformSimpleFixture *fixture,
|
||||
}
|
||||
|
||||
void
|
||||
test_text_delete_text (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
text_delete_text (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
int i;
|
||||
@ -302,8 +283,7 @@ test_text_delete_text (TestConformSimpleFixture *fixture,
|
||||
}
|
||||
|
||||
void
|
||||
test_text_password_char (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
text_password_char (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
|
||||
@ -357,8 +337,7 @@ send_unichar (ClutterText *text, gunichar unichar)
|
||||
}
|
||||
|
||||
void
|
||||
test_text_cursor (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
text_cursor (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
int i;
|
||||
@ -404,8 +383,7 @@ test_text_cursor (TestConformSimpleFixture *fixture,
|
||||
}
|
||||
|
||||
void
|
||||
test_text_event (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
text_event (void)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (clutter_text_new ());
|
||||
int i;
|
||||
|
@ -32,6 +32,13 @@ test_conform_todo_test (TestConformSimpleFixture *fixture,
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
verify_failure (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
{
|
||||
g_assert (FALSE);
|
||||
}
|
||||
|
||||
static TestConformSharedState *shared_state = NULL;
|
||||
|
||||
/* This is a bit of sugar for adding new conformance tests:
|
||||
@ -45,12 +52,12 @@ static TestConformSharedState *shared_state = NULL;
|
||||
* definition in test-conform-common.h)
|
||||
*/
|
||||
#define TEST_CONFORM_SIMPLE(NAMESPACE, FUNC) G_STMT_START { \
|
||||
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, \
|
||||
extern void FUNC (TestConformSimpleFixture *, gconstpointer); \
|
||||
g_test_add ("/conform" NAMESPACE "/" #FUNC, \
|
||||
TestConformSimpleFixture, \
|
||||
shared_state, /* data argument for test */ \
|
||||
test_conform_simple_fixture_setup, \
|
||||
FUNC, \
|
||||
test_conform_simple_fixture_teardown); } G_STMT_END
|
||||
|
||||
/* this is a macro that conditionally executes a test if CONDITION
|
||||
@ -118,34 +125,14 @@ main (int argc, char **argv)
|
||||
each. To comment out a test use the SKIP or TODO macros. Using
|
||||
#if 0 would break the script. */
|
||||
|
||||
/* this is a sanity check for the test suite itself */
|
||||
/* sanity check for the test suite itself */
|
||||
TEST_CONFORM_TODO ("/suite", verify_failure);
|
||||
|
||||
TEST_CONFORM_SIMPLE ("/timeline", test_timeline);
|
||||
TEST_CONFORM_SKIP (!g_test_slow (), "/timeline", test_timeline_interpolate);
|
||||
TEST_CONFORM_SKIP (!g_test_slow (), "/timeline", test_timeline_rewind);
|
||||
|
||||
TEST_CONFORM_SIMPLE ("/score", test_score);
|
||||
|
||||
TEST_CONFORM_SIMPLE ("/picking", test_pick);
|
||||
|
||||
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);
|
||||
TEST_CONFORM_SIMPLE ("/text", test_text_get_chars);
|
||||
TEST_CONFORM_SIMPLE ("/text", test_text_cache);
|
||||
TEST_CONFORM_SIMPLE ("/text", test_text_password_char);
|
||||
|
||||
TEST_CONFORM_SIMPLE ("/rectangle", test_rect_set_size);
|
||||
TEST_CONFORM_SIMPLE ("/rectangle", test_rect_set_color);
|
||||
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);
|
||||
|
||||
TEST_CONFORM_SIMPLE ("/invariants", test_initial_state);
|
||||
TEST_CONFORM_SIMPLE ("/invariants", test_shown_not_parented);
|
||||
@ -161,6 +148,23 @@ main (int argc, char **argv)
|
||||
TEST_CONFORM_SIMPLE ("/opacity", test_rectangle_opacity);
|
||||
TEST_CONFORM_SIMPLE ("/opacity", test_paint_opacity);
|
||||
|
||||
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);
|
||||
|
||||
TEST_CONFORM_SIMPLE ("/rectangle", test_rect_set_size);
|
||||
TEST_CONFORM_SIMPLE ("/rectangle", test_rect_set_color);
|
||||
|
||||
TEST_CONFORM_SIMPLE ("/texture", test_texture_pick_with_alpha);
|
||||
TEST_CONFORM_SIMPLE ("/texture", test_texture_fbo);
|
||||
TEST_CONFORM_SIMPLE ("/texture/cairo", test_clutter_cairo_texture);
|
||||
@ -169,9 +173,6 @@ main (int argc, char **argv)
|
||||
|
||||
TEST_CONFORM_SIMPLE ("/binding-pool", test_binding_pool);
|
||||
|
||||
TEST_CONFORM_SIMPLE ("/actor", test_anchors);
|
||||
TEST_CONFORM_SIMPLE ("/actor", test_actor_destruction);
|
||||
|
||||
TEST_CONFORM_SIMPLE ("/model", test_list_model_populate);
|
||||
TEST_CONFORM_SIMPLE ("/model", test_list_model_iterate);
|
||||
TEST_CONFORM_SIMPLE ("/model", test_list_model_filter);
|
||||
@ -188,9 +189,6 @@ main (int argc, char **argv)
|
||||
|
||||
TEST_CONFORM_SIMPLE ("/group", test_group_depth_sorting);
|
||||
|
||||
TEST_CONFORM_SIMPLE ("/sizing", test_fixed_size);
|
||||
TEST_CONFORM_SIMPLE ("/sizing", test_preferred_size);
|
||||
|
||||
TEST_CONFORM_SIMPLE ("/script", test_script_single);
|
||||
TEST_CONFORM_SIMPLE ("/script", test_script_child);
|
||||
TEST_CONFORM_SIMPLE ("/script", test_script_implicit_alpha);
|
||||
@ -203,6 +201,12 @@ main (int argc, char **argv)
|
||||
TEST_CONFORM_SIMPLE ("/script", test_state_base);
|
||||
TEST_CONFORM_SIMPLE ("/script", test_script_layout_property);
|
||||
|
||||
TEST_CONFORM_SIMPLE ("/timeline", test_timeline);
|
||||
TEST_CONFORM_SKIP (!g_test_slow (), "/timeline", timeline_interpolation);
|
||||
TEST_CONFORM_SKIP (!g_test_slow (), "/timeline", timeline_rewind);
|
||||
|
||||
TEST_CONFORM_SIMPLE ("/score", test_score);
|
||||
|
||||
TEST_CONFORM_SIMPLE ("/behaviours", test_behaviours);
|
||||
|
||||
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_object);
|
||||
|
@ -117,8 +117,7 @@ on_timeout (State *state)
|
||||
}
|
||||
|
||||
void
|
||||
test_pick (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
actor_picking (void)
|
||||
{
|
||||
int y, x;
|
||||
State state;
|
||||
@ -159,4 +158,3 @@ test_pick (TestConformSimpleFixture *fixture,
|
||||
|
||||
g_assert (state.pass);
|
||||
}
|
||||
|
||||
|
@ -257,8 +257,7 @@ make_layout_like_label (ClutterText *label)
|
||||
}
|
||||
|
||||
void
|
||||
test_text_cache (TestConformSimpleFixture *fixture,
|
||||
gconstpointer _data)
|
||||
text_cache (void)
|
||||
{
|
||||
CallbackData data;
|
||||
|
||||
|
@ -132,8 +132,7 @@ completed_cb (ClutterTimeline *timeline,
|
||||
}
|
||||
|
||||
void
|
||||
test_timeline_interpolate (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
timeline_interpolation (void)
|
||||
{
|
||||
TestState state;
|
||||
|
||||
|
@ -67,8 +67,7 @@ new_frame_cb (ClutterTimeline *timeline,
|
||||
}
|
||||
|
||||
void
|
||||
test_timeline_rewind (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
timeline_rewind (void)
|
||||
{
|
||||
TestState state;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user