[PATCH weston 3/4] ivi-shell: add layer_add_surfaces test
Ucan, Emre (ADITG/SW1)
eucan at de.adit-jv.com
Wed Jan 18 15:25:35 UTC 2017
Test adds 3 surfaces in a layer's render order list.
First, it adds in the order which surfaces are created.
Later, test cleans the render order list, and adds surfaces in reverse
order.
Signed-off-by: Emre Ucan <eucan at de.adit-jv.com>
---
tests/ivi_layout-test-plugin.c | 49 ++++++++++++++++++++++++++++++++++++++++
tests/ivi_layout-test.c | 1 +
2 files changed, 50 insertions(+)
diff --git a/tests/ivi_layout-test-plugin.c b/tests/ivi_layout-test-plugin.c
index f6e465b..609c71f 100644
--- a/tests/ivi_layout-test-plugin.c
+++ b/tests/ivi_layout-test-plugin.c
@@ -835,6 +835,55 @@ RUNNER_TEST(layer_bad_render_order)
lyt->layer_destroy(ivilayer);
}
+RUNNER_TEST(layer_add_surfaces)
+{
+ const struct ivi_layout_interface *lyt = ctx->layout_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 = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
+
+ for (i = 0; i < IVI_TEST_SURFACE_COUNT; i++) {
+ ivisurfs[i] = lyt->get_surface_from_id(IVI_TEST_SURFACE_ID(i));
+ runner_assert(lyt->layer_add_surface(
+ ivilayer, ivisurfs[i]) == IVI_SUCCEEDED);
+ }
+
+ lyt->commit_changes();
+
+ runner_assert(lyt->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(lyt->layer_set_render_order(
+ ivilayer, NULL, 0) == IVI_SUCCEEDED);
+
+ for (i = IVI_TEST_SURFACE_COUNT; i-- > 0;)
+ runner_assert(lyt->layer_add_surface(
+ ivilayer, ivisurfs[i]) == IVI_SUCCEEDED);
+
+ lyt->commit_changes();
+
+ runner_assert(lyt->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[IVI_TEST_SURFACE_COUNT - (i + 1)]);
+
+ if (length > 0)
+ free(array);
+
+ lyt->layer_destroy(ivilayer);
+}
+
RUNNER_TEST(commit_changes_after_render_order_set_surface_destroy)
{
const struct ivi_layout_interface *lyt = ctx->layout_interface;
diff --git a/tests/ivi_layout-test.c b/tests/ivi_layout-test.c
index 72aad7f..86e63b1 100644
--- a/tests/ivi_layout-test.c
+++ b/tests/ivi_layout-test.c
@@ -214,6 +214,7 @@ const char * const surface_property_commit_changes_test_names[] = {
const char * const render_order_test_names[] = {
"layer_render_order",
"layer_bad_render_order",
+ "layer_add_surfaces",
};
TEST_P(ivi_layout_runner, basic_test_names)
--
1.7.9.5
More information about the wayland-devel
mailing list