[PATCH 04/14] tests: test set for ivi-layer normal use case with helper client

Nobuhiko Tanibata nobuhiko_tanibata at xddp.denso.co.jp
Sun Jun 21 23:34:09 PDT 2015


From: Nobuhiko Tanibata <NOBUHIKO_TANIBATA at xddp.denso.co.jp>

These test are implemented on test suite framework, which provides
helper client.
Following features are tested,
- render order of ivi-surfaces on ivi-layer

Signed-off-by: Nobuhiko Tanibata <nobuhiko_tanibata at xddp.denso.co.jp>
Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 tests/ivi-test.h               |  4 ++++
 tests/ivi_layout-test-plugin.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 tests/ivi_layout-test.c        | 27 +++++++++++++++++++++++++++
 3 files changed, 73 insertions(+)

diff --git a/tests/ivi-test.h b/tests/ivi-test.h
index 14415fa..5cb4739 100644
--- a/tests/ivi-test.h
+++ b/tests/ivi-test.h
@@ -33,5 +33,9 @@
  */
 #define IVI_TEST_SURFACE_ID_BASE 0xffc01200
 #define IVI_TEST_SURFACE_ID(i) (IVI_TEST_SURFACE_ID_BASE + i)
+#define IVI_TEST_LAYER_ID_BASE 0xeef01200
+#define IVI_TEST_LAYER_ID(i) (IVI_TEST_LAYER_ID_BASE + i)
+
+#define IVI_TEST_SURFACE_COUNT (3)
 
 #endif /* IVI_TEST_H */
diff --git a/tests/ivi_layout-test-plugin.c b/tests/ivi_layout-test-plugin.c
index fd57d06..afd108b 100644
--- a/tests/ivi_layout-test-plugin.c
+++ b/tests/ivi_layout-test-plugin.c
@@ -697,3 +697,45 @@ RUNNER_TEST(get_surface_after_destroy_surface)
 	runner_assert(ivisurf == NULL);
 }
 
+RUNNER_TEST(layer_render_order)
+{
+	const struct ivi_controller_interface *ctl = ctx->controller_interface;
+	struct ivi_layout_layer *ivilayer;
+	struct ivi_layout_surface *ivisurfs[IVI_TEST_SURFACE_COUNT] = {};
+	struct ivi_layout_surface **array;
+	int32_t length = 0;
+	uint32_t i;
+
+	ivilayer = ctl->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
+
+	for (i = 0; i < IVI_TEST_SURFACE_COUNT; i++)
+		ivisurfs[i] = ctl->get_surface_from_id(IVI_TEST_SURFACE_ID(i));
+
+	runner_assert(ctl->layer_set_render_order(
+		      ivilayer, ivisurfs, IVI_TEST_SURFACE_COUNT) == IVI_SUCCEEDED);
+
+	ctl->commit_changes();
+
+	runner_assert(ctl->get_surfaces_on_layer(
+		      ivilayer, &length, &array) == IVI_SUCCEEDED);
+	runner_assert(IVI_TEST_SURFACE_COUNT == length);
+	for (i = 0; i < IVI_TEST_SURFACE_COUNT; i++)
+		runner_assert(array[i] == ivisurfs[i]);
+
+	if (length > 0)
+		free(array);
+
+	runner_assert(ctl->layer_set_render_order(
+		      ivilayer, NULL, 0) == IVI_SUCCEEDED);
+
+	array = NULL;
+
+	ctl->commit_changes();
+
+	runner_assert(ctl->get_surfaces_on_layer(
+		      ivilayer, &length, &array) == IVI_SUCCEEDED);
+	runner_assert(length == 0 && array == NULL);
+
+	ctl->layer_destroy(ivilayer);
+}
+
diff --git a/tests/ivi_layout-test.c b/tests/ivi_layout-test.c
index 1dc1457..051ded4 100644
--- a/tests/ivi_layout-test.c
+++ b/tests/ivi_layout-test.c
@@ -208,6 +208,10 @@ const char * const surface_property_commit_changes_test_names[] = {
 	"commit_changes_after_destination_rectangle_set_surface_destroy",
 };
 
+const char * const render_order_test_names[] = {
+	"layer_render_order",
+};
+
 TEST_P(ivi_layout_runner, basic_test_names)
 {
 	/* an element from basic_test_names */
@@ -310,3 +314,26 @@ TEST(get_surface_after_destroy_wl_surface)
 	free(wnd);
 	runner_destroy(runner);
 }
+
+TEST_P(ivi_layout_layer_render_order_runner, render_order_test_names)
+{
+	/* an element from render_order_test_names */
+	const char * const *test_name = data;
+	struct client *client;
+	struct runner *runner;
+	struct ivi_window *winds[3];
+
+	client = create_client();
+	runner = client_create_runner(client);
+
+	winds[0] = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(0));
+	winds[1] = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(1));
+	winds[2] = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(2));
+
+	runner_run(runner, *test_name);
+
+	ivi_window_destroy(winds[0]);
+	ivi_window_destroy(winds[1]);
+	ivi_window_destroy(winds[2]);
+	runner_destroy(runner);
+}
-- 
1.8.3.1



More information about the wayland-devel mailing list