[PATCH 02/14] tests: test set for ivi-surface bad condition with helper client

Jon A. Cruz jonc at osg.samsung.com
Wed Jun 24 10:01:09 PDT 2015


On 06/21/2015 11:33 PM, Nobuhiko Tanibata wrote:
> From: Nobuhiko Tanibata <NOBUHIKO_TANIBATA at xddp.denso.co.jp>
> 
> These tests are implemented on test suite framework, which provides
> helper client.
> Following features are tested,
> - ivi_layout_runner with basic_test_names[]
>  - surface with bad opacity
> - destroy ivi/wl_surface and call get_surface
> - commit_changes_after_properties_set_surface_destroy with
>   surface_property_commit_changes_test_names[]
>  - call set_visibility, destroy ivi-surface, and commit_changes
>  - call set_opacity, destroy ivi-surface, and commit_changes
>  - call set_orientation, destroy ivi-surface, and commit_changes
>  - call set_dimension, destroy ivi-surface, and commit_changes
>  - call set_position, destroy ivi-surface, and commit_changes
>  - call set_source_rectangle, destroy ivi-surface, and commit_changes
>  - call set_destination_rectangle, destroy ivi-surface, and
>   commit_changes
> 
> Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA at xddp.denso.co.jp>
> Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

Looks good.

Reviewed-by: Jon A. Cruz <jonc at osg.samsung.com>

