Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
#include "clutter-test-utils.h"
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <glib-object.h>
|
2019-07-03 07:43:25 -04:00
|
|
|
#include <clutter/clutter.h>
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
|
2022-11-16 14:16:46 -05:00
|
|
|
#include "backends/meta-monitor-manager-private.h"
|
|
|
|
#include "backends/meta-virtual-monitor.h"
|
2020-07-09 15:28:57 -04:00
|
|
|
#include "compositor/meta-plugin-manager.h"
|
2021-03-02 04:21:20 -05:00
|
|
|
#include "core/meta-context-private.h"
|
2022-12-01 15:51:02 -05:00
|
|
|
#include "tests/meta-test-utils.h"
|
2020-07-09 15:28:57 -04:00
|
|
|
|
2022-11-16 14:16:46 -05:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
MetaContext *context;
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
} ClutterTestEnvironment;
|
|
|
|
|
2014-03-05 05:44:19 -05:00
|
|
|
static ClutterTestEnvironment *test_environ = NULL;
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
|
2021-03-03 04:57:40 -05:00
|
|
|
static GMainLoop *clutter_test_main_loop = NULL;
|
|
|
|
|
2019-11-19 18:06:26 -05:00
|
|
|
#define DBUS_NAME_WARNING "Lost or failed to acquire name"
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
log_func (const gchar *log_domain,
|
|
|
|
GLogLevelFlags log_level,
|
|
|
|
const gchar *message,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
if ((log_level & G_LOG_LEVEL_WARNING) &&
|
|
|
|
g_strcmp0 (log_domain, "mutter") == 0 &&
|
|
|
|
g_str_has_prefix (message, DBUS_NAME_WARNING))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2020-07-09 15:28:57 -04:00
|
|
|
/*
|
|
|
|
* clutter_test_init:
|
|
|
|
* @argc: (inout): number of arguments in @argv
|
|
|
|
* @argv: (inout) (array length=argc) (nullable): array of arguments
|
|
|
|
*
|
|
|
|
* Initializes the Clutter test environment.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_test_init (int *argc,
|
|
|
|
char ***argv)
|
|
|
|
{
|
2021-03-03 04:57:40 -05:00
|
|
|
MetaContext *context;
|
|
|
|
|
2022-11-16 14:16:46 -05:00
|
|
|
context = meta_create_test_context (META_CONTEXT_TEST_TYPE_HEADLESS,
|
2021-03-03 04:57:40 -05:00
|
|
|
META_CONTEXT_TEST_FLAG_NO_X11);
|
|
|
|
g_assert (meta_context_configure (context, argc, argv, NULL));
|
|
|
|
g_assert (meta_context_setup (context, NULL));
|
|
|
|
|
|
|
|
test_environ = g_new0 (ClutterTestEnvironment, 1);
|
2022-11-16 14:16:46 -05:00
|
|
|
test_environ->context = context;
|
2021-03-03 04:57:40 -05:00
|
|
|
|
|
|
|
g_assert (meta_context_start (context, NULL));
|
|
|
|
|
|
|
|
clutter_test_main_loop = g_main_loop_new (NULL, FALSE);
|
2020-07-09 15:28:57 -04:00
|
|
|
}
|
|
|
|
|
2014-12-16 08:59:41 -05:00
|
|
|
/**
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
* clutter_test_get_stage:
|
|
|
|
*
|
|
|
|
* Retrieves the #ClutterStage used for testing.
|
|
|
|
*
|
|
|
|
* Return value: (transfer none): the stage used for testing
|
|
|
|
*/
|
|
|
|
ClutterActor *
|
|
|
|
clutter_test_get_stage (void)
|
|
|
|
{
|
2022-05-27 16:55:43 -04:00
|
|
|
MetaContext *context = test_environ->context;
|
|
|
|
MetaBackend *backend = meta_context_get_backend (context);
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
|
2020-05-29 13:31:22 -04:00
|
|
|
return meta_backend_get_stage (backend);
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
}
|
|
|
|
|
2022-12-01 15:51:02 -05:00
|
|
|
void
|
|
|
|
clutter_test_flush_input (void)
|
|
|
|
{
|
|
|
|
meta_flush_input (test_environ->context);
|
|
|
|
}
|
|
|
|
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
typedef struct {
|
|
|
|
gpointer test_func;
|
|
|
|
gpointer test_data;
|
|
|
|
GDestroyNotify test_notify;
|
|
|
|
} ClutterTestData;
|
|
|
|
|
2020-07-09 15:28:57 -04:00
|
|
|
static gboolean
|
|
|
|
list_equal_unsorted (GList *list_a,
|
|
|
|
GList *list_b)
|
|
|
|
{
|
|
|
|
GList *l_a;
|
|
|
|
GList *l_b;
|
|
|
|
|
|
|
|
for (l_a = list_a, l_b = list_b;
|
|
|
|
l_a && l_b;
|
|
|
|
l_a = l_a->next, l_b = l_b->next)
|
|
|
|
{
|
|
|
|
if (l_a->data != l_b->data)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return !l_a && !l_b;
|
|
|
|
}
|
|
|
|
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
static void
|
|
|
|
clutter_test_func_wrapper (gconstpointer data_)
|
|
|
|
{
|
|
|
|
const ClutterTestData *data = data_;
|
2020-05-29 13:31:22 -04:00
|
|
|
ClutterActor *stage;
|
2020-07-09 15:28:57 -04:00
|
|
|
GList *pre_stage_children;
|
|
|
|
GList *post_stage_children;
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
|
2019-11-19 18:06:26 -05:00
|
|
|
g_test_log_set_fatal_handler (log_func, NULL);
|
|
|
|
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
/* ensure that the previous test state has been cleaned up */
|
2020-05-29 13:31:22 -04:00
|
|
|
stage = clutter_test_get_stage ();
|
2020-07-09 15:28:57 -04:00
|
|
|
clutter_actor_hide (stage);
|
|
|
|
|
|
|
|
pre_stage_children = clutter_actor_get_children (stage);
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
|
|
|
|
if (data->test_data != NULL)
|
|
|
|
{
|
|
|
|
GTestDataFunc test_func = data->test_func;
|
|
|
|
|
|
|
|
test_func (data->test_data);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GTestFunc test_func = data->test_func;
|
|
|
|
|
|
|
|
test_func ();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data->test_notify != NULL)
|
|
|
|
data->test_notify (data->test_data);
|
|
|
|
|
2020-07-09 15:28:57 -04:00
|
|
|
post_stage_children = clutter_actor_get_children (stage);
|
|
|
|
|
|
|
|
g_assert_true (list_equal_unsorted (pre_stage_children, post_stage_children));
|
|
|
|
|
|
|
|
g_list_free (pre_stage_children);
|
|
|
|
g_list_free (post_stage_children);
|
|
|
|
|
2020-05-29 13:31:22 -04:00
|
|
|
clutter_actor_hide (stage);
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
}
|
|
|
|
|
2014-12-16 08:59:41 -05:00
|
|
|
/**
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
* clutter_test_add: (skip)
|
2015-03-03 10:53:04 -05:00
|
|
|
* @test_path: unique path for identifying the test
|
|
|
|
* @test_func: function containing the test
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
*
|
|
|
|
* Adds a test unit to the Clutter test environment.
|
|
|
|
*
|
|
|
|
* See also: g_test_add()
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_test_add (const char *test_path,
|
|
|
|
GTestFunc test_func)
|
|
|
|
{
|
|
|
|
clutter_test_add_data_full (test_path, (GTestDataFunc) test_func, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
2014-12-16 08:59:41 -05:00
|
|
|
/**
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
* clutter_test_add_data: (skip)
|
2015-03-03 10:53:04 -05:00
|
|
|
* @test_path: unique path for identifying the test
|
|
|
|
* @test_func: function containing the test
|
|
|
|
* @test_data: data to pass to the test function
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
*
|
|
|
|
* Adds a test unit to the Clutter test environment.
|
|
|
|
*
|
|
|
|
* See also: g_test_add_data_func()
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_test_add_data (const char *test_path,
|
|
|
|
GTestDataFunc test_func,
|
|
|
|
gpointer test_data)
|
|
|
|
{
|
|
|
|
clutter_test_add_data_full (test_path, test_func, test_data, NULL);
|
|
|
|
}
|
|
|
|
|
2014-12-16 08:59:41 -05:00
|
|
|
/**
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
* clutter_test_add_data_full:
|
2015-03-03 10:53:04 -05:00
|
|
|
* @test_path: unique path for identifying the test
|
|
|
|
* @test_func: (scope notified): function containing the test
|
|
|
|
* @test_data: (closure): data to pass to the test function
|
|
|
|
* @test_notify: function called when the test function ends
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
*
|
|
|
|
* Adds a test unit to the Clutter test environment.
|
|
|
|
*
|
|
|
|
* See also: g_test_add_data_func_full()
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_test_add_data_full (const char *test_path,
|
|
|
|
GTestDataFunc test_func,
|
|
|
|
gpointer test_data,
|
|
|
|
GDestroyNotify test_notify)
|
|
|
|
{
|
|
|
|
ClutterTestData *data;
|
|
|
|
|
|
|
|
g_return_if_fail (test_path != NULL);
|
|
|
|
g_return_if_fail (test_func != NULL);
|
|
|
|
|
2014-03-05 05:44:19 -05:00
|
|
|
g_assert (test_environ != NULL);
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
|
|
|
|
data = g_new (ClutterTestData, 1);
|
|
|
|
data->test_func = test_func;
|
|
|
|
data->test_data = test_data;
|
|
|
|
data->test_notify = test_notify;
|
|
|
|
|
|
|
|
g_test_add_data_func_full (test_path, data,
|
|
|
|
clutter_test_func_wrapper,
|
|
|
|
g_free);
|
|
|
|
}
|
|
|
|
|
2014-12-16 08:59:41 -05:00
|
|
|
/**
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
* clutter_test_run:
|
|
|
|
*
|
|
|
|
* Runs the test suite using the units added by calling
|
|
|
|
* clutter_test_add().
|
|
|
|
*
|
|
|
|
* The typical test suite is composed of a list of functions
|
|
|
|
* called by clutter_test_run(), for instance:
|
|
|
|
*
|
|
|
|
* |[
|
|
|
|
* static void unit_foo (void) { ... }
|
|
|
|
*
|
|
|
|
* static void unit_bar (void) { ... }
|
|
|
|
*
|
|
|
|
* static void unit_baz (void) { ... }
|
|
|
|
*
|
|
|
|
* int
|
|
|
|
* main (int argc, char *argv[])
|
|
|
|
* {
|
2014-03-17 19:07:58 -04:00
|
|
|
* clutter_test_init (&argc, &argv);
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
*
|
|
|
|
* clutter_test_add ("/unit/foo", unit_foo);
|
|
|
|
* clutter_test_add ("/unit/bar", unit_bar);
|
|
|
|
* clutter_test_add ("/unit/baz", unit_baz);
|
|
|
|
*
|
|
|
|
* return clutter_test_run ();
|
|
|
|
* }
|
|
|
|
* ]|
|
|
|
|
*
|
|
|
|
* Return value: the exit code for the test suite
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
clutter_test_run (void)
|
|
|
|
{
|
2022-11-16 14:16:46 -05:00
|
|
|
MetaBackend *backend = meta_context_get_backend (test_environ->context);
|
|
|
|
MetaMonitorManager *monitor_manager = meta_backend_get_monitor_manager (backend);
|
|
|
|
MetaVirtualMonitor *virtual_monitor;
|
|
|
|
g_autoptr (MetaVirtualMonitorInfo) monitor_info = NULL;
|
|
|
|
g_autoptr (GError) error = NULL;
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
int res;
|
|
|
|
|
2022-11-18 13:46:09 -05:00
|
|
|
monitor_info = meta_virtual_monitor_info_new (800, 600, 10.0,
|
2022-11-16 14:16:46 -05:00
|
|
|
"MetaTestVendor",
|
|
|
|
"ClutterTestMonitor",
|
|
|
|
"0x123");
|
|
|
|
virtual_monitor = meta_monitor_manager_create_virtual_monitor (monitor_manager,
|
|
|
|
monitor_info,
|
|
|
|
&error);
|
|
|
|
if (!virtual_monitor)
|
|
|
|
g_error ("Failed to create virtual monitor: %s", error->message);
|
|
|
|
|
|
|
|
meta_monitor_manager_reload (monitor_manager);
|
|
|
|
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
res = g_test_run ();
|
|
|
|
|
2022-11-16 14:16:46 -05:00
|
|
|
g_object_unref (virtual_monitor);
|
|
|
|
|
|
|
|
g_clear_object (&test_environ->context);
|
2014-03-05 05:44:19 -05:00
|
|
|
g_free (test_environ);
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2020-07-09 15:28:57 -04:00
|
|
|
void
|
|
|
|
clutter_test_main (void)
|
|
|
|
{
|
2021-03-03 04:57:40 -05:00
|
|
|
g_assert_nonnull (clutter_test_main_loop);
|
|
|
|
|
|
|
|
g_main_loop_run (clutter_test_main_loop);
|
2020-07-09 15:28:57 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
clutter_test_quit (void)
|
|
|
|
{
|
2021-03-03 04:57:40 -05:00
|
|
|
g_assert_nonnull (clutter_test_main_loop);
|
|
|
|
|
|
|
|
g_main_loop_quit (clutter_test_main_loop);
|
2020-07-09 15:28:57 -04:00
|
|
|
}
|
|
|
|
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
typedef struct {
|
|
|
|
ClutterActor *stage;
|
|
|
|
|
2019-02-20 09:53:44 -05:00
|
|
|
graphene_point_t point;
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
|
|
|
|
gpointer result;
|
|
|
|
|
|
|
|
guint check_actor : 1;
|
|
|
|
guint check_color : 1;
|
|
|
|
|
|
|
|
guint was_painted : 1;
|
|
|
|
} ValidateData;
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
validate_stage (gpointer data_)
|
|
|
|
{
|
|
|
|
ValidateData *data = data_;
|
|
|
|
|
|
|
|
if (data->check_actor)
|
|
|
|
{
|
|
|
|
data->result =
|
|
|
|
clutter_stage_get_actor_at_pos (CLUTTER_STAGE (data->stage),
|
|
|
|
CLUTTER_PICK_ALL,
|
|
|
|
data->point.x,
|
|
|
|
data->point.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data->check_color)
|
|
|
|
{
|
|
|
|
data->result =
|
|
|
|
clutter_stage_read_pixels (CLUTTER_STAGE (data->stage),
|
|
|
|
data->point.x,
|
|
|
|
data->point.y,
|
|
|
|
1, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!g_test_verbose ())
|
|
|
|
{
|
|
|
|
clutter_actor_hide (data->stage);
|
|
|
|
data->was_painted = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return G_SOURCE_REMOVE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
on_key_press_event (ClutterActor *stage,
|
|
|
|
ClutterEvent *event,
|
|
|
|
gpointer data_)
|
|
|
|
{
|
|
|
|
ValidateData *data = data_;
|
|
|
|
|
|
|
|
if (data->stage == stage &&
|
|
|
|
clutter_event_get_key_symbol (event) == CLUTTER_KEY_Escape)
|
|
|
|
{
|
|
|
|
clutter_actor_hide (stage);
|
|
|
|
|
|
|
|
data->was_painted = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return CLUTTER_EVENT_PROPAGATE;
|
|
|
|
}
|
|
|
|
|
2014-12-16 08:59:41 -05:00
|
|
|
/**
|
|
|
|
* clutter_test_check_actor_at_point:
|
|
|
|
* @stage: a #ClutterStage
|
|
|
|
* @point: coordinates to check
|
|
|
|
* @actor: the expected actor at the given coordinates
|
|
|
|
* @result: (out) (nullable): actor at the coordinates
|
|
|
|
*
|
|
|
|
* Checks the given coordinates of the @stage and compares the
|
|
|
|
* actor found there with the given @actor.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the actor at the given coordinates matches
|
|
|
|
*/
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
gboolean
|
2019-02-20 09:53:44 -05:00
|
|
|
clutter_test_check_actor_at_point (ClutterActor *stage,
|
|
|
|
const graphene_point_t *point,
|
|
|
|
ClutterActor *actor,
|
|
|
|
ClutterActor **result)
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
{
|
|
|
|
ValidateData *data;
|
2019-11-15 19:25:52 -05:00
|
|
|
gulong press_id = 0;
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
|
|
|
|
g_return_val_if_fail (point != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (stage), FALSE);
|
|
|
|
g_return_val_if_fail (result != NULL, FALSE);
|
|
|
|
|
|
|
|
data = g_new0 (ValidateData, 1);
|
|
|
|
data->stage = stage;
|
|
|
|
data->point = *point;
|
|
|
|
data->check_actor = TRUE;
|
|
|
|
|
|
|
|
if (g_test_verbose ())
|
|
|
|
{
|
|
|
|
g_printerr ("Press ESC to close the stage and resume the test\n");
|
|
|
|
press_id = g_signal_connect (stage, "key-press-event",
|
|
|
|
G_CALLBACK (on_key_press_event),
|
|
|
|
data);
|
|
|
|
}
|
|
|
|
|
|
|
|
clutter_actor_show (stage);
|
|
|
|
|
|
|
|
clutter_threads_add_repaint_func_full (CLUTTER_REPAINT_FLAGS_POST_PAINT,
|
|
|
|
validate_stage,
|
|
|
|
data,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
while (!data->was_painted)
|
|
|
|
g_main_context_iteration (NULL, TRUE);
|
|
|
|
|
|
|
|
*result = data->result;
|
|
|
|
|
2019-11-15 19:25:52 -05:00
|
|
|
g_clear_signal_handler (&press_id, stage);
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
|
|
|
|
g_free (data);
|
|
|
|
|
|
|
|
return *result == actor;
|
|
|
|
}
|
|
|
|
|
2014-12-16 08:59:41 -05:00
|
|
|
/**
|
|
|
|
* clutter_test_check_color_at_point:
|
|
|
|
* @stage: a #ClutterStage
|
|
|
|
* @point: coordinates to check
|
|
|
|
* @color: expected color
|
|
|
|
* @result: (out caller-allocates): color at the given coordinates
|
|
|
|
*
|
|
|
|
* Checks the color at the given coordinates on @stage, and matches
|
|
|
|
* it with the red, green, and blue channels of @color. The alpha
|
|
|
|
* component of @color and @result is ignored.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the colors match
|
|
|
|
*/
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
gboolean
|
2019-02-20 09:53:44 -05:00
|
|
|
clutter_test_check_color_at_point (ClutterActor *stage,
|
|
|
|
const graphene_point_t *point,
|
|
|
|
const ClutterColor *color,
|
|
|
|
ClutterColor *result)
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
{
|
|
|
|
ValidateData *data;
|
|
|
|
gboolean retval;
|
|
|
|
guint8 *buffer;
|
2019-11-15 19:25:52 -05:00
|
|
|
gulong press_id = 0;
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
|
|
|
|
g_return_val_if_fail (point != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (color != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (result != NULL, FALSE);
|
|
|
|
|
|
|
|
data = g_new0 (ValidateData, 1);
|
|
|
|
data->stage = stage;
|
|
|
|
data->point = *point;
|
|
|
|
data->check_color = TRUE;
|
|
|
|
|
|
|
|
if (g_test_verbose ())
|
|
|
|
{
|
|
|
|
g_printerr ("Press ESC to close the stage and resume the test\n");
|
|
|
|
press_id = g_signal_connect (stage, "key-press-event",
|
|
|
|
G_CALLBACK (on_key_press_event),
|
|
|
|
data);
|
|
|
|
}
|
|
|
|
|
|
|
|
clutter_actor_show (stage);
|
|
|
|
|
|
|
|
clutter_threads_add_repaint_func_full (CLUTTER_REPAINT_FLAGS_POST_PAINT,
|
|
|
|
validate_stage,
|
|
|
|
data,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
while (!data->was_painted)
|
|
|
|
g_main_context_iteration (NULL, TRUE);
|
|
|
|
|
2019-11-15 19:25:52 -05:00
|
|
|
g_clear_signal_handler (&press_id, stage);
|
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways.
All tests are built into the same binary, which makes adding new tests,
builting tests, and running groups of tests much more awkward than it
needs to be. The first issue, especially, raises the bar of contribution
in a significant way, while the other two take their toll on the
maintainer. All of these changes were introduced back when we had both
Clutter and Cogl tests in tree, and because we were building the test
suite for every single change; since then, Cogl moved out of tree with
all its tests, and we build the conformance test suite only when running
the `check` make target.
This admittedly large-ish commit changes the way the conformance test
suite works, taking advantage of the changes in the GTest API and test
harness.
First of all, all tests are now built separately, using their own test
suite as defined by each separate file. All tests run under the TAP
harness provided by GTest and Automake, to gather a proper report using
the Test Anything Protocol without using the `gtester` harness and the
`gtester-report` script. We also use the Makefile rules provided by GLib
to vastly simplify the build environment for the conformance test suite.
On top of the changes for the build and harness, we also provide new API
for creating and running test suites for Clutter. The API is public,
because the test suite has to use it, but it's minimal and mostly
provides convenience wrappers around GTest that make writing test units
for Clutter easier.
This commit disables all tests in the conformance test suite, as well as
moving the data files outside of the tests/data directory; the next few
commits will re-establish the conformance test suite separately so we
can check that everything works in a reliable way.
2013-12-12 09:36:16 -05:00
|
|
|
|
|
|
|
buffer = data->result;
|
|
|
|
|
|
|
|
clutter_color_init (result, buffer[0], buffer[1], buffer[2], 255);
|
|
|
|
|
|
|
|
/* we only check the color channels, so we can't use clutter_color_equal() */
|
|
|
|
retval = buffer[0] == color->red &&
|
|
|
|
buffer[1] == color->green &&
|
|
|
|
buffer[2] == color->blue;
|
|
|
|
|
|
|
|
g_free (data->result);
|
|
|
|
g_free (data);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|