compositor: move tests quirks initialization to weston_compositor_create()
Until now we had the test quirks initialization in wet_main(),
just after calling weston_compositor_create(). But there are
some cases that require the quirks during struct weston_compositor
creation time.
Move test quirks initialization to weston_compositor_create()
in order to cover more use cases for the test quirks mechanism.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
diff --git a/libweston/compositor.c b/libweston/compositor.c
index 6434259..1a88f96 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -7327,36 +7327,6 @@
weston_log_subscription_complete(sub);
}
-/** Init the compositor testsuite data
- *
- * The struct weston_testsuite_data contains two members:
- *
- * 1. The struct weston_testsuite_quirks, which can be used by the tests to
- * change certain behavior of Weston when running these tests.
- *
- * 2. The void *test_private_data member which can be used by the test suite
- * of projects that uses libweston in order to give arbitrary test data to the
- * compositor. Its type should be defined by the test suite of the project.
- *
- * This function can be called at most once per compositor instance, just after
- * creating the weston_compositor object and never again. This happens because
- * changing the quirks after e.g. loading the backend is not going to work,
- * there are certain behaviors that need to be set up before this point.
- *
- * \param ec The weston compositor.
- * \param test_data The testsuite data.
- *
- * \ingroup compositor
- * \sa weston_compositor_get_test_data
- */
-WL_EXPORT void
-weston_compositor_test_data_init(struct weston_compositor *ec,
- const struct weston_testsuite_data *test_data)
-{
- assert(ec->backend == NULL);
- ec->test_data = *test_data;
-}
-
/** Retrieve testsuite data from compositor
*
* The testsuite data can be defined by the test suite of projects that uses
@@ -7383,6 +7353,7 @@
* \param display The Wayland display to be used.
* \param user_data A pointer to an object that can later be retrieved
* \param log_ctx A pointer to weston_debug_compositor
+ * \param test_data Optional testsuite data, or NULL.
* using the \ref weston_compositor_get_user_data function.
* \return The compositor instance on success or NULL on failure.
*
@@ -7390,8 +7361,8 @@
*/
WL_EXPORT struct weston_compositor *
weston_compositor_create(struct wl_display *display,
- struct weston_log_context *log_ctx,
- void *user_data)
+ struct weston_log_context *log_ctx, void *user_data,
+ const struct weston_testsuite_data *test_data)
{
struct weston_compositor *ec;
struct wl_event_loop *loop;
@@ -7403,6 +7374,9 @@
if (!ec)
return NULL;
+ if (test_data)
+ ec->test_data = *test_data;
+
ec->weston_log_ctx = log_ctx;
ec->wl_display = display;
ec->user_data = user_data;