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

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


On 06/21/2015 11:34 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,
> - bad render order of ivi-surface on ivi-layer
> - call commitchanges after a ivi_surface in render order is destoryed
> 
> 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 | 113 +++++++++++++++++++++++++++++++++++++++++
>  tests/ivi_layout-test.c        |  50 ++++++++++++++++++
>  2 files changed, 163 insertions(+)
> 
> diff --git a/tests/ivi_layout-test-plugin.c b/tests/ivi_layout-test-plugin.c
> index afd108b..d24c9a1 100644
> --- a/tests/ivi_layout-test-plugin.c
> +++ b/tests/ivi_layout-test-plugin.c
> @@ -739,3 +739,116 @@ RUNNER_TEST(layer_render_order)
>  	ctl->layer_destroy(ivilayer);
>  }
>  
> +RUNNER_TEST(test_layer_render_order_destroy_one_surface_p1)
> +{
> +	const struct ivi_controller_interface *ctl = ctx->controller_interface;
> +	struct ivi_layout_layer *ivilayer;
> +	struct ivi_layout_surface *ivisurfs[IVI_TEST_SURFACE_COUNT] = {};
> +	struct ivi_layout_surface **array;
> +	int32_t length = 0;
> +	int32_t i;
> +
> +	ivilayer = ctl->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
> +
> +	for (i = 0; i < IVI_TEST_SURFACE_COUNT; i++)
> +		ivisurfs[i] = ctl->get_surface_from_id(IVI_TEST_SURFACE_ID(i));
> +
> +	runner_assert(ctl->layer_set_render_order(
> +		      ivilayer, ivisurfs, IVI_TEST_SURFACE_COUNT) == IVI_SUCCEEDED);
> +
> +	ctl->commit_changes();
> +
> +	runner_assert(ctl->get_surfaces_on_layer(
> +		      ivilayer, &length, &array) == IVI_SUCCEEDED);
> +	runner_assert(IVI_TEST_SURFACE_COUNT == length);
> +	for (i = 0; i < length; i++)
> +		runner_assert(array[i] == ivisurfs[i]);
> +
> +	if (length > 0)
> +		free(array);
> +}
> +
> +RUNNER_TEST(test_layer_render_order_destroy_one_surface_p2)
> +{
> +	const struct ivi_controller_interface *ctl = ctx->controller_interface;
> +	struct ivi_layout_layer *ivilayer;
> +	struct ivi_layout_surface *ivisurfs[2] = {};
> +	struct ivi_layout_surface **array;
> +	int32_t length = 0;
> +	int32_t i;
> +
> +	ivilayer = ctl->get_layer_from_id(IVI_TEST_LAYER_ID(0));
> +	ivisurfs[0] = ctl->get_surface_from_id(IVI_TEST_SURFACE_ID(0));
> +	ivisurfs[1] = ctl->get_surface_from_id(IVI_TEST_SURFACE_ID(2));
> +
> +	runner_assert(ctl->get_surfaces_on_layer(
> +		      ivilayer, &length, &array) == IVI_SUCCEEDED);
> +	runner_assert(2 == length);
> +	for (i = 0; i < length; i++)
> +		runner_assert(array[i] == ivisurfs[i]);
> +
> +	if (length > 0)
> +		free(array);
> +
> +	ctl->layer_destroy(ivilayer);
> +}
> +
> +RUNNER_TEST(layer_bad_render_order)
> +{
> +	const struct ivi_controller_interface *ctl = ctx->controller_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 = ctl->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
> +
> +	for (i = 0; i < IVI_TEST_SURFACE_COUNT; i++)
> +		ivisurfs[i] = ctl->get_surface_from_id(IVI_TEST_SURFACE_ID(i));
> +
> +	runner_assert(ctl->layer_set_render_order(
> +		      NULL, ivisurfs, IVI_TEST_SURFACE_COUNT) == IVI_FAILED);
> +
> +	ctl->commit_changes();
> +
> +	runner_assert(ctl->get_surfaces_on_layer(
> +		      NULL, &length, &array) == IVI_FAILED);
> +	runner_assert(length == 0 && array == NULL);
> +
> +	runner_assert(ctl->get_surfaces_on_layer(
> +		      ivilayer, NULL, &array) == IVI_FAILED);
> +	runner_assert(array == NULL);
> +
> +	runner_assert(ctl->get_surfaces_on_layer(
> +		      ivilayer, &length, NULL) == IVI_FAILED);
> +	runner_assert(length == 0);
> +
> +	ctl->layer_destroy(ivilayer);
> +}
> +
> +RUNNER_TEST(commit_changes_after_render_order_set_surface_destroy)
> +{
> +	const struct ivi_controller_interface *ctl = ctx->controller_interface;
> +	struct ivi_layout_layer *ivilayer;
> +	struct ivi_layout_surface *ivisurfs[IVI_TEST_SURFACE_COUNT] = {};
> +	int i;
> +
> +	ivilayer = ctl->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
> +
> +	for (i = 0; i < IVI_TEST_SURFACE_COUNT; i++)
> +		ivisurfs[i] = ctl->get_surface_from_id(IVI_TEST_SURFACE_ID(i));
> +
> +	runner_assert(ctl->layer_set_render_order(
> +		      ivilayer, ivisurfs, IVI_TEST_SURFACE_COUNT) == IVI_SUCCEEDED);
> +}
> +
> +RUNNER_TEST(cleanup_layer)
> +{
> +	const struct ivi_controller_interface *ctl = ctx->controller_interface;
> +	struct ivi_layout_layer *ivilayer;
> +
> +	ivilayer = ctl->get_layer_from_id(IVI_TEST_LAYER_ID(0));
> +	ctl->layer_destroy(ivilayer);
> +}
> +
> diff --git a/tests/ivi_layout-test.c b/tests/ivi_layout-test.c
> index 051ded4..2ac67a4 100644
> --- a/tests/ivi_layout-test.c
> +++ b/tests/ivi_layout-test.c
> @@ -210,6 +210,7 @@ const char * const surface_property_commit_changes_test_names[] = {
>  
>  const char * const render_order_test_names[] = {
>  	"layer_render_order",
> +	"layer_bad_render_order",
>  };
>  
>  TEST_P(ivi_layout_runner, basic_test_names)
> @@ -337,3 +338,52 @@ TEST_P(ivi_layout_layer_render_order_runner, render_order_test_names)
>  	ivi_window_destroy(winds[2]);
>  	runner_destroy(runner);
>  }
> +
> +TEST(destroy_surface_after_layer_render_order)
> +{
> +	struct client *client;
> +	struct runner *runner;
> +	struct ivi_window *winds[3];
> +
> +	client = create_client();
> +	runner = client_create_runner(client);
> +
> +	winds[0] = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(0));
> +	winds[1] = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(1));
> +	winds[2] = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(2));
> +
> +	runner_run(runner, "test_layer_render_order_destroy_one_surface_p1");
> +
> +	ivi_window_destroy(winds[1]);
> +
> +	runner_run(runner, "test_layer_render_order_destroy_one_surface_p2");
> +
> +	ivi_window_destroy(winds[0]);
> +	ivi_window_destroy(winds[2]);
> +	runner_destroy(runner);
> +}
> +
> +TEST(commit_changes_after_render_order_set_surface_destroy)
> +{
> +	struct client *client;
> +	struct runner *runner;
> +	struct ivi_window *winds[3];
> +
> +	client = create_client();
> +	runner = client_create_runner(client);
> +
> +	winds[0] = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(0));
> +	winds[1] = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(1));
> +	winds[2] = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(2));
> +
> +	runner_run(runner, "commit_changes_after_render_order_set_surface_destroy");
> +
> +	ivi_window_destroy(winds[1]);
> +
> +	runner_run(runner, "ivi_layout_commit_changes");
> +	runner_run(runner, "cleanup_layer");
> +
> +	ivi_window_destroy(winds[0]);
> +	ivi_window_destroy(winds[2]);
> +	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