summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUcan, Emre (ADITG/SW1) <eucan@de.adit-jv.com>2016-06-07 09:40:21 +0000
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2016-06-29 11:32:23 +0300
commit37d25bb1e027a4883f9f0385e61bf8b447e6e285 (patch)
treedbd5409a9ee034b50e10acf4f80f52a5483e8614
parent5e8d55da698e587951e69d49ac36f75541cca477 (diff)
ivi-shell: implement surface_on_many_layer test
A surface can be added to many layers. This test is implemented to test this use-case and the correct behaviour of get_layers_under_surface API. Signed-off-by: Emre Ucan <eucan@de.adit-jv.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-rw-r--r--tests/ivi-test.h1
-rw-r--r--tests/ivi_layout-test-plugin.c45
-rw-r--r--tests/ivi_layout-test.c1
3 files changed, 47 insertions, 0 deletions
diff --git a/tests/ivi-test.h b/tests/ivi-test.h
index 5cb47398..5706ed80 100644
--- a/tests/ivi-test.h
+++ b/tests/ivi-test.h
@@ -37,5 +37,6 @@
#define IVI_TEST_LAYER_ID(i) (IVI_TEST_LAYER_ID_BASE + i)
#define IVI_TEST_SURFACE_COUNT (3)
+#define IVI_TEST_LAYER_COUNT (3)
#endif /* IVI_TEST_H */
diff --git a/tests/ivi_layout-test-plugin.c b/tests/ivi_layout-test-plugin.c
index 1a28c6ee..ef6903a4 100644
--- a/tests/ivi_layout-test-plugin.c
+++ b/tests/ivi_layout-test-plugin.c
@@ -588,6 +588,51 @@ RUNNER_TEST(surface_bad_opacity)
lyt->commit_changes();
}
+RUNNER_TEST(surface_on_many_layer)
+{
+ const struct ivi_layout_interface *lyt = ctx->layout_interface;
+ struct ivi_layout_surface *ivisurf;
+ struct ivi_layout_layer *ivilayers[IVI_TEST_LAYER_COUNT] = {};
+ struct ivi_layout_layer **array;
+ int32_t length = 0;
+ uint32_t i;
+
+ ivisurf = lyt->get_surface_from_id(IVI_TEST_SURFACE_ID(0));
+ runner_assert(ivisurf != NULL);
+
+ for (i = 0; i < IVI_TEST_LAYER_COUNT; i++) {
+ ivilayers[i] = lyt->layer_create_with_dimension(
+ IVI_TEST_LAYER_ID(i), 200, 300);
+ runner_assert(lyt->layer_add_surface(
+ ivilayers[i], ivisurf) == IVI_SUCCEEDED);
+ }
+
+ lyt->commit_changes();
+
+ runner_assert(lyt->get_layers_under_surface(
+ ivisurf, &length, &array) == IVI_SUCCEEDED);
+ runner_assert(IVI_TEST_LAYER_COUNT == length);
+ for (i = 0; i < IVI_TEST_LAYER_COUNT; i++)
+ runner_assert(array[i] == ivilayers[i]);
+
+ if (length > 0)
+ free(array);
+
+ for (i = 0; i < IVI_TEST_LAYER_COUNT; i++)
+ lyt->layer_remove_surface(ivilayers[i], ivisurf);
+
+ array = NULL;
+
+ lyt->commit_changes();
+
+ runner_assert(lyt->get_layers_under_surface(
+ ivisurf, &length, &array) == IVI_SUCCEEDED);
+ runner_assert(length == 0 && array == NULL);
+
+ for (i = 0; i < IVI_TEST_LAYER_COUNT; i++)
+ lyt->layer_destroy(ivilayers[i]);
+}
+
RUNNER_TEST(ivi_layout_commit_changes)
{
const struct ivi_layout_interface *lyt = ctx->layout_interface;
diff --git a/tests/ivi_layout-test.c b/tests/ivi_layout-test.c
index b775abe3..4814e2d4 100644
--- a/tests/ivi_layout-test.c
+++ b/tests/ivi_layout-test.c
@@ -199,6 +199,7 @@ const char * const basic_test_names[] = {
"surface_bad_opacity",
"surface_properties_changed_notification",
"surface_bad_properties_changed_notification",
+ "surface_on_many_layer",
};
const char * const surface_property_commit_changes_test_names[] = {