tests: test set for ivi-screen normal use case in server side
These tests are implemented on test suite framework, which provides internal method validation. Following features are tested, - ivi-screen id - ivi-screen resolution - render order of ivi-layers in ivi-screen Signed-off-by: Nobuhiko Tanibata <nobuhiko_tanibata@xddp.denso.co.jp> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
This commit is contained in:
committed by
Pekka Paalanen
parent
17d4494224
commit
e78a7afb60
@@ -63,7 +63,6 @@ iassert_fail(const char *cond, const char *file, int line,
|
|||||||
* These are all internal ivi_layout API tests that do not require
|
* These are all internal ivi_layout API tests that do not require
|
||||||
* any client objects.
|
* any client objects.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_surface_bad_visibility(struct test_context *ctx)
|
test_surface_bad_visibility(struct test_context *ctx)
|
||||||
{
|
{
|
||||||
@@ -701,6 +700,106 @@ test_get_layer_after_destory_layer(struct test_context *ctx)
|
|||||||
iassert(ivilayer == NULL);
|
iassert(ivilayer == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_screen_id(struct test_context *ctx)
|
||||||
|
{
|
||||||
|
const struct ivi_controller_interface *ctl = ctx->controller_interface;
|
||||||
|
struct ivi_layout_screen **iviscrns;
|
||||||
|
int32_t screen_length = 0;
|
||||||
|
uint32_t id_screen;
|
||||||
|
int32_t i;
|
||||||
|
|
||||||
|
iassert(ctl->get_screens(&screen_length, &iviscrns) == IVI_SUCCEEDED);
|
||||||
|
iassert(screen_length > 0);
|
||||||
|
|
||||||
|
for (i = 0; i < screen_length; ++i) {
|
||||||
|
id_screen = ctl->get_id_of_screen(iviscrns[i]);
|
||||||
|
iassert(ctl->get_screen_from_id(id_screen) == iviscrns[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (screen_length > 0)
|
||||||
|
free(iviscrns);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_screen_resolution(struct test_context *ctx)
|
||||||
|
{
|
||||||
|
const struct ivi_controller_interface *ctl = ctx->controller_interface;
|
||||||
|
struct ivi_layout_screen **iviscrns;
|
||||||
|
int32_t screen_length = 0;
|
||||||
|
struct weston_output *output;
|
||||||
|
int32_t width;
|
||||||
|
int32_t height;
|
||||||
|
int32_t i;
|
||||||
|
|
||||||
|
iassert(ctl->get_screens(&screen_length, &iviscrns) == IVI_SUCCEEDED);
|
||||||
|
iassert(screen_length > 0);
|
||||||
|
|
||||||
|
for (i = 0; i < screen_length; ++i) {
|
||||||
|
output = ctl->screen_get_output(iviscrns[i]);
|
||||||
|
iassert(output != NULL);
|
||||||
|
iassert(ctl->get_screen_resolution(
|
||||||
|
iviscrns[i], &width, &height) == IVI_SUCCEEDED);
|
||||||
|
iassert(width == output->current_mode->width);
|
||||||
|
iassert(height == output->current_mode->height);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (screen_length > 0)
|
||||||
|
free(iviscrns);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_screen_render_order(struct test_context *ctx)
|
||||||
|
{
|
||||||
|
#define LAYER_NUM (3)
|
||||||
|
const struct ivi_controller_interface *ctl = ctx->controller_interface;
|
||||||
|
struct ivi_layout_screen **iviscrns;
|
||||||
|
int32_t screen_length = 0;
|
||||||
|
struct ivi_layout_screen *iviscrn;
|
||||||
|
struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
|
||||||
|
struct ivi_layout_layer **array;
|
||||||
|
int32_t length = 0;
|
||||||
|
uint32_t i;
|
||||||
|
|
||||||
|
iassert(ctl->get_screens(&screen_length, &iviscrns) == IVI_SUCCEEDED);
|
||||||
|
iassert(screen_length > 0);
|
||||||
|
|
||||||
|
if (screen_length <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
iviscrn = iviscrns[0];
|
||||||
|
|
||||||
|
for (i = 0; i < LAYER_NUM; i++)
|
||||||
|
ivilayers[i] = ctl->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
|
||||||
|
|
||||||
|
iassert(ctl->screen_set_render_order(iviscrn, ivilayers, LAYER_NUM) == IVI_SUCCEEDED);
|
||||||
|
|
||||||
|
ctl->commit_changes();
|
||||||
|
|
||||||
|
iassert(ctl->get_layers_on_screen(iviscrn, &length, &array) == IVI_SUCCEEDED);
|
||||||
|
iassert(length == LAYER_NUM);
|
||||||
|
for (i = 0; i < LAYER_NUM; i++)
|
||||||
|
iassert(array[i] == ivilayers[i]);
|
||||||
|
|
||||||
|
if (length > 0)
|
||||||
|
free(array);
|
||||||
|
|
||||||
|
array = NULL;
|
||||||
|
|
||||||
|
iassert(ctl->screen_set_render_order(iviscrn, NULL, 0) == IVI_SUCCEEDED);
|
||||||
|
|
||||||
|
ctl->commit_changes();
|
||||||
|
|
||||||
|
iassert(ctl->get_layers_on_screen(iviscrn, &length, &array) == IVI_SUCCEEDED);
|
||||||
|
iassert(length == 0 && array == NULL);
|
||||||
|
|
||||||
|
for (i = 0; i < LAYER_NUM; i++)
|
||||||
|
ctl->layer_destroy(ivilayers[i]);
|
||||||
|
|
||||||
|
free(iviscrns);
|
||||||
|
#undef LAYER_NUM
|
||||||
|
}
|
||||||
|
|
||||||
/************************ tests end ********************************/
|
/************************ tests end ********************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -743,6 +842,10 @@ run_internal_tests(void *data)
|
|||||||
test_layer_create_duplicate(ctx);
|
test_layer_create_duplicate(ctx);
|
||||||
test_get_layer_after_destory_layer(ctx);
|
test_get_layer_after_destory_layer(ctx);
|
||||||
|
|
||||||
|
test_screen_id(ctx);
|
||||||
|
test_screen_resolution(ctx);
|
||||||
|
test_screen_render_order(ctx);
|
||||||
|
|
||||||
weston_compositor_exit_with_code(ctx->compositor, EXIT_SUCCESS);
|
weston_compositor_exit_with_code(ctx->compositor, EXIT_SUCCESS);
|
||||||
free(ctx);
|
free(ctx);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user