> ---
>  tests/ivi_layout-test-plugin.c | 134 +++++++++++++++++++++++++++++++++++++++++
>  tests/ivi_layout-test.c        |  73 ++++++++++++++++++++++
>  2 files changed, 207 insertions(+)
> 
> diff --git a/tests/ivi_layout-test-plugin.c b/tests/ivi_layout-test-plugin.c
> index 1d0ce02..fd57d06 100644
> --- a/tests/ivi_layout-test-plugin.c
> +++ b/tests/ivi_layout-test-plugin.c
> @@ -563,3 +563,137 @@ RUNNER_TEST(surface_source_rectangle)
>  	runner_assert(prop->source_x == 20);
>  	runner_assert(prop->source_y == 30);
>  }
> +
> +RUNNER_TEST(surface_bad_opacity)
> +{
> +	const struct ivi_controller_interface *ctl = ctx->controller_interface;
> +	struct ivi_layout_surface *ivisurf;
> +	wl_fixed_t opacity;
> +
> +	ivisurf = ctl->get_surface_from_id(IVI_TEST_SURFACE_ID(0));
> +	runner_assert(ivisurf != NULL);
> +
> +	runner_assert(ctl->surface_set_opacity(
> +		      NULL, wl_fixed_from_double(0.3)) == IVI_FAILED);
> +
> +	runner_assert(ctl->surface_set_opacity(
> +		      ivisurf, wl_fixed_from_double(0.3)) == IVI_SUCCEEDED);
> +
> +	runner_assert(ctl->surface_set_opacity(
> +		      ivisurf, wl_fixed_from_double(-1)) == IVI_FAILED);
> +
> +	ctl->commit_changes();
> +
> +	opacity = ctl->surface_get_opacity(ivisurf);
> +	runner_assert(opacity == wl_fixed_from_double(0.3));
> +
> +	runner_assert(ctl->surface_set_opacity(
> +		      ivisurf, wl_fixed_from_double(1.1)) == IVI_FAILED);
> +
> +	ctl->commit_changes();
> +
> +	opacity = ctl->surface_get_opacity(ivisurf);
> +	runner_assert(opacity == wl_fixed_from_double(0.3));
> +
> +	runner_assert(ctl->surface_set_opacity(
> +		      NULL, wl_fixed_from_double(0.5)) == IVI_FAILED);
> +
> +	ctl->commit_changes();
> +
> +	opacity = ctl->surface_get_opacity(NULL);
> +	runner_assert(opacity == wl_fixed_from_double(0.0));
> +}
> +
> +RUNNER_TEST(ivi_layout_commit_changes)
> +{
> +	const struct ivi_controller_interface *ctl = ctx->controller_interface;
> +
> +	ctl->commit_changes();
> +}
> +
> +RUNNER_TEST(commit_changes_after_visibility_set_surface_destroy)
> +{
> +	const struct ivi_controller_interface *ctl = ctx->controller_interface;
> +	struct ivi_layout_surface *ivisurf;
> +
> +	ivisurf = ctl->get_surface_from_id(IVI_TEST_SURFACE_ID(0));
> +	runner_assert(ivisurf != NULL);
> +	runner_assert(ctl->surface_set_visibility(
> +		      ivisurf, true) == IVI_SUCCEEDED);
> +}
> +
> +RUNNER_TEST(commit_changes_after_opacity_set_surface_destroy)
> +{
> +	const struct ivi_controller_interface *ctl = ctx->controller_interface;
> +	struct ivi_layout_surface *ivisurf;
> +
> +	ivisurf = ctl->get_surface_from_id(IVI_TEST_SURFACE_ID(0));
> +	runner_assert(ivisurf != NULL);
> +	runner_assert(ctl->surface_set_opacity(
> +		      ivisurf, wl_fixed_from_double(0.5)) == IVI_SUCCEEDED);
> +}
> +
> +RUNNER_TEST(commit_changes_after_orientation_set_surface_destroy)
> +{
> +	const struct ivi_controller_interface *ctl = ctx->controller_interface;
> +	struct ivi_layout_surface *ivisurf;
> +
> +	ivisurf = ctl->get_surface_from_id(IVI_TEST_SURFACE_ID(0));
> +	runner_assert(ivisurf != NULL);
> +	runner_assert(ctl->surface_set_orientation(
> +		      ivisurf, WL_OUTPUT_TRANSFORM_90) == IVI_SUCCEEDED);
> +}
> +
> +RUNNER_TEST(commit_changes_after_dimension_set_surface_destroy)
> +{
> +	const struct ivi_controller_interface *ctl = ctx->controller_interface;
> +	struct ivi_layout_surface *ivisurf;
> +
> +	ivisurf = ctl->get_surface_from_id(IVI_TEST_SURFACE_ID(0));
> +	runner_assert(ivisurf != NULL);
> +	runner_assert(ctl->surface_set_dimension(
> +		      ivisurf, 200, 300) == IVI_SUCCEEDED);
> +}
> +
> +RUNNER_TEST(commit_changes_after_position_set_surface_destroy)
> +{
> +	const struct ivi_controller_interface *ctl = ctx->controller_interface;
> +	struct ivi_layout_surface *ivisurf;
> +
> +	ivisurf = ctl->get_surface_from_id(IVI_TEST_SURFACE_ID(0));
> +	runner_assert(ivisurf != NULL);
> +	runner_assert(ctl->surface_set_position(
> +		      ivisurf, 20, 30) == IVI_SUCCEEDED);
> +}
> +
> +RUNNER_TEST(commit_changes_after_source_rectangle_set_surface_destroy)
> +{
> +	const struct ivi_controller_interface *ctl = ctx->controller_interface;
> +	struct ivi_layout_surface *ivisurf;
> +
> +	ivisurf = ctl->get_surface_from_id(IVI_TEST_SURFACE_ID(0));
> +	runner_assert(ivisurf != NULL);
> +	runner_assert(ctl->surface_set_source_rectangle(
> +		      ivisurf, 20, 30, 200, 300) == IVI_SUCCEEDED);
> +}
> +
> +RUNNER_TEST(commit_changes_after_destination_rectangle_set_surface_destroy)
> +{
> +	const struct ivi_controller_interface *ctl = ctx->controller_interface;
> +	struct ivi_layout_surface *ivisurf;
> +
> +	ivisurf = ctl->get_surface_from_id(IVI_TEST_SURFACE_ID(0));
> +	runner_assert(ivisurf != NULL);
> +	runner_assert(ctl->surface_set_destination_rectangle(
> +		      ivisurf, 20, 30, 200, 300) == IVI_SUCCEEDED);
> +}
> +
> +RUNNER_TEST(get_surface_after_destroy_surface)
> +{
> +	const struct ivi_controller_interface *ctl = ctx->controller_interface;
> +	struct ivi_layout_surface *ivisurf;
> +
> +	ivisurf = ctl->get_surface_from_id(IVI_TEST_SURFACE_ID(0));
> +	runner_assert(ivisurf == NULL);
> +}
> +
> diff --git a/tests/ivi_layout-test.c b/tests/ivi_layout-test.c
> index ba0387b..1dc1457 100644
> --- a/tests/ivi_layout-test.c
> +++ b/tests/ivi_layout-test.c
> @@ -195,6 +195,17 @@ const char * const basic_test_names[] = {
>  	"surface_position",
>  	"surface_destination_rectangle",
>  	"surface_source_rectangle",
> +	"surface_bad_opacity",
> +};
> +
> +const char * const surface_property_commit_changes_test_names[] = {
> +	"commit_changes_after_visibility_set_surface_destroy",
> +	"commit_changes_after_opacity_set_surface_destroy",
> +	"commit_changes_after_orientation_set_surface_destroy",
> +	"commit_changes_after_dimension_set_surface_destroy",
> +	"commit_changes_after_position_set_surface_destroy",
> +	"commit_changes_after_source_rectangle_set_surface_destroy",
> +	"commit_changes_after_destination_rectangle_set_surface_destroy",
>  };
>  
>  TEST_P(ivi_layout_runner, basic_test_names)
> @@ -237,3 +248,65 @@ TEST(ivi_layout_surface_create)
>  	ivi_window_destroy(winds[1]);
>  	runner_destroy(runner);
>  }
> +
> +TEST_P(commit_changes_after_properties_set_surface_destroy, surface_property_commit_changes_test_names)
> +{
> +	/* an element from surface_property_commit_changes_test_names */
> +	const char * const *test_name = data;
> +	struct client *client;
> +	struct runner *runner;
> +	struct ivi_window *wnd;
> +
> +	client = create_client();
> +	runner = client_create_runner(client);
> +
> +	wnd = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(0));
> +
> +	runner_run(runner, *test_name);
> +
> +	ivi_window_destroy(wnd);
> +
> +	runner_run(runner, "ivi_layout_commit_changes");
> +
> +	runner_destroy(runner);
> +}
> +
> +TEST(get_surface_after_destroy_ivi_surface)
> +{
> +	struct client *client;
> +	struct runner *runner;
> +	struct ivi_window *wnd;
> +
> +	client = create_client();
> +	runner = client_create_runner(client);
> +
> +	wnd = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(0));
> +
> +	ivi_surface_destroy(wnd->ivi_surface);
> +
> +	runner_run(runner, "get_surface_after_destroy_surface");
> +
> +	wl_surface_destroy(wnd->wl_surface);
> +	free(wnd);
> +	runner_destroy(runner);
> +}
> +
> +TEST(get_surface_after_destroy_wl_surface)
> +{
> +	struct client *client;
> +	struct runner *runner;
> +	struct ivi_window *wnd;
> +
> +	client = create_client();
> +	runner = client_create_runner(client);
> +
> +	wnd = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(0));
> +
> +	wl_surface_destroy(wnd->wl_surface);
> +
> +	runner_run(runner, "get_surface_after_destroy_surface");
> +
> +	ivi_surface_destroy(wnd->ivi_surface);
> +	free(wnd);
> +	runner_destroy(runner);
> +}
> 

-- 
Jon A. Cruz - Senior Open Source Developer
Samsung Open Source Group
jonc at osg.samsung.com


More information about the wayland-devel mailing list