summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorUcan, Emre (ADITG/SW1) <eucan@de.adit-jv.com>2016-04-04 08:05:20 +0000
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2016-04-05 11:53:48 +0300
commitc49aa5acada6045f084bbacdb545143c3828b5d0 (patch)
tree0193c510f5fae0d3fdf44400f9b30781aa09e0c5 /tests
parent67f0aa87674c573fbf68a1aaa1e0b75a2f4c7c62 (diff)
downloadweston-c49aa5acada6045f084bbacdb545143c3828b5d0.tar.gz
ivi-shell: rework configure_surface notification
The add_notification_configure_surface API accepts a simple wl_listener instead of a ivi-shell specific notification function. Therefore, the API is renamed to add_listener_configure_surface. This change has several advantages: 1. Code cleanup 2. No dynamic memory allocation. Listeners are allocated by controller plugins 3. Remove API is not needed. Controller plugins can easily remove the listener link. The remove API is removed too: - ivi_layout_remove_notification_configure_surface Signed-off-by: Emre Ucan <eucan@de.adit-jv.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Diffstat (limited to 'tests')
-rw-r--r--tests/ivi_layout-internal-test.c2
-rw-r--r--tests/ivi_layout-test-plugin.c17
2 files changed, 11 insertions, 8 deletions
diff --git a/tests/ivi_layout-internal-test.c b/tests/ivi_layout-internal-test.c
index 4e173571..f5e296cb 100644
--- a/tests/ivi_layout-internal-test.c
+++ b/tests/ivi_layout-internal-test.c
@@ -841,7 +841,7 @@ test_surface_bad_configure_notification(struct test_context *ctx)
{
const struct ivi_layout_interface *lyt = ctx->layout_interface;
- iassert(lyt->add_notification_configure_surface(NULL, NULL) == IVI_FAILED);
+ iassert(lyt->add_listener_configure_surface(NULL) == IVI_FAILED);
}
static void
diff --git a/tests/ivi_layout-test-plugin.c b/tests/ivi_layout-test-plugin.c
index 6796b33e..80fcdf7f 100644
--- a/tests/ivi_layout-test-plugin.c
+++ b/tests/ivi_layout-test-plugin.c
@@ -87,6 +87,7 @@ struct test_context {
struct wl_listener surface_property_changed;
struct wl_listener surface_created;
struct wl_listener surface_removed;
+ struct wl_listener surface_configured;
};
static struct test_context static_context;
@@ -874,11 +875,13 @@ RUNNER_TEST(surface_properties_changed_notification)
}
static void
-test_surface_configure_notification_callback(struct ivi_layout_surface *ivisurf,
- void *userdata)
+test_surface_configure_notification_callback(struct wl_listener *listener, void *data)
{
- struct test_context *ctx = userdata;
+ struct test_context *ctx =
+ container_of(listener, struct test_context,
+ surface_configured);
const struct ivi_layout_interface *lyt = ctx->layout_interface;
+ struct ivi_layout_surface *ivisurf = data;
runner_assert_or_return(lyt->get_id_of_surface(ivisurf) == IVI_TEST_SURFACE_ID(0));
@@ -889,7 +892,8 @@ RUNNER_TEST(surface_configure_notification_p1)
{
const struct ivi_layout_interface *lyt = ctx->layout_interface;
- runner_assert(IVI_SUCCEEDED == lyt->add_notification_configure_surface(test_surface_configure_notification_callback, ctx));
+ ctx->surface_configured.notify = test_surface_configure_notification_callback;
+ runner_assert(IVI_SUCCEEDED == lyt->add_listener_configure_surface(&ctx->surface_configured));
lyt->commit_changes();
ctx->user_flags = 0;
@@ -897,11 +901,10 @@ RUNNER_TEST(surface_configure_notification_p1)
RUNNER_TEST(surface_configure_notification_p2)
{
- const struct ivi_layout_interface *lyt = ctx->layout_interface;
-
runner_assert(ctx->user_flags == 1);
- lyt->remove_notification_configure_surface(test_surface_configure_notification_callback, ctx);
+ // remove surface configured listener.
+ wl_list_remove(&ctx->surface_configured.link);
ctx->user_flags = 0;
}