Skip to content
Snippets Groups Projects
ivi_layout-internal-test.c 30.8 KiB
Newer Older
	const struct ivi_layout_interface *lyt = ctx->layout_interface;
	iassert(lyt->add_notification_create_surface(NULL, 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_notification_remove_layer(NULL, 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_notification_remove_surface(NULL, NULL) == IVI_FAILED);
/************************ 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_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);

	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);
	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_layout_interface *iface,
		       size_t iface_version);

WL_EXPORT int
controller_module_init(struct weston_compositor *compositor,
		       int *argc, char *argv[],
		       const struct ivi_layout_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->layout_interface = iface;

	loop = wl_display_get_event_loop(compositor->wl_display);
	wl_event_loop_add_idle(loop, run_internal_tests, ctx);

	return 0;
}