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>
This commit is contained in:
Ucan, Emre (ADITG/SW1) 2016-06-07 09:40:21 +00:00 committed by Pekka Paalanen
parent 5e8d55da69
commit 37d25bb1e0
3 changed files with 47 additions and 0 deletions

View File

@ -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 */

View File

@ -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;

View File

@ -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[] = {