603f936745
framework * configure.ac: * tests/*: The tests have been reorganised into different categories: conformance, interactive and micro benchmarks. - conformance tests can be run as part of automated tests - interactive tests are basically all the existing tests - micro benchmarks focus on a single performance metric I converted the timeline tests to conformance tests and also added some tests from Neil Roberts and Ebassi. Note: currently only the conformance tests use the glib test APIs, though the micro benchmarks should too. The other change is to make the unit tests link into monolithic binaries which makes the build time for unit tests considerably faster. To deal with the extra complexity this adds to debugging individual tests I have added some sugar to the makefiles so all the tests can be run directly via a symlink and when an individual test is run this way, then a note is printed to the terminal explaining exactly how that test may be debugged using GDB. There is a convenience make rule: 'make test-report', that will run all the conformance tests and hopefully even open the results in your web browser. It skips some of the slower timeline tests, but you can run those using 'make full-report'
82 lines
2.6 KiB
C
82 lines
2.6 KiB
C
#include <clutter/clutter.h>
|
|
|
|
#include <glib.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "test-conform-common.h"
|
|
|
|
|
|
/* 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)
|
|
*/
|
|
#define TEST_CONFORM_SIMPLE(NAMESPACE, FUNC) \
|
|
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, \
|
|
test_conform_simple_fixture_teardown);
|
|
|
|
|
|
int
|
|
main (int argc, char **argv)
|
|
{
|
|
TestConformSharedState *shared_state = g_new0 (TestConformSharedState, 1);
|
|
|
|
g_test_init (&argc, &argv, NULL);
|
|
|
|
g_test_bug_base ("http://bugzilla.openedhand.com/show_bug.cgi?id=%s");
|
|
|
|
g_assert (clutter_init (shared_state->argc_addr, shared_state->argv_addr)
|
|
== CLUTTER_INIT_SUCCESS);
|
|
|
|
/* Initialise the state you need to share with everything.
|
|
*/
|
|
shared_state->argc_addr = &argc;
|
|
shared_state->argv_addr = &argv;
|
|
|
|
if (g_test_slow ())
|
|
{
|
|
TEST_CONFORM_SIMPLE ("/timeline", test_timeline_dup_frames);
|
|
TEST_CONFORM_SIMPLE ("/timeline", test_timeline_interpolate);
|
|
TEST_CONFORM_SIMPLE ("/timeline", test_timeline_rewind);
|
|
TEST_CONFORM_SIMPLE ("/timeline", test_timeline_smoothness);
|
|
}
|
|
|
|
TEST_CONFORM_SIMPLE ("/picking", test_pick);
|
|
|
|
TEST_CONFORM_SIMPLE ("/label", test_label_cache);
|
|
|
|
TEST_CONFORM_SIMPLE ("/entry", test_entry_utf8_validation);
|
|
TEST_CONFORM_SIMPLE ("/entry", test_entry_empty);
|
|
TEST_CONFORM_SIMPLE ("/entry", test_entry_set_empty);
|
|
TEST_CONFORM_SIMPLE ("/entry", test_entry_set_text);
|
|
|
|
TEST_CONFORM_SIMPLE ("/entry", test_entry_append_some);
|
|
TEST_CONFORM_SIMPLE ("/entry", test_entry_prepend_some);
|
|
TEST_CONFORM_SIMPLE ("/entry", test_entry_insert);
|
|
|
|
TEST_CONFORM_SIMPLE ("/entry", test_entry_delete_chars);
|
|
TEST_CONFORM_SIMPLE ("/entry", test_entry_delete_text);
|
|
|
|
TEST_CONFORM_SIMPLE ("/entry", test_entry_cursor);
|
|
TEST_CONFORM_SIMPLE ("/entry", test_entry_event);
|
|
|
|
TEST_CONFORM_SIMPLE ("/rectangle", test_rect_set_size);
|
|
TEST_CONFORM_SIMPLE ("/rectangle", test_rect_set_color);
|
|
|
|
TEST_CONFORM_SIMPLE ("/fixed", test_fixed_constants);
|
|
|
|
g_test_run ();
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|