summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorUcan, Emre (ADITG/SW1) <eucan@de.adit-jv.com>2016-04-04 08:05:15 +0000
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2016-04-05 11:53:48 +0300
commit562f2ecb0cb49aba1c26b3c01d406752165c279e (patch)
treedf5a2c977fdf82963e844b26f92fb623725b2fce /tests
parentc98f2cf16bdba4230370c0109af2ebe9139cf0f7 (diff)
downloadweston-562f2ecb0cb49aba1c26b3c01d406752165c279e.tar.gz
ivi-shell: rework remove_layer notification
The add_notification_remove_layer API accepts a simple wl_listener instead of a ivi-shell specific notification function. Therefore, the API is renamed to add_listener_remove_layer. 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_remove_layer 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.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/ivi_layout-internal-test.c b/tests/ivi_layout-internal-test.c
index ca47b017..d7878d3f 100644
--- a/tests/ivi_layout-internal-test.c
+++ b/tests/ivi_layout-internal-test.c
@@ -44,6 +44,7 @@ struct test_context {
struct wl_listener layer_property_changed;
struct wl_listener layer_created;
+ struct wl_listener layer_removed;
};
static void
@@ -767,11 +768,13 @@ test_layer_create_notification(struct test_context *ctx)
}
static void
-test_layer_remove_notification_callback(struct ivi_layout_layer *ivilayer,
- void *userdata)
+test_layer_remove_notification_callback(struct wl_listener *listener, void *data)
{
- struct test_context *ctx = userdata;
+ struct test_context *ctx =
+ container_of(listener, struct test_context,
+ layer_removed);
const struct ivi_layout_interface *lyt = ctx->layout_interface;
+ struct ivi_layout_layer *ivilayer = data;
const struct ivi_layout_layer_properties *prop =
lyt->get_properties_of_layer(ivilayer);
@@ -793,17 +796,19 @@ test_layer_remove_notification(struct test_context *ctx)
struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
ctx->user_flags = 0;
+ ctx->layer_removed.notify = test_layer_remove_notification_callback;
ivilayers[0] = lyt->layer_create_with_dimension(layers[0], 200, 300);
- iassert(lyt->add_notification_remove_layer(
- test_layer_remove_notification_callback, ctx) == IVI_SUCCEEDED);
+ iassert(lyt->add_listener_remove_layer(&ctx->layer_removed) == IVI_SUCCEEDED);
lyt->layer_destroy(ivilayers[0]);
iassert(ctx->user_flags == 1);
ctx->user_flags = 0;
ivilayers[1] = lyt->layer_create_with_dimension(layers[1], 250, 350);
- lyt->remove_notification_remove_layer(test_layer_remove_notification_callback, ctx);
+
+ // remove layer property changed listener.
+ wl_list_remove(&ctx->layer_removed.link);
lyt->layer_destroy(ivilayers[1]);
iassert(ctx->user_flags == 0);
@@ -860,7 +865,7 @@ test_layer_bad_remove_notification(struct test_context *ctx)
{
const struct ivi_layout_interface *lyt = ctx->layout_interface;
- iassert(lyt->add_notification_remove_layer(NULL, NULL) == IVI_FAILED);
+ iassert(lyt->add_listener_remove_layer(NULL) == IVI_FAILED);
}
static void