From c30da2aa3215d859d5e777a0ac083ff745e78bb3 Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Tue, 14 Mar 2023 11:28:57 +0100 Subject: [PATCH] tests: ivi-shell: prepare for API simplification The return values for most of the API functions will be removed and replaced by asserts. So checking return values will no longer work and passing invalid arguments will trigger asserts. Modify and remove the tests accordingly. Signed-off-by: Michael Olbrich --- tests/ivi-layout-internal-test.c | 286 ++++--------------------------- tests/ivi-layout-test-client.c | 2 - tests/ivi-layout-test-plugin.c | 159 ++++------------- 3 files changed, 63 insertions(+), 384 deletions(-) diff --git a/tests/ivi-layout-internal-test.c b/tests/ivi-layout-internal-test.c index 8f2d6be8..85a873ff 100644 --- a/tests/ivi-layout-internal-test.c +++ b/tests/ivi-layout-internal-test.c @@ -85,40 +85,6 @@ iassert_fail(const char *cond, const char *file, int line, * These are all internal ivi_layout API tests that do not require * any client objects. */ -static void -test_surface_bad_visibility(struct test_context *ctx) -{ - const struct ivi_layout_interface *lyt = ctx->layout_interface; - - iassert(lyt->surface_set_visibility(NULL, true) == IVI_FAILED); - - lyt->commit_changes(); -} - -static void -test_surface_bad_destination_rectangle(struct test_context *ctx) -{ - const struct ivi_layout_interface *lyt = ctx->layout_interface; - - iassert(lyt->surface_set_destination_rectangle(NULL, 20, 30, 200, 300) == IVI_FAILED); -} - -static void -test_surface_bad_source_rectangle(struct test_context *ctx) -{ - const struct ivi_layout_interface *lyt = ctx->layout_interface; - - iassert(lyt->surface_set_source_rectangle(NULL, 20, 30, 200, 300) == IVI_FAILED); -} - -static void -test_surface_bad_properties(struct test_context *ctx) -{ - const struct ivi_layout_interface *lyt = ctx->layout_interface; - - iassert(lyt->get_properties_of_surface(NULL) == NULL); -} - static void test_layer_create(struct test_context *ctx) { @@ -158,7 +124,7 @@ test_layer_visibility(struct test_context *ctx) iassert(prop->visibility == false); - iassert(lyt->layer_set_visibility(ivilayer, true) == IVI_SUCCEEDED); + lyt->layer_set_visibility(ivilayer, true); iassert(prop->visibility == false); @@ -208,8 +174,8 @@ test_layer_dimension(struct test_context *ctx) iassert(prop->dest_width == 200); iassert(prop->dest_height == 300); - iassert(lyt->layer_set_destination_rectangle(ivilayer, prop->dest_x, prop->dest_y, - 400, 600) == IVI_SUCCEEDED); + lyt->layer_set_destination_rectangle(ivilayer, prop->dest_x, prop->dest_y, + 400, 600); iassert(prop->dest_width == 200); iassert(prop->dest_height == 300); @@ -236,8 +202,8 @@ test_layer_position(struct test_context *ctx) iassert(prop->dest_x == 0); iassert(prop->dest_y == 0); - iassert(lyt->layer_set_destination_rectangle(ivilayer, 20, 30, - prop->dest_width, prop->dest_height) == IVI_SUCCEEDED); + lyt->layer_set_destination_rectangle(ivilayer, 20, 30, + prop->dest_width, prop->dest_height); iassert(prop->dest_x == 0); iassert(prop->dest_y == 0); @@ -267,8 +233,7 @@ test_layer_destination_rectangle(struct test_context *ctx) iassert(prop->dest_x == 0); iassert(prop->dest_y == 0); - iassert(lyt->layer_set_destination_rectangle( - ivilayer, 20, 30, 400, 600) == IVI_SUCCEEDED); + lyt->layer_set_destination_rectangle(ivilayer, 20, 30, 400, 600); prop = lyt->get_properties_of_layer(ivilayer); iassert(prop->dest_width == 200); @@ -302,8 +267,7 @@ test_layer_source_rectangle(struct test_context *ctx) iassert(prop->source_x == 0); iassert(prop->source_y == 0); - iassert(lyt->layer_set_source_rectangle( - ivilayer, 20, 30, 400, 600) == IVI_SUCCEEDED); + lyt->layer_set_source_rectangle(ivilayer, 20, 30, 400, 600); prop = lyt->get_properties_of_layer(ivilayer); iassert(prop->source_width == 200); @@ -322,23 +286,6 @@ test_layer_source_rectangle(struct test_context *ctx) lyt->layer_destroy(ivilayer); } -static void -test_layer_bad_remove(struct test_context *ctx) -{ - const struct ivi_layout_interface *lyt = ctx->layout_interface; - lyt->layer_destroy(NULL); -} - -static void -test_layer_bad_visibility(struct test_context *ctx) -{ - const struct ivi_layout_interface *lyt = ctx->layout_interface; - - iassert(lyt->layer_set_visibility(NULL, true) == IVI_FAILED); - - lyt->commit_changes(); -} - static void test_layer_bad_opacity(struct test_context *ctx) { @@ -349,9 +296,6 @@ test_layer_bad_opacity(struct test_context *ctx) ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); iassert(ivilayer != NULL); - iassert(lyt->layer_set_opacity( - NULL, wl_fixed_from_double(0.3)) == IVI_FAILED); - iassert(lyt->layer_set_opacity( ivilayer, wl_fixed_from_double(0.3)) == IVI_SUCCEEDED); @@ -370,40 +314,11 @@ test_layer_bad_opacity(struct test_context *ctx) iassert(prop->opacity == wl_fixed_from_double(0.3)); - iassert(lyt->layer_set_opacity( - NULL, wl_fixed_from_double(0.5)) == IVI_FAILED); - lyt->commit_changes(); lyt->layer_destroy(ivilayer); } -static void -test_layer_bad_destination_rectangle(struct test_context *ctx) -{ - const struct ivi_layout_interface *lyt = ctx->layout_interface; - - iassert(lyt->layer_set_destination_rectangle( - NULL, 20, 30, 200, 300) == IVI_FAILED); -} - -static void -test_layer_bad_source_rectangle(struct test_context *ctx) -{ - const struct ivi_layout_interface *lyt = ctx->layout_interface; - - iassert(lyt->layer_set_source_rectangle( - NULL, 20, 30, 200, 300) == IVI_FAILED); -} - -static void -test_layer_bad_properties(struct test_context *ctx) -{ - const struct ivi_layout_interface *lyt = ctx->layout_interface; - - iassert(lyt->get_properties_of_layer(NULL) == NULL); -} - static void test_commit_changes_after_visibility_set_layer_destroy(struct test_context *ctx) { @@ -413,7 +328,7 @@ test_commit_changes_after_visibility_set_layer_destroy(struct test_context *ctx) ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); iassert(ivilayer != NULL); - iassert(lyt->layer_set_visibility(ivilayer, true) == IVI_SUCCEEDED); + lyt->layer_set_visibility(ivilayer, true); lyt->layer_destroy(ivilayer); lyt->commit_changes(); } @@ -442,8 +357,7 @@ test_commit_changes_after_source_rectangle_set_layer_destroy(struct test_context ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); iassert(ivilayer != NULL); - iassert(lyt->layer_set_source_rectangle( - ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED); + lyt->layer_set_source_rectangle( ivilayer, 20, 30, 200, 300); lyt->layer_destroy(ivilayer); lyt->commit_changes(); } @@ -457,8 +371,7 @@ test_commit_changes_after_destination_rectangle_set_layer_destroy(struct test_co ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); iassert(ivilayer != NULL); - iassert(lyt->layer_set_destination_rectangle( - ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED); + lyt->layer_set_destination_rectangle(ivilayer, 20, 30, 200, 300); lyt->layer_destroy(ivilayer); lyt->commit_changes(); } @@ -524,11 +437,11 @@ test_screen_render_order(struct test_context *ctx) for (i = 0; i < LAYER_NUM; i++) ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300); - iassert(lyt->screen_set_render_order(output, ivilayers, LAYER_NUM) == IVI_SUCCEEDED); + lyt->screen_set_render_order(output, ivilayers, LAYER_NUM); lyt->commit_changes(); - iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED); + lyt->get_layers_on_screen(output, &length, &array); iassert(length == LAYER_NUM); for (i = 0; i < LAYER_NUM; i++) iassert(array[i] == ivilayers[i]); @@ -538,11 +451,11 @@ test_screen_render_order(struct test_context *ctx) array = NULL; - iassert(lyt->screen_set_render_order(output, NULL, 0) == IVI_SUCCEEDED); + lyt->screen_set_render_order(output, NULL, 0); lyt->commit_changes(); - iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED); + lyt->get_layers_on_screen(output, &length, &array); iassert(length == 0 && array == NULL); for (i = 0; i < LAYER_NUM; i++) @@ -551,39 +464,6 @@ test_screen_render_order(struct test_context *ctx) #undef LAYER_NUM } -static void -test_screen_bad_render_order(struct test_context *ctx) -{ -#define LAYER_NUM (3) - const struct ivi_layout_interface *lyt = ctx->layout_interface; - struct weston_output *output; - struct ivi_layout_layer *ivilayers[LAYER_NUM] = {}; - struct ivi_layout_layer **array; - int32_t length = 0; - uint32_t i; - - if (!iassert(!wl_list_empty(&ctx->compositor->output_list))) - return; - - output = wl_container_of(ctx->compositor->output_list.next, output, link); - - for (i = 0; i < LAYER_NUM; i++) - ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300); - - iassert(lyt->screen_set_render_order(NULL, ivilayers, LAYER_NUM) == IVI_FAILED); - - lyt->commit_changes(); - - iassert(lyt->get_layers_on_screen(NULL, &length, &array) == IVI_FAILED); - iassert(lyt->get_layers_on_screen(output, NULL, &array) == IVI_FAILED); - iassert(lyt->get_layers_on_screen(output, &length, NULL) == IVI_FAILED); - - for (i = 0; i < LAYER_NUM; i++) - lyt->layer_destroy(ivilayers[i]); - -#undef LAYER_NUM -} - static void test_screen_add_layers(struct test_context *ctx) { @@ -602,12 +482,12 @@ test_screen_add_layers(struct test_context *ctx) for (i = 0; i < LAYER_NUM; i++) { ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300); - iassert(lyt->screen_add_layer(output, ivilayers[i]) == IVI_SUCCEEDED); + lyt->screen_add_layer(output, ivilayers[i]); } lyt->commit_changes(); - iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED); + lyt->get_layers_on_screen(output, &length, &array); iassert(length == LAYER_NUM); for (i = 0; i < (uint32_t)length; i++) iassert(array[i] == ivilayers[i]); @@ -617,13 +497,13 @@ test_screen_add_layers(struct test_context *ctx) array = NULL; - iassert(lyt->screen_set_render_order(output, NULL, 0) == IVI_SUCCEEDED); + lyt->screen_set_render_order(output, NULL, 0); for (i = LAYER_NUM; i-- > 0;) - iassert(lyt->screen_add_layer(output, ivilayers[i]) == IVI_SUCCEEDED); + lyt->screen_add_layer(output, ivilayers[i]); lyt->commit_changes(); - iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED); + lyt->get_layers_on_screen(output, &length, &array); iassert(length == LAYER_NUM); for (i = 0; i < (uint32_t)length; i++) iassert(array[i] == ivilayers[LAYER_NUM - (i + 1)]); @@ -654,14 +534,14 @@ test_screen_remove_layer(struct test_context *ctx) output = wl_container_of(ctx->compositor->output_list.next, output, link); - iassert(lyt->screen_add_layer(output, ivilayer) == IVI_SUCCEEDED); + lyt->screen_add_layer(output, ivilayer); lyt->commit_changes(); - iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED); + lyt->get_layers_on_screen(output, &length, &array); iassert(length == 1); iassert(array[0] == ivilayer); - iassert(lyt->screen_remove_layer(output, ivilayer) == IVI_SUCCEEDED); + lyt->screen_remove_layer(output, ivilayer); lyt->commit_changes(); if (length > 0) @@ -669,40 +549,13 @@ test_screen_remove_layer(struct test_context *ctx) array = NULL; - iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED); + lyt->get_layers_on_screen(output, &length, &array); iassert(length == 0); iassert(array == NULL); lyt->layer_destroy(ivilayer); } -static void -test_screen_bad_remove_layer(struct test_context *ctx) -{ - const struct ivi_layout_interface *lyt = ctx->layout_interface; - struct ivi_layout_layer *ivilayer; - struct weston_output *output; - - if (wl_list_empty(&ctx->compositor->output_list)) - return; - - ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); - iassert(ivilayer != NULL); - - output = wl_container_of(ctx->compositor->output_list.next, output, link); - - iassert(lyt->screen_remove_layer(NULL, ivilayer) == IVI_FAILED); - lyt->commit_changes(); - - iassert(lyt->screen_remove_layer(output, NULL) == IVI_FAILED); - lyt->commit_changes(); - - iassert(lyt->screen_remove_layer(NULL, NULL) == IVI_FAILED); - lyt->commit_changes(); - - lyt->layer_destroy(ivilayer); -} - static void test_commit_changes_after_render_order_set_layer_destroy( @@ -722,7 +575,7 @@ test_commit_changes_after_render_order_set_layer_destroy( for (i = 0; i < LAYER_NUM; i++) ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300); - iassert(lyt->screen_set_render_order(output, ivilayers, LAYER_NUM) == IVI_SUCCEEDED); + lyt->screen_set_render_order(output, ivilayers, LAYER_NUM); lyt->layer_destroy(ivilayers[1]); @@ -764,22 +617,20 @@ test_layer_properties_changed_notification(struct test_context *ctx) ctx->layer_property_changed.notify = test_layer_properties_changed_notification_callback; - iassert(lyt->layer_add_listener(ivilayer, &ctx->layer_property_changed) == IVI_SUCCEEDED); + lyt->layer_add_listener(ivilayer, &ctx->layer_property_changed); lyt->commit_changes(); iassert(ctx->user_flags == 0); - iassert(lyt->layer_set_destination_rectangle( - ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED); + lyt->layer_set_destination_rectangle(ivilayer, 20, 30, 200, 300); lyt->commit_changes(); iassert(ctx->user_flags == 1); ctx->user_flags = 0; - iassert(lyt->layer_set_destination_rectangle( - ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED); + lyt->layer_set_destination_rectangle(ivilayer, 20, 30, 200, 300); lyt->commit_changes(); @@ -826,7 +677,7 @@ test_layer_create_notification(struct test_context *ctx) ctx->user_flags = 0; ctx->layer_created.notify = test_layer_create_notification_callback; - iassert(lyt->add_listener_create_layer(&ctx->layer_created) == IVI_SUCCEEDED); + lyt->add_listener_create_layer(&ctx->layer_created); ivilayers[0] = lyt->layer_create_with_dimension(layers[0], 200, 300); iassert(ctx->user_flags == 1); @@ -876,7 +727,7 @@ test_layer_remove_notification(struct test_context *ctx) ctx->layer_removed.notify = test_layer_remove_notification_callback; ivilayers[0] = lyt->layer_create_with_dimension(layers[0], 200, 300); - iassert(lyt->add_listener_remove_layer(&ctx->layer_removed) == IVI_SUCCEEDED); + lyt->add_listener_remove_layer(&ctx->layer_removed); lyt->layer_destroy(ivilayers[0]); iassert(ctx->user_flags == 1); @@ -892,77 +743,11 @@ test_layer_remove_notification(struct test_context *ctx) #undef LAYER_NUM } -static void -test_layer_bad_properties_changed_notification_callback(struct wl_listener *listener, void *data) -{ -} - -static void -test_layer_bad_properties_changed_notification(struct test_context *ctx) -{ - const struct ivi_layout_interface *lyt = ctx->layout_interface; - struct ivi_layout_layer *ivilayer; - - ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); - - ctx->layer_property_changed.notify = test_layer_bad_properties_changed_notification_callback; - - iassert(lyt->layer_add_listener(NULL, &ctx->layer_property_changed) == IVI_FAILED); - iassert(lyt->layer_add_listener(ivilayer, NULL) == IVI_FAILED); - - lyt->layer_destroy(ivilayer); -} - -static void -test_surface_bad_configure_notification(struct test_context *ctx) -{ - const struct ivi_layout_interface *lyt = ctx->layout_interface; - - iassert(lyt->add_listener_configure_surface(NULL) == IVI_FAILED); -} - -static void -test_layer_bad_create_notification(struct test_context *ctx) -{ - const struct ivi_layout_interface *lyt = ctx->layout_interface; - - iassert(lyt->add_listener_create_layer(NULL) == IVI_FAILED); -} - -static void -test_surface_bad_create_notification(struct test_context *ctx) -{ - const struct ivi_layout_interface *lyt = ctx->layout_interface; - - iassert(lyt->add_listener_create_surface(NULL) == IVI_FAILED); -} - -static void -test_layer_bad_remove_notification(struct test_context *ctx) -{ - const struct ivi_layout_interface *lyt = ctx->layout_interface; - - iassert(lyt->add_listener_remove_layer(NULL) == IVI_FAILED); -} - -static void -test_surface_bad_remove_notification(struct test_context *ctx) -{ - const struct ivi_layout_interface *lyt = ctx->layout_interface; - - iassert(lyt->add_listener_remove_surface(NULL) == IVI_FAILED); -} - /************************ tests end ********************************/ static void run_internal_tests(struct test_context *ctx) { - test_surface_bad_visibility(ctx); - test_surface_bad_destination_rectangle(ctx); - test_surface_bad_source_rectangle(ctx); - test_surface_bad_properties(ctx); - test_layer_create(ctx); test_layer_visibility(ctx); test_layer_opacity(ctx); @@ -970,12 +755,7 @@ run_internal_tests(struct test_context *ctx) test_layer_position(ctx); test_layer_destination_rectangle(ctx); test_layer_source_rectangle(ctx); - test_layer_bad_remove(ctx); - test_layer_bad_visibility(ctx); test_layer_bad_opacity(ctx); - test_layer_bad_destination_rectangle(ctx); - test_layer_bad_source_rectangle(ctx); - test_layer_bad_properties(ctx); test_commit_changes_after_visibility_set_layer_destroy(ctx); test_commit_changes_after_opacity_set_layer_destroy(ctx); test_commit_changes_after_source_rectangle_set_layer_destroy(ctx); @@ -984,21 +764,13 @@ run_internal_tests(struct test_context *ctx) test_get_layer_after_destory_layer(ctx); test_screen_render_order(ctx); - test_screen_bad_render_order(ctx); test_screen_add_layers(ctx); test_screen_remove_layer(ctx); - test_screen_bad_remove_layer(ctx); test_commit_changes_after_render_order_set_layer_destroy(ctx); test_layer_properties_changed_notification(ctx); test_layer_create_notification(ctx); test_layer_remove_notification(ctx); - test_layer_bad_properties_changed_notification(ctx); - test_surface_bad_configure_notification(ctx); - test_layer_bad_create_notification(ctx); - test_surface_bad_create_notification(ctx); - test_layer_bad_remove_notification(ctx); - test_surface_bad_remove_notification(ctx); } PLUGIN_TEST(ivi_layout_internal) diff --git a/tests/ivi-layout-test-client.c b/tests/ivi-layout-test-client.c index 9ac9a4dd..b49701cc 100644 --- a/tests/ivi-layout-test-client.c +++ b/tests/ivi-layout-test-client.c @@ -205,7 +205,6 @@ const char * const basic_test_names[] = { "surface_source_rectangle", "surface_bad_opacity", "surface_properties_changed_notification", - "surface_bad_properties_changed_notification", "surface_on_many_layer", }; @@ -218,7 +217,6 @@ 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", }; diff --git a/tests/ivi-layout-test-plugin.c b/tests/ivi-layout-test-plugin.c index 8b8bdc8d..9f0ecafb 100644 --- a/tests/ivi-layout-test-plugin.c +++ b/tests/ivi-layout-test-plugin.c @@ -323,14 +323,12 @@ RUNNER_TEST(surface_visibility) { const struct ivi_layout_interface *lyt = ctx->layout_interface; struct ivi_layout_surface *ivisurf; - int32_t ret; const struct ivi_layout_surface_properties *prop; ivisurf = lyt->get_surface_from_id(IVI_TEST_SURFACE_ID(0)); runner_assert(ivisurf); - ret = lyt->surface_set_visibility(ivisurf, true); - runner_assert(ret == IVI_SUCCEEDED); + lyt->surface_set_visibility(ivisurf, true); lyt->commit_changes(); @@ -375,9 +373,8 @@ RUNNER_TEST(surface_dimension) runner_assert(prop->dest_width == 1); runner_assert(prop->dest_height == 1); - runner_assert(IVI_SUCCEEDED == - lyt->surface_set_destination_rectangle(ivisurf, prop->dest_x, - prop->dest_y, 200, 300)); + lyt->surface_set_destination_rectangle(ivisurf, prop->dest_x, + prop->dest_y, 200, 300); runner_assert(prop->dest_width == 1); runner_assert(prop->dest_height == 1); @@ -404,9 +401,9 @@ RUNNER_TEST(surface_position) runner_assert(prop->dest_x == 0); runner_assert(prop->dest_y == 0); - runner_assert(lyt->surface_set_destination_rectangle( - ivisurf, 20, 30, - prop->dest_width, prop->dest_height) == IVI_SUCCEEDED); + lyt->surface_set_destination_rectangle(ivisurf, 20, 30, + prop->dest_width, + prop->dest_height); runner_assert(prop->dest_x == 0); runner_assert(prop->dest_y == 0); @@ -435,8 +432,7 @@ RUNNER_TEST(surface_destination_rectangle) runner_assert(prop->dest_x == 0); runner_assert(prop->dest_y == 0); - runner_assert(lyt->surface_set_destination_rectangle( - ivisurf, 20, 30, 200, 300) == IVI_SUCCEEDED); + lyt->surface_set_destination_rectangle(ivisurf, 20, 30, 200, 300); prop = lyt->get_properties_of_surface(ivisurf); runner_assert_or_return(prop); @@ -471,8 +467,7 @@ RUNNER_TEST(surface_source_rectangle) runner_assert(prop->source_x == 0); runner_assert(prop->source_y == 0); - runner_assert(lyt->surface_set_source_rectangle( - ivisurf, 20, 30, 200, 300) == IVI_SUCCEEDED); + lyt->surface_set_source_rectangle(ivisurf, 20, 30, 200, 300); prop = lyt->get_properties_of_surface(ivisurf); runner_assert_or_return(prop); @@ -500,9 +495,6 @@ RUNNER_TEST(surface_bad_opacity) ivisurf = lyt->get_surface_from_id(IVI_TEST_SURFACE_ID(0)); runner_assert(ivisurf != NULL); - runner_assert(lyt->surface_set_opacity( - NULL, wl_fixed_from_double(0.3)) == IVI_FAILED); - runner_assert(lyt->surface_set_opacity( ivisurf, wl_fixed_from_double(0.3)) == IVI_SUCCEEDED); @@ -521,9 +513,6 @@ RUNNER_TEST(surface_bad_opacity) runner_assert(prop->opacity == wl_fixed_from_double(0.3)); - runner_assert(lyt->surface_set_opacity( - NULL, wl_fixed_from_double(0.5)) == IVI_FAILED); - lyt->commit_changes(); } @@ -542,14 +531,12 @@ RUNNER_TEST(surface_on_many_layer) 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->layer_add_surface(ivilayers[i], ivisurf); } lyt->commit_changes(); - runner_assert(lyt->get_layers_under_surface( - ivisurf, &length, &array) == IVI_SUCCEEDED); + lyt->get_layers_under_surface(ivisurf, &length, &array); runner_assert(IVI_TEST_LAYER_COUNT == length); for (i = 0; i < IVI_TEST_LAYER_COUNT; i++) runner_assert(array[i] == ivilayers[i]); @@ -564,8 +551,7 @@ RUNNER_TEST(surface_on_many_layer) lyt->commit_changes(); - runner_assert(lyt->get_layers_under_surface( - ivisurf, &length, &array) == IVI_SUCCEEDED); + lyt->get_layers_under_surface( ivisurf, &length, &array); runner_assert(length == 0 && array == NULL); for (i = 0; i < IVI_TEST_LAYER_COUNT; i++) @@ -586,8 +572,7 @@ RUNNER_TEST(commit_changes_after_visibility_set_surface_destroy) ivisurf = lyt->get_surface_from_id(IVI_TEST_SURFACE_ID(0)); runner_assert(ivisurf != NULL); - runner_assert(lyt->surface_set_visibility( - ivisurf, true) == IVI_SUCCEEDED); + lyt->surface_set_visibility(ivisurf, true); } RUNNER_TEST(commit_changes_after_opacity_set_surface_destroy) @@ -608,8 +593,7 @@ RUNNER_TEST(commit_changes_after_source_rectangle_set_surface_destroy) ivisurf = lyt->get_surface_from_id(IVI_TEST_SURFACE_ID(0)); runner_assert(ivisurf != NULL); - runner_assert(lyt->surface_set_source_rectangle( - ivisurf, 20, 30, 200, 300) == IVI_SUCCEEDED); + lyt->surface_set_source_rectangle( ivisurf, 20, 30, 200, 300); } RUNNER_TEST(commit_changes_after_destination_rectangle_set_surface_destroy) @@ -619,8 +603,7 @@ RUNNER_TEST(commit_changes_after_destination_rectangle_set_surface_destroy) ivisurf = lyt->get_surface_from_id(IVI_TEST_SURFACE_ID(0)); runner_assert(ivisurf != NULL); - runner_assert(lyt->surface_set_destination_rectangle( - ivisurf, 20, 30, 200, 300) == IVI_SUCCEEDED); + lyt->surface_set_destination_rectangle( ivisurf, 20, 30, 200, 300); } RUNNER_TEST(get_surface_after_destroy_surface) @@ -646,13 +629,11 @@ RUNNER_TEST(layer_render_order) 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_set_render_order( - ivilayer, ivisurfs, IVI_TEST_SURFACE_COUNT) == IVI_SUCCEEDED); + lyt->layer_set_render_order( ivilayer, ivisurfs, IVI_TEST_SURFACE_COUNT); lyt->commit_changes(); - runner_assert(lyt->get_surfaces_on_layer( - ivilayer, &length, &array) == IVI_SUCCEEDED); + lyt->get_surfaces_on_layer(ivilayer, &length, &array); runner_assert(IVI_TEST_SURFACE_COUNT == length); for (i = 0; i < IVI_TEST_SURFACE_COUNT; i++) runner_assert(array[i] == ivisurfs[i]); @@ -660,15 +641,13 @@ RUNNER_TEST(layer_render_order) if (length > 0) free(array); - runner_assert(lyt->layer_set_render_order( - ivilayer, NULL, 0) == IVI_SUCCEEDED); + lyt->layer_set_render_order(ivilayer, NULL, 0); array = NULL; lyt->commit_changes(); - runner_assert(lyt->get_surfaces_on_layer( - ivilayer, &length, &array) == IVI_SUCCEEDED); + lyt->get_surfaces_on_layer(ivilayer, &length, &array); runner_assert(length == 0 && array == NULL); lyt->layer_destroy(ivilayer); @@ -688,13 +667,11 @@ RUNNER_TEST(test_layer_render_order_destroy_one_surface_p1) 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_set_render_order( - ivilayer, ivisurfs, IVI_TEST_SURFACE_COUNT) == IVI_SUCCEEDED); + lyt->layer_set_render_order(ivilayer, ivisurfs, IVI_TEST_SURFACE_COUNT); lyt->commit_changes(); - runner_assert(lyt->get_surfaces_on_layer( - ivilayer, &length, &array) == IVI_SUCCEEDED); + lyt->get_surfaces_on_layer(ivilayer, &length, &array); runner_assert(IVI_TEST_SURFACE_COUNT == length); for (i = 0; i < length; i++) runner_assert(array[i] == ivisurfs[i]); @@ -716,8 +693,7 @@ RUNNER_TEST(test_layer_render_order_destroy_one_surface_p2) ivisurfs[0] = lyt->get_surface_from_id(IVI_TEST_SURFACE_ID(0)); ivisurfs[1] = lyt->get_surface_from_id(IVI_TEST_SURFACE_ID(2)); - runner_assert(lyt->get_surfaces_on_layer( - ivilayer, &length, &array) == IVI_SUCCEEDED); + lyt->get_surfaces_on_layer(ivilayer, &length, &array); runner_assert(2 == length); for (i = 0; i < length; i++) runner_assert(array[i] == ivisurfs[i]); @@ -728,40 +704,6 @@ RUNNER_TEST(test_layer_render_order_destroy_one_surface_p2) lyt->layer_destroy(ivilayer); } -RUNNER_TEST(layer_bad_render_order) -{ - 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 = NULL; - 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_set_render_order( - NULL, ivisurfs, IVI_TEST_SURFACE_COUNT) == IVI_FAILED); - - lyt->commit_changes(); - - runner_assert(lyt->get_surfaces_on_layer( - NULL, &length, &array) == IVI_FAILED); - runner_assert(length == 0 && array == NULL); - - runner_assert(lyt->get_surfaces_on_layer( - ivilayer, NULL, &array) == IVI_FAILED); - runner_assert(array == NULL); - - runner_assert(lyt->get_surfaces_on_layer( - ivilayer, &length, NULL) == IVI_FAILED); - runner_assert(length == 0); - - lyt->layer_destroy(ivilayer); -} - RUNNER_TEST(layer_add_surfaces) { const struct ivi_layout_interface *lyt = ctx->layout_interface; @@ -775,14 +717,12 @@ RUNNER_TEST(layer_add_surfaces) 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->layer_add_surface(ivilayer, ivisurfs[i]); } lyt->commit_changes(); - runner_assert(lyt->get_surfaces_on_layer( - ivilayer, &length, &array) == IVI_SUCCEEDED); + lyt->get_surfaces_on_layer(ivilayer, &length, &array); runner_assert(IVI_TEST_SURFACE_COUNT == length); for (i = 0; i < IVI_TEST_SURFACE_COUNT; i++) runner_assert(array[i] == ivisurfs[i]); @@ -790,17 +730,14 @@ RUNNER_TEST(layer_add_surfaces) if (length > 0) free(array); - runner_assert(lyt->layer_set_render_order( - ivilayer, NULL, 0) == IVI_SUCCEEDED); + lyt->layer_set_render_order(ivilayer, NULL, 0); for (i = IVI_TEST_SURFACE_COUNT; i-- > 0;) - runner_assert(lyt->layer_add_surface( - ivilayer, ivisurfs[i]) == IVI_SUCCEEDED); + lyt->layer_add_surface(ivilayer, ivisurfs[i]); lyt->commit_changes(); - runner_assert(lyt->get_surfaces_on_layer( - ivilayer, &length, &array) == IVI_SUCCEEDED); + lyt->get_surfaces_on_layer(ivilayer, &length, &array); 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)]); @@ -823,8 +760,7 @@ RUNNER_TEST(commit_changes_after_render_order_set_surface_destroy) 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_set_render_order( - ivilayer, ivisurfs, IVI_TEST_SURFACE_COUNT) == IVI_SUCCEEDED); + lyt->layer_set_render_order(ivilayer, ivisurfs, IVI_TEST_SURFACE_COUNT); } RUNNER_TEST(cleanup_layer) @@ -864,23 +800,20 @@ RUNNER_TEST(surface_properties_changed_notification) ctx->surface_property_changed.notify = test_surface_properties_changed_notification_callback; - runner_assert(lyt->surface_add_listener( - ivisurf, &ctx->surface_property_changed) == IVI_SUCCEEDED); + lyt->surface_add_listener(ivisurf, &ctx->surface_property_changed); lyt->commit_changes(); runner_assert(ctx->user_flags == 0); - runner_assert(lyt->surface_set_destination_rectangle( - ivisurf, 20, 30, 200, 300) == IVI_SUCCEEDED); + lyt->surface_set_destination_rectangle(ivisurf, 20, 30, 200, 300); lyt->commit_changes(); runner_assert(ctx->user_flags == 1); ctx->user_flags = 0; - runner_assert(lyt->surface_set_destination_rectangle( - ivisurf, 20, 30, 200, 300) == IVI_SUCCEEDED); + lyt->surface_set_destination_rectangle(ivisurf, 20, 30, 200, 300); lyt->commit_changes(); @@ -889,8 +822,7 @@ RUNNER_TEST(surface_properties_changed_notification) // remove surface property changed listener. wl_list_remove(&ctx->surface_property_changed.link); ctx->user_flags = 0; - runner_assert(lyt->surface_set_destination_rectangle( - ivisurf, 40, 50, 400, 500) == IVI_SUCCEEDED); + lyt->surface_set_destination_rectangle(ivisurf, 40, 50, 400, 500); lyt->commit_changes(); @@ -916,7 +848,7 @@ RUNNER_TEST(surface_configure_notification_p1) const struct ivi_layout_interface *lyt = ctx->layout_interface; ctx->surface_configured.notify = test_surface_configure_notification_callback; - runner_assert(IVI_SUCCEEDED == lyt->add_listener_configure_surface(&ctx->surface_configured)); + lyt->add_listener_configure_surface(&ctx->surface_configured); lyt->commit_changes(); ctx->user_flags = 0; @@ -958,8 +890,7 @@ RUNNER_TEST(surface_create_notification_p1) const struct ivi_layout_interface *lyt = ctx->layout_interface; ctx->surface_created.notify = test_surface_create_notification_callback; - runner_assert(lyt->add_listener_create_surface( - &ctx->surface_created) == IVI_SUCCEEDED); + lyt->add_listener_create_surface(&ctx->surface_created); ctx->user_flags = 0; } @@ -997,8 +928,7 @@ RUNNER_TEST(surface_remove_notification_p1) const struct ivi_layout_interface *lyt = ctx->layout_interface; ctx->surface_removed.notify = test_surface_remove_notification_callback; - runner_assert(lyt->add_listener_remove_surface(&ctx->surface_removed) - == IVI_SUCCEEDED); + lyt->add_listener_remove_surface(&ctx->surface_removed); ctx->user_flags = 0; } @@ -1016,24 +946,3 @@ RUNNER_TEST(surface_remove_notification_p3) { runner_assert(ctx->user_flags == 0); } - -static void -test_surface_bad_properties_changed_notification_callback(struct wl_listener *listener, void *data) -{ -} - -RUNNER_TEST(surface_bad_properties_changed_notification) -{ - const struct ivi_layout_interface *lyt = ctx->layout_interface; - struct ivi_layout_surface *ivisurf; - - ivisurf = lyt->get_surface_from_id(IVI_TEST_SURFACE_ID(0)); - runner_assert(ivisurf != NULL); - - ctx->surface_property_changed.notify = test_surface_bad_properties_changed_notification_callback; - - runner_assert(lyt->surface_add_listener( - NULL, &ctx->surface_property_changed) == IVI_FAILED); - runner_assert(lyt->surface_add_listener( - ivisurf, NULL) == IVI_FAILED); -}