diff --git a/tests/ivi-layout-test-client.c b/tests/ivi-layout-test-client.c index 19224531..520b3978 100644 --- a/tests/ivi-layout-test-client.c +++ b/tests/ivi-layout-test-client.c @@ -115,10 +115,7 @@ get_ivi_application(struct client *client) { struct global *g; struct global *global_iviapp = NULL; - static struct ivi_application *iviapp; - - if (iviapp) - return iviapp; + struct ivi_application *iviapp; wl_list_for_each(g, &client->global_list, link) { if (strcmp(g->interface, "ivi_application")) @@ -148,13 +145,12 @@ struct ivi_window { }; static struct ivi_window * -client_create_ivi_window(struct client *client, uint32_t ivi_id) +client_create_ivi_window(struct client *client, + struct ivi_application *iviapp, + uint32_t ivi_id) { - struct ivi_application *iviapp; struct ivi_window *wnd; - iviapp = get_ivi_application(client); - wnd = xzalloc(sizeof(*wnd)); wnd->wl_surface = wl_compositor_create_surface(client->wl_compositor); wnd->ivi_surface = ivi_application_surface_create(iviapp, ivi_id, @@ -221,12 +217,14 @@ TEST_P(ivi_layout_runner, basic_test_names) const char * const *test_name = data; struct client *client; struct runner *runner; + struct ivi_application *iviapp; struct ivi_window *wnd; client = create_client(); runner = client_create_runner(client); + iviapp = get_ivi_application(client); - wnd = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(0)); + wnd = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); runner_run(runner, *test_name); @@ -238,13 +236,17 @@ TEST(ivi_layout_surface_create) { struct client *client; struct runner *runner; + struct ivi_application *iviapp; struct ivi_window *winds[2]; client = create_client(); runner = client_create_runner(client); + iviapp = get_ivi_application(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[0] = client_create_ivi_window(client, iviapp, + IVI_TEST_SURFACE_ID(0)); + winds[1] = client_create_ivi_window(client, iviapp, + IVI_TEST_SURFACE_ID(1)); runner_run(runner, "surface_create_p1"); @@ -262,12 +264,14 @@ TEST_P(commit_changes_after_properties_set_surface_destroy, surface_property_com const char * const *test_name = data; struct client *client; struct runner *runner; + struct ivi_application *iviapp; struct ivi_window *wnd; client = create_client(); runner = client_create_runner(client); + iviapp = get_ivi_application(client); - wnd = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(0)); + wnd = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); runner_run(runner, *test_name); @@ -282,12 +286,14 @@ TEST(get_surface_after_destroy_ivi_surface) { struct client *client; struct runner *runner; + struct ivi_application *iviapp; struct ivi_window *wnd; client = create_client(); runner = client_create_runner(client); + iviapp = get_ivi_application(client); - wnd = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(0)); + wnd = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); ivi_surface_destroy(wnd->ivi_surface); @@ -302,12 +308,14 @@ TEST(get_surface_after_destroy_wl_surface) { struct client *client; struct runner *runner; + struct ivi_application *iviapp; struct ivi_window *wnd; client = create_client(); runner = client_create_runner(client); + iviapp = get_ivi_application(client); - wnd = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(0)); + wnd = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); wl_surface_destroy(wnd->wl_surface); @@ -324,14 +332,19 @@ TEST_P(ivi_layout_layer_render_order_runner, render_order_test_names) const char * const *test_name = data; struct client *client; struct runner *runner; + struct ivi_application *iviapp; struct ivi_window *winds[3]; client = create_client(); runner = client_create_runner(client); + iviapp = get_ivi_application(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)); + winds[0] = client_create_ivi_window(client, iviapp, + IVI_TEST_SURFACE_ID(0)); + winds[1] = client_create_ivi_window(client, iviapp, + IVI_TEST_SURFACE_ID(1)); + winds[2] = client_create_ivi_window(client, iviapp, + IVI_TEST_SURFACE_ID(2)); runner_run(runner, *test_name); @@ -345,14 +358,19 @@ TEST(destroy_surface_after_layer_render_order) { struct client *client; struct runner *runner; + struct ivi_application *iviapp; struct ivi_window *winds[3]; client = create_client(); runner = client_create_runner(client); + iviapp = get_ivi_application(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)); + winds[0] = client_create_ivi_window(client, iviapp, + IVI_TEST_SURFACE_ID(0)); + winds[1] = client_create_ivi_window(client, iviapp, + IVI_TEST_SURFACE_ID(1)); + winds[2] = client_create_ivi_window(client, iviapp, + IVI_TEST_SURFACE_ID(2)); runner_run(runner, "test_layer_render_order_destroy_one_surface_p1"); @@ -369,14 +387,19 @@ TEST(commit_changes_after_render_order_set_surface_destroy) { struct client *client; struct runner *runner; + struct ivi_application *iviapp; struct ivi_window *winds[3]; client = create_client(); runner = client_create_runner(client); + iviapp = get_ivi_application(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)); + winds[0] = client_create_ivi_window(client, iviapp, + IVI_TEST_SURFACE_ID(0)); + winds[1] = client_create_ivi_window(client, iviapp, + IVI_TEST_SURFACE_ID(1)); + winds[2] = client_create_ivi_window(client, iviapp, + IVI_TEST_SURFACE_ID(2)); runner_run(runner, "commit_changes_after_render_order_set_surface_destroy"); @@ -394,15 +417,17 @@ TEST(ivi_layout_surface_configure_notification) { struct client *client; struct runner *runner; + struct ivi_application *iviapp; struct ivi_window *wind; struct buffer *buffer; client = create_client(); runner = client_create_runner(client); + iviapp = get_ivi_application(client); runner_run(runner, "surface_configure_notification_p1"); - wind = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(0)); + wind = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); buffer = create_shm_buffer_a8r8g8b8(client, 200, 300); @@ -427,19 +452,21 @@ TEST(ivi_layout_surface_create_notification) { struct client *client; struct runner *runner; + struct ivi_application *iviapp; struct ivi_window *wind; client = create_client(); runner = client_create_runner(client); + iviapp = get_ivi_application(client); runner_run(runner, "surface_create_notification_p1"); - wind = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(0)); + wind = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); runner_run(runner, "surface_create_notification_p2"); ivi_window_destroy(wind); - wind = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(0)); + wind = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); runner_run(runner, "surface_create_notification_p3"); ivi_window_destroy(wind); @@ -450,18 +477,20 @@ TEST(ivi_layout_surface_remove_notification) { struct client *client; struct runner *runner; + struct ivi_application *iviapp; struct ivi_window *wind; client = create_client(); runner = client_create_runner(client); + iviapp = get_ivi_application(client); - wind = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(0)); + wind = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); runner_run(runner, "surface_remove_notification_p1"); ivi_window_destroy(wind); runner_run(runner, "surface_remove_notification_p2"); - wind = client_create_ivi_window(client, IVI_TEST_SURFACE_ID(0)); + wind = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); ivi_window_destroy(wind); runner_run(runner, "surface_remove_notification_p3");