diff options
Diffstat (limited to 'tests/ivi-layout-internal-test.c')
-rw-r--r-- | tests/ivi-layout-internal-test.c | 286 |
1 files changed, 29 insertions, 257 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 @@ -86,40 +86,6 @@ iassert_fail(const char *cond, const char *file, int line, * 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) { const struct ivi_layout_interface *lyt = ctx->layout_interface; @@ -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); @@ -323,23 +287,6 @@ test_layer_source_rectangle(struct test_context *ctx) } 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) { const struct ivi_layout_interface *lyt = ctx->layout_interface; @@ -350,9 +297,6 @@ test_layer_bad_opacity(struct test_context *ctx) 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); iassert(lyt->layer_set_opacity( @@ -370,41 +314,12 @@ 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) { const struct ivi_layout_interface *lyt = ctx->layout_interface; @@ -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++) @@ -552,39 +465,6 @@ test_screen_render_order(struct test_context *ctx) } 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) { #define LAYER_NUM (3) @@ -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) |