summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>2015-06-22 15:35:58 +0900
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2015-06-25 11:39:45 +0300
commit915303a27516c63fb2c97e93ac37453601a9c585 (patch)
treeaec581848f834c512ce3ce42ade998df821b9d79 /tests
parenta10352e5c3418f9539cb53f4aecc537d2b412a4b (diff)
tests: test set for ivi-shell notification normal use case with helper client
These tests are implemented on test suite framework, which provides helper client. Following features are tested, - notification of adding ivi-surface - notification of ivi-surface configure - notification of creating ivi-surface - notification of removing ivi-surface Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/ivi_layout-test-plugin.c172
-rw-r--r--tests/ivi_layout-test.c79
2 files changed, 251 insertions, 0 deletions
diff --git a/tests/ivi_layout-test-plugin.c b/tests/ivi_layout-test-plugin.c
index a134a149..28afac9b 100644
--- a/tests/ivi_layout-test-plugin.c
+++ b/tests/ivi_layout-test-plugin.c
@@ -82,6 +82,7 @@ struct test_launcher {
struct test_context {
const struct ivi_controller_interface *controller_interface;
struct wl_resource *runner_resource;
+ uint32_t user_flags;
};
static struct test_context static_context;
@@ -877,3 +878,174 @@ RUNNER_TEST(cleanup_layer)
ctl->layer_destroy(ivilayer);
}
+static void
+test_surface_properties_changed_notification_callback(struct ivi_layout_surface *ivisurf,
+ const struct ivi_layout_surface_properties *prop,
+ enum ivi_layout_notification_mask mask,
+ void *userdata)
+{
+ struct test_context *ctx = userdata;
+ const struct ivi_controller_interface *ctl = ctx->controller_interface;
+
+ runner_assert_or_return(ctl->get_id_of_surface(ivisurf) == IVI_TEST_SURFACE_ID(0));
+
+ ctx->user_flags = 1;
+}
+
+RUNNER_TEST(surface_properties_changed_notification)
+{
+ const struct ivi_controller_interface *ctl = ctx->controller_interface;
+ const uint32_t id_surface = IVI_TEST_SURFACE_ID(0);
+ struct ivi_layout_surface *ivisurf;
+
+ ctx->user_flags = 0;
+
+ ivisurf = ctl->get_surface_from_id(id_surface);
+ runner_assert(ivisurf != NULL);
+
+ runner_assert(ctl->surface_add_notification(
+ ivisurf, test_surface_properties_changed_notification_callback, ctx) == IVI_SUCCEEDED);
+
+ ctl->commit_changes();
+
+ runner_assert(ctx->user_flags == 0);
+
+ runner_assert(ctl->surface_set_destination_rectangle(
+ ivisurf, 20, 30, 200, 300) == IVI_SUCCEEDED);
+
+ ctl->commit_changes();
+
+ runner_assert(ctx->user_flags == 1);
+
+ ctx->user_flags = 0;
+ runner_assert(ctl->surface_set_destination_rectangle(
+ ivisurf, 20, 30, 200, 300) == IVI_SUCCEEDED);
+
+ ctl->commit_changes();
+
+ runner_assert(ctx->user_flags == 0);
+
+ ctl->surface_remove_notification(ivisurf);
+ ctx->user_flags = 0;
+ runner_assert(ctl->surface_set_destination_rectangle(
+ ivisurf, 40, 50, 400, 500) == IVI_SUCCEEDED);
+
+ ctl->commit_changes();
+
+ runner_assert(ctx->user_flags == 0);
+}
+
+static void
+test_surface_configure_notification_callback(struct ivi_layout_surface *ivisurf,
+ void *userdata)
+{
+ struct test_context *ctx = userdata;
+ const struct ivi_controller_interface *ctl = ctx->controller_interface;
+
+ runner_assert_or_return(ctl->get_id_of_surface(ivisurf) == IVI_TEST_SURFACE_ID(0));
+
+ ctx->user_flags = 1;
+}
+
+RUNNER_TEST(surface_configure_notification_p1)
+{
+ const struct ivi_controller_interface *ctl = ctx->controller_interface;
+
+ runner_assert(IVI_SUCCEEDED == ctl->add_notification_configure_surface(test_surface_configure_notification_callback, ctx));
+ ctl->commit_changes();
+
+ ctx->user_flags = 0;
+}
+
+RUNNER_TEST(surface_configure_notification_p2)
+{
+ const struct ivi_controller_interface *ctl = ctx->controller_interface;
+
+ runner_assert(ctx->user_flags == 1);
+
+ ctl->remove_notification_configure_surface(test_surface_configure_notification_callback, ctx);
+ ctx->user_flags = 0;
+}
+
+RUNNER_TEST(surface_configure_notification_p3)
+{
+ const struct ivi_controller_interface *ctl = ctx->controller_interface;
+
+ ctl->commit_changes();
+ runner_assert(ctx->user_flags == 0);
+}
+
+static void
+test_surface_create_notification_callback(struct ivi_layout_surface *ivisurf,
+ void *userdata)
+{
+ struct test_context *ctx = userdata;
+ const struct ivi_controller_interface *ctl = ctx->controller_interface;
+
+ runner_assert_or_return(ctl->get_id_of_surface(ivisurf) == IVI_TEST_SURFACE_ID(0));
+
+ ctx->user_flags = 1;
+}
+
+RUNNER_TEST(surface_create_notification_p1)
+{
+ const struct ivi_controller_interface *ctl = ctx->controller_interface;
+
+ runner_assert(ctl->add_notification_create_surface(
+ test_surface_create_notification_callback, ctx) == IVI_SUCCEEDED);
+
+ ctx->user_flags = 0;
+}
+
+RUNNER_TEST(surface_create_notification_p2)
+{
+ const struct ivi_controller_interface *ctl = ctx->controller_interface;
+
+ runner_assert(ctx->user_flags == 1);
+
+ ctl->remove_notification_create_surface(
+ test_surface_create_notification_callback, ctx);
+ ctx->user_flags = 0;
+}
+
+RUNNER_TEST(surface_create_notification_p3)
+{
+ runner_assert(ctx->user_flags == 0);
+}
+
+static void
+test_surface_remove_notification_callback(struct ivi_layout_surface *ivisurf,
+ void *userdata)
+{
+ struct test_context *ctx = userdata;
+ const struct ivi_controller_interface *ctl = ctx->controller_interface;
+
+ runner_assert_or_return(ctl->get_id_of_surface(ivisurf) == IVI_TEST_SURFACE_ID(0));
+
+ ctx->user_flags = 1;
+}
+
+RUNNER_TEST(surface_remove_notification_p1)
+{
+ const struct ivi_controller_interface *ctl = ctx->controller_interface;
+
+ runner_assert(ctl->add_notification_remove_surface(
+ test_surface_remove_notification_callback, ctx) == IVI_SUCCEEDED);
+
+ ctx->user_flags = 0;
+}
+
+RUNNER_TEST(surface_remove_notification_p2)
+{
+ const struct ivi_controller_interface *ctl = ctx->controller_interface;
+
+ runner_assert(ctx->user_flags == 1);
+
+ ctl->remove_notification_remove_surface(test_surface_remove_notification_callback, ctx);
+ ctx->user_flags = 0;
+}
+
+RUNNER_TEST(surface_remove_notification_p3)
+{
+ runner_assert(ctx->user_flags == 0);
+}
diff --git a/tests/ivi_layout-test.c b/tests/ivi_layout-test.c
index 2ac67a45..7091c9fb 100644
--- a/tests/ivi_layout-test.c
+++ b/tests/ivi_layout-test.c
@@ -196,6 +196,7 @@ const char * const basic_test_names[] = {
"surface_destination_rectangle",
"surface_source_rectangle",
"surface_bad_opacity",
+ "surface_properties_changed_notification",
};
const char * const surface_property_commit_changes_test_names[] = {
@@ -387,3 +388,81 @@ TEST(commit_changes_after_render_order_set_surface_destroy)
ivi_window_destroy(winds[2]);
runner_destroy(runner);
}
+
+TEST(ivi_layout_surface_configure_notification)
+{
+ struct client *client;
+ struct runner *runner;
+ struct ivi_window *wind;
+ struct wl_buffer *buffer;
+
+ client = create_client();
+ runner = client_create_runner(client);
+
+ runner_run(runner, "surface_configure_notification_p1");
+
+ wind = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(0));
+
+ buffer = create_shm_buffer(client, 200, 300, NULL);
+
+ wl_surface_attach(wind->wl_surface, buffer, 0, 0);
+ wl_surface_damage(wind->wl_surface, 0, 0, 20, 30);
+ wl_surface_commit(wind->wl_surface);
+
+ runner_run(runner, "surface_configure_notification_p2");
+
+ wl_surface_attach(wind->wl_surface, buffer, 0, 0);
+ wl_surface_damage(wind->wl_surface, 0, 0, 40, 50);
+ wl_surface_commit(wind->wl_surface);
+
+ runner_run(runner, "surface_configure_notification_p3");
+
+ wl_buffer_destroy(buffer);
+ ivi_window_destroy(wind);
+ runner_destroy(runner);
+}
+
+TEST(ivi_layout_surface_create_notification)
+{
+ struct client *client;
+ struct runner *runner;
+ struct ivi_window *wind;
+
+ client = create_client();
+ runner = client_create_runner(client);
+
+ runner_run(runner, "surface_create_notification_p1");
+
+ wind = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(0));
+
+ runner_run(runner, "surface_create_notification_p2");
+
+ ivi_window_destroy(wind);
+ wind = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(0));
+ runner_run(runner, "surface_create_notification_p3");
+
+ ivi_window_destroy(wind);
+ runner_destroy(runner);
+}
+
+TEST(ivi_layout_surface_remove_notification)
+{
+ struct client *client;
+ struct runner *runner;
+ struct ivi_window *wind;
+
+ client = create_client();
+ runner = client_create_runner(client);
+
+ wind = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(0));
+ runner_run(runner, "surface_remove_notification_p1");
+ ivi_window_destroy(wind);
+
+ runner_run(runner, "surface_remove_notification_p2");
+
+ wind = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(0));
+ ivi_window_destroy(wind);
+ runner_run(runner, "surface_remove_notification_p3");
+
+ runner_destroy(runner);
+}