Newer
Older

Nobuhiko Tanibata
committed
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
ctl->layer_destroy(ivilayers[0]);
ctl->layer_destroy(ivilayers[1]);
#undef LAYER_NUM
}
static void
test_layer_remove_notification_callback(struct ivi_layout_layer *ivilayer,
void *userdata)
{
struct test_context *ctx = userdata;
const struct ivi_controller_interface *ctl = ctx->controller_interface;
const struct ivi_layout_layer_properties *prop =
ctl->get_properties_of_layer(ivilayer);
iassert(ctl->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
iassert(prop->source_width == 200);
iassert(prop->source_height == 300);
if (ctl->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
prop->source_width == 200 && prop->source_height == 300)
ctx->user_flags = 1;
}
static void
test_layer_remove_notification(struct test_context *ctx)
{
#define LAYER_NUM (2)
const struct ivi_controller_interface *ctl = ctx->controller_interface;
static const uint32_t layers[LAYER_NUM] = {IVI_TEST_LAYER_ID(0), IVI_TEST_LAYER_ID(1)};
struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
ctx->user_flags = 0;
ivilayers[0] = ctl->layer_create_with_dimension(layers[0], 200, 300);
iassert(ctl->add_notification_remove_layer(
test_layer_remove_notification_callback, ctx) == IVI_SUCCEEDED);
ctl->layer_destroy(ivilayers[0]);
iassert(ctx->user_flags == 1);
ctx->user_flags = 0;
ivilayers[1] = ctl->layer_create_with_dimension(layers[1], 250, 350);
ctl->remove_notification_remove_layer(test_layer_remove_notification_callback, ctx);
ctl->layer_destroy(ivilayers[1]);
iassert(ctx->user_flags == 0);
#undef LAYER_NUM
}
/************************ tests end ********************************/
static void
run_internal_tests(void *data)
{
struct test_context *ctx = data;
test_surface_bad_visibility(ctx);
test_surface_bad_destination_rectangle(ctx);
test_surface_bad_orientation(ctx);
test_surface_bad_dimension(ctx);
test_surface_bad_position(ctx);
test_surface_bad_source_rectangle(ctx);
test_surface_bad_properties(ctx);
test_layer_create(ctx);
test_layer_visibility(ctx);
test_layer_opacity(ctx);
test_layer_orientation(ctx);
test_layer_dimension(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_orientation(ctx);
test_layer_bad_dimension(ctx);
test_layer_bad_position(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_orientation_set_layer_destroy(ctx);
test_commit_changes_after_dimension_set_layer_destroy(ctx);
test_commit_changes_after_position_set_layer_destroy(ctx);
test_commit_changes_after_source_rectangle_set_layer_destroy(ctx);
test_commit_changes_after_destination_rectangle_set_layer_destroy(ctx);
test_layer_create_duplicate(ctx);
test_get_layer_after_destory_layer(ctx);
test_screen_id(ctx);
test_screen_resolution(ctx);
test_screen_render_order(ctx);
test_screen_bad_resolution(ctx);
test_screen_bad_render_order(ctx);
test_commit_changes_after_render_order_set_layer_destroy(ctx);

Nobuhiko Tanibata
committed
test_layer_properties_changed_notification(ctx);
test_layer_create_notification(ctx);
test_layer_remove_notification(ctx);
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
weston_compositor_exit_with_code(ctx->compositor, EXIT_SUCCESS);
free(ctx);
}
int
controller_module_init(struct weston_compositor *compositor,
int *argc, char *argv[],
const struct ivi_controller_interface *iface,
size_t iface_version);
WL_EXPORT int
controller_module_init(struct weston_compositor *compositor,
int *argc, char *argv[],
const struct ivi_controller_interface *iface,
size_t iface_version)
{
struct wl_event_loop *loop;
struct test_context *ctx;
/* strict check, since this is an internal test module */
if (iface_version != sizeof(*iface)) {
weston_log("fatal: controller interface mismatch\n");
return -1;
}
ctx = zalloc(sizeof(*ctx));
if (!ctx)
return -1;
ctx->compositor = compositor;
ctx->controller_interface = iface;
loop = wl_display_get_event_loop(compositor->wl_display);
wl_event_loop_add_idle(loop, run_internal_tests, ctx);
return 0;
}