Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2015 Collabora, Ltd. |
| 3 | * |
Bryce Harrington | 2cc9297 | 2015-06-11 15:39:40 -0700 | [diff] [blame] | 4 | * Permission is hereby granted, free of charge, to any person obtaining |
| 5 | * a copy of this software and associated documentation files (the |
| 6 | * "Software"), to deal in the Software without restriction, including |
| 7 | * without limitation the rights to use, copy, modify, merge, publish, |
| 8 | * distribute, sublicense, and/or sell copies of the Software, and to |
| 9 | * permit persons to whom the Software is furnished to do so, subject to |
| 10 | * the following conditions: |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 11 | * |
Bryce Harrington | 2cc9297 | 2015-06-11 15:39:40 -0700 | [diff] [blame] | 12 | * The above copyright notice and this permission notice (including the |
| 13 | * next paragraph) shall be included in all copies or substantial |
| 14 | * portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 23 | * SOFTWARE. |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 24 | */ |
| 25 | |
| 26 | #include "config.h" |
| 27 | |
Jussi Kukkonen | 649bbce | 2016-07-19 14:16:27 +0300 | [diff] [blame] | 28 | #include <stdint.h> |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 29 | #include <stdio.h> |
| 30 | #include <string.h> |
| 31 | |
Jon Cruz | 35b2eaa | 2015-06-15 15:37:08 -0700 | [diff] [blame] | 32 | #include "shared/helpers.h" |
Bryce Harrington | e99e4bf | 2016-03-16 14:15:18 -0700 | [diff] [blame] | 33 | #include "shared/xalloc.h" |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 34 | #include "weston-test-client-helper.h" |
| 35 | #include "ivi-application-client-protocol.h" |
| 36 | #include "ivi-test.h" |
| 37 | |
| 38 | struct runner { |
| 39 | struct client *client; |
| 40 | struct weston_test_runner *test_runner; |
| 41 | int done; |
| 42 | }; |
| 43 | |
| 44 | static void |
| 45 | runner_finished_handler(void *data, struct weston_test_runner *test_runner) |
| 46 | { |
| 47 | struct runner *runner = data; |
| 48 | |
| 49 | runner->done = 1; |
| 50 | } |
| 51 | |
| 52 | static const struct weston_test_runner_listener test_runner_listener = { |
| 53 | runner_finished_handler |
| 54 | }; |
| 55 | |
| 56 | static struct runner * |
| 57 | client_create_runner(struct client *client) |
| 58 | { |
| 59 | struct runner *runner; |
| 60 | struct global *g; |
| 61 | struct global *global_runner = NULL; |
| 62 | |
| 63 | runner = xzalloc(sizeof(*runner)); |
| 64 | runner->client = client; |
| 65 | |
| 66 | wl_list_for_each(g, &client->global_list, link) { |
| 67 | if (strcmp(g->interface, "weston_test_runner")) |
| 68 | continue; |
| 69 | |
| 70 | if (global_runner) |
| 71 | assert(0 && "multiple weston_test_runner objects"); |
| 72 | |
| 73 | global_runner = g; |
| 74 | } |
| 75 | |
| 76 | assert(global_runner && "no weston_test_runner found"); |
| 77 | assert(global_runner->version == 1); |
| 78 | |
| 79 | runner->test_runner = wl_registry_bind(client->wl_registry, |
| 80 | global_runner->name, |
| 81 | &weston_test_runner_interface, |
| 82 | 1); |
| 83 | assert(runner->test_runner); |
| 84 | |
| 85 | weston_test_runner_add_listener(runner->test_runner, |
| 86 | &test_runner_listener, runner); |
| 87 | |
| 88 | return runner; |
| 89 | } |
| 90 | |
| 91 | static void |
| 92 | runner_destroy(struct runner *runner) |
| 93 | { |
| 94 | weston_test_runner_destroy(runner->test_runner); |
| 95 | client_roundtrip(runner->client); |
| 96 | free(runner); |
| 97 | } |
| 98 | |
| 99 | static void |
| 100 | runner_run(struct runner *runner, const char *test_name) |
| 101 | { |
Pekka Paalanen | 12a138d | 2019-11-06 15:59:33 +0200 | [diff] [blame^] | 102 | testlog("weston_test_runner.run(\"%s\")\n", test_name); |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 103 | |
| 104 | runner->done = 0; |
| 105 | weston_test_runner_run(runner->test_runner, test_name); |
| 106 | |
| 107 | while (!runner->done) { |
| 108 | if (wl_display_dispatch(runner->client->wl_display) < 0) |
| 109 | assert(0 && "runner wait"); |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | static struct ivi_application * |
| 114 | get_ivi_application(struct client *client) |
| 115 | { |
| 116 | struct global *g; |
| 117 | struct global *global_iviapp = NULL; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 118 | struct ivi_application *iviapp; |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 119 | |
| 120 | wl_list_for_each(g, &client->global_list, link) { |
| 121 | if (strcmp(g->interface, "ivi_application")) |
| 122 | continue; |
| 123 | |
| 124 | if (global_iviapp) |
| 125 | assert(0 && "multiple ivi_application objects"); |
| 126 | |
| 127 | global_iviapp = g; |
| 128 | } |
| 129 | |
| 130 | assert(global_iviapp && "no ivi_application found"); |
| 131 | |
| 132 | assert(global_iviapp->version == 1); |
| 133 | |
| 134 | iviapp = wl_registry_bind(client->wl_registry, global_iviapp->name, |
| 135 | &ivi_application_interface, 1); |
| 136 | assert(iviapp); |
| 137 | |
| 138 | return iviapp; |
| 139 | } |
| 140 | |
| 141 | struct ivi_window { |
| 142 | struct wl_surface *wl_surface; |
| 143 | struct ivi_surface *ivi_surface; |
| 144 | uint32_t ivi_id; |
| 145 | }; |
| 146 | |
| 147 | static struct ivi_window * |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 148 | client_create_ivi_window(struct client *client, |
| 149 | struct ivi_application *iviapp, |
| 150 | uint32_t ivi_id) |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 151 | { |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 152 | struct ivi_window *wnd; |
| 153 | |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 154 | wnd = xzalloc(sizeof(*wnd)); |
| 155 | wnd->wl_surface = wl_compositor_create_surface(client->wl_compositor); |
| 156 | wnd->ivi_surface = ivi_application_surface_create(iviapp, ivi_id, |
| 157 | wnd->wl_surface); |
| 158 | wnd->ivi_id = ivi_id; |
| 159 | |
| 160 | return wnd; |
| 161 | } |
| 162 | |
| 163 | static void |
| 164 | ivi_window_destroy(struct ivi_window *wnd) |
| 165 | { |
| 166 | ivi_surface_destroy(wnd->ivi_surface); |
| 167 | wl_surface_destroy(wnd->wl_surface); |
| 168 | free(wnd); |
| 169 | } |
| 170 | |
| 171 | /******************************** tests ********************************/ |
| 172 | |
| 173 | /* |
Daniel Stone | 78a4211 | 2016-11-28 15:54:06 +0000 | [diff] [blame] | 174 | * This is a test program, launched by ivi-layout-test-plugin.c. Each TEST() |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 175 | * is forked and exec'd as usual with the weston-test-runner framework. |
| 176 | * |
| 177 | * These tests make use of weston_test_runner global interface exposed by |
Daniel Stone | 78a4211 | 2016-11-28 15:54:06 +0000 | [diff] [blame] | 178 | * ivi-layout-test-plugin.c. This allows these tests to trigger compositor-side |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 179 | * checks. |
| 180 | * |
Daniel Stone | 78a4211 | 2016-11-28 15:54:06 +0000 | [diff] [blame] | 181 | * See ivi-layout-test-plugin.c for further details. |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 182 | */ |
| 183 | |
| 184 | /** |
Daniel Stone | 78a4211 | 2016-11-28 15:54:06 +0000 | [diff] [blame] | 185 | * RUNNER_TEST() names are defined in ivi-layout-test-plugin.c. |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 186 | * Each RUNNER_TEST name listed here uses the same simple initial client setup. |
| 187 | */ |
| 188 | const char * const basic_test_names[] = { |
| 189 | "surface_visibility", |
| 190 | "surface_opacity", |
Nobuhiko Tanibata | 23d9582 | 2015-06-22 15:33:17 +0900 | [diff] [blame] | 191 | "surface_dimension", |
| 192 | "surface_position", |
| 193 | "surface_destination_rectangle", |
| 194 | "surface_source_rectangle", |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 195 | "surface_bad_opacity", |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 196 | "surface_properties_changed_notification", |
Nobuhiko Tanibata | 0af22d4 | 2015-06-22 15:36:21 +0900 | [diff] [blame] | 197 | "surface_bad_properties_changed_notification", |
Ucan, Emre (ADITG/SW1) | 37d25bb | 2016-06-07 09:40:21 +0000 | [diff] [blame] | 198 | "surface_on_many_layer", |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 199 | }; |
| 200 | |
| 201 | const char * const surface_property_commit_changes_test_names[] = { |
| 202 | "commit_changes_after_visibility_set_surface_destroy", |
| 203 | "commit_changes_after_opacity_set_surface_destroy", |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 204 | "commit_changes_after_source_rectangle_set_surface_destroy", |
| 205 | "commit_changes_after_destination_rectangle_set_surface_destroy", |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 206 | }; |
| 207 | |
Nobuhiko Tanibata | d364393 | 2015-06-22 15:34:09 +0900 | [diff] [blame] | 208 | const char * const render_order_test_names[] = { |
| 209 | "layer_render_order", |
Nobuhiko Tanibata | 0671b4d | 2015-06-22 15:34:42 +0900 | [diff] [blame] | 210 | "layer_bad_render_order", |
Ucan, Emre (ADITG/SW1) | 5d6aa9b | 2017-01-18 15:25:35 +0000 | [diff] [blame] | 211 | "layer_add_surfaces", |
Nobuhiko Tanibata | d364393 | 2015-06-22 15:34:09 +0900 | [diff] [blame] | 212 | }; |
| 213 | |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 214 | TEST_P(ivi_layout_runner, basic_test_names) |
| 215 | { |
| 216 | /* an element from basic_test_names */ |
| 217 | const char * const *test_name = data; |
| 218 | struct client *client; |
| 219 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 220 | struct ivi_application *iviapp; |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 221 | struct ivi_window *wnd; |
| 222 | |
| 223 | client = create_client(); |
| 224 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 225 | iviapp = get_ivi_application(client); |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 226 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 227 | wnd = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 228 | |
| 229 | runner_run(runner, *test_name); |
| 230 | |
| 231 | ivi_window_destroy(wnd); |
| 232 | runner_destroy(runner); |
| 233 | } |
| 234 | |
| 235 | TEST(ivi_layout_surface_create) |
| 236 | { |
| 237 | struct client *client; |
| 238 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 239 | struct ivi_application *iviapp; |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 240 | struct ivi_window *winds[2]; |
| 241 | |
| 242 | client = create_client(); |
| 243 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 244 | iviapp = get_ivi_application(client); |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 245 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 246 | winds[0] = client_create_ivi_window(client, iviapp, |
| 247 | IVI_TEST_SURFACE_ID(0)); |
| 248 | winds[1] = client_create_ivi_window(client, iviapp, |
| 249 | IVI_TEST_SURFACE_ID(1)); |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 250 | |
| 251 | runner_run(runner, "surface_create_p1"); |
| 252 | |
| 253 | ivi_window_destroy(winds[0]); |
| 254 | |
| 255 | runner_run(runner, "surface_create_p2"); |
| 256 | |
| 257 | ivi_window_destroy(winds[1]); |
| 258 | runner_destroy(runner); |
| 259 | } |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 260 | |
| 261 | TEST_P(commit_changes_after_properties_set_surface_destroy, surface_property_commit_changes_test_names) |
| 262 | { |
| 263 | /* an element from surface_property_commit_changes_test_names */ |
| 264 | const char * const *test_name = data; |
| 265 | struct client *client; |
| 266 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 267 | struct ivi_application *iviapp; |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 268 | struct ivi_window *wnd; |
| 269 | |
| 270 | client = create_client(); |
| 271 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 272 | iviapp = get_ivi_application(client); |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 273 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 274 | wnd = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 275 | |
| 276 | runner_run(runner, *test_name); |
| 277 | |
| 278 | ivi_window_destroy(wnd); |
| 279 | |
| 280 | runner_run(runner, "ivi_layout_commit_changes"); |
| 281 | |
| 282 | runner_destroy(runner); |
| 283 | } |
| 284 | |
| 285 | TEST(get_surface_after_destroy_ivi_surface) |
| 286 | { |
| 287 | struct client *client; |
| 288 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 289 | struct ivi_application *iviapp; |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 290 | struct ivi_window *wnd; |
| 291 | |
| 292 | client = create_client(); |
| 293 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 294 | iviapp = get_ivi_application(client); |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 295 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 296 | wnd = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 297 | |
| 298 | ivi_surface_destroy(wnd->ivi_surface); |
| 299 | |
| 300 | runner_run(runner, "get_surface_after_destroy_surface"); |
| 301 | |
| 302 | wl_surface_destroy(wnd->wl_surface); |
| 303 | free(wnd); |
| 304 | runner_destroy(runner); |
| 305 | } |
| 306 | |
| 307 | TEST(get_surface_after_destroy_wl_surface) |
| 308 | { |
| 309 | struct client *client; |
| 310 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 311 | struct ivi_application *iviapp; |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 312 | struct ivi_window *wnd; |
| 313 | |
| 314 | client = create_client(); |
| 315 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 316 | iviapp = get_ivi_application(client); |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 317 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 318 | wnd = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 319 | |
| 320 | wl_surface_destroy(wnd->wl_surface); |
| 321 | |
| 322 | runner_run(runner, "get_surface_after_destroy_surface"); |
| 323 | |
| 324 | ivi_surface_destroy(wnd->ivi_surface); |
| 325 | free(wnd); |
| 326 | runner_destroy(runner); |
| 327 | } |
Nobuhiko Tanibata | d364393 | 2015-06-22 15:34:09 +0900 | [diff] [blame] | 328 | |
| 329 | TEST_P(ivi_layout_layer_render_order_runner, render_order_test_names) |
| 330 | { |
| 331 | /* an element from render_order_test_names */ |
| 332 | const char * const *test_name = data; |
| 333 | struct client *client; |
| 334 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 335 | struct ivi_application *iviapp; |
Nobuhiko Tanibata | d364393 | 2015-06-22 15:34:09 +0900 | [diff] [blame] | 336 | struct ivi_window *winds[3]; |
| 337 | |
| 338 | client = create_client(); |
| 339 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 340 | iviapp = get_ivi_application(client); |
Nobuhiko Tanibata | d364393 | 2015-06-22 15:34:09 +0900 | [diff] [blame] | 341 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 342 | winds[0] = client_create_ivi_window(client, iviapp, |
| 343 | IVI_TEST_SURFACE_ID(0)); |
| 344 | winds[1] = client_create_ivi_window(client, iviapp, |
| 345 | IVI_TEST_SURFACE_ID(1)); |
| 346 | winds[2] = client_create_ivi_window(client, iviapp, |
| 347 | IVI_TEST_SURFACE_ID(2)); |
Nobuhiko Tanibata | d364393 | 2015-06-22 15:34:09 +0900 | [diff] [blame] | 348 | |
| 349 | runner_run(runner, *test_name); |
| 350 | |
| 351 | ivi_window_destroy(winds[0]); |
| 352 | ivi_window_destroy(winds[1]); |
| 353 | ivi_window_destroy(winds[2]); |
| 354 | runner_destroy(runner); |
| 355 | } |
Nobuhiko Tanibata | 0671b4d | 2015-06-22 15:34:42 +0900 | [diff] [blame] | 356 | |
| 357 | TEST(destroy_surface_after_layer_render_order) |
| 358 | { |
| 359 | struct client *client; |
| 360 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 361 | struct ivi_application *iviapp; |
Nobuhiko Tanibata | 0671b4d | 2015-06-22 15:34:42 +0900 | [diff] [blame] | 362 | struct ivi_window *winds[3]; |
| 363 | |
| 364 | client = create_client(); |
| 365 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 366 | iviapp = get_ivi_application(client); |
Nobuhiko Tanibata | 0671b4d | 2015-06-22 15:34:42 +0900 | [diff] [blame] | 367 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 368 | winds[0] = client_create_ivi_window(client, iviapp, |
| 369 | IVI_TEST_SURFACE_ID(0)); |
| 370 | winds[1] = client_create_ivi_window(client, iviapp, |
| 371 | IVI_TEST_SURFACE_ID(1)); |
| 372 | winds[2] = client_create_ivi_window(client, iviapp, |
| 373 | IVI_TEST_SURFACE_ID(2)); |
Nobuhiko Tanibata | 0671b4d | 2015-06-22 15:34:42 +0900 | [diff] [blame] | 374 | |
| 375 | runner_run(runner, "test_layer_render_order_destroy_one_surface_p1"); |
| 376 | |
| 377 | ivi_window_destroy(winds[1]); |
| 378 | |
| 379 | runner_run(runner, "test_layer_render_order_destroy_one_surface_p2"); |
| 380 | |
| 381 | ivi_window_destroy(winds[0]); |
| 382 | ivi_window_destroy(winds[2]); |
| 383 | runner_destroy(runner); |
| 384 | } |
| 385 | |
| 386 | TEST(commit_changes_after_render_order_set_surface_destroy) |
| 387 | { |
| 388 | struct client *client; |
| 389 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 390 | struct ivi_application *iviapp; |
Nobuhiko Tanibata | 0671b4d | 2015-06-22 15:34:42 +0900 | [diff] [blame] | 391 | struct ivi_window *winds[3]; |
| 392 | |
| 393 | client = create_client(); |
| 394 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 395 | iviapp = get_ivi_application(client); |
Nobuhiko Tanibata | 0671b4d | 2015-06-22 15:34:42 +0900 | [diff] [blame] | 396 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 397 | winds[0] = client_create_ivi_window(client, iviapp, |
| 398 | IVI_TEST_SURFACE_ID(0)); |
| 399 | winds[1] = client_create_ivi_window(client, iviapp, |
| 400 | IVI_TEST_SURFACE_ID(1)); |
| 401 | winds[2] = client_create_ivi_window(client, iviapp, |
| 402 | IVI_TEST_SURFACE_ID(2)); |
Nobuhiko Tanibata | 0671b4d | 2015-06-22 15:34:42 +0900 | [diff] [blame] | 403 | |
| 404 | runner_run(runner, "commit_changes_after_render_order_set_surface_destroy"); |
| 405 | |
| 406 | ivi_window_destroy(winds[1]); |
| 407 | |
| 408 | runner_run(runner, "ivi_layout_commit_changes"); |
| 409 | runner_run(runner, "cleanup_layer"); |
| 410 | |
| 411 | ivi_window_destroy(winds[0]); |
| 412 | ivi_window_destroy(winds[2]); |
| 413 | runner_destroy(runner); |
| 414 | } |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 415 | |
| 416 | TEST(ivi_layout_surface_configure_notification) |
| 417 | { |
| 418 | struct client *client; |
| 419 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 420 | struct ivi_application *iviapp; |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 421 | struct ivi_window *wind; |
Pekka Paalanen | 41d5231 | 2016-05-20 18:01:05 +0300 | [diff] [blame] | 422 | struct buffer *buffer; |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 423 | |
| 424 | client = create_client(); |
| 425 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 426 | iviapp = get_ivi_application(client); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 427 | |
| 428 | runner_run(runner, "surface_configure_notification_p1"); |
| 429 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 430 | wind = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 431 | |
Pekka Paalanen | 41d5231 | 2016-05-20 18:01:05 +0300 | [diff] [blame] | 432 | buffer = create_shm_buffer_a8r8g8b8(client, 200, 300); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 433 | |
Pekka Paalanen | 41d5231 | 2016-05-20 18:01:05 +0300 | [diff] [blame] | 434 | wl_surface_attach(wind->wl_surface, buffer->proxy, 0, 0); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 435 | wl_surface_damage(wind->wl_surface, 0, 0, 20, 30); |
| 436 | wl_surface_commit(wind->wl_surface); |
| 437 | |
| 438 | runner_run(runner, "surface_configure_notification_p2"); |
| 439 | |
Pekka Paalanen | 41d5231 | 2016-05-20 18:01:05 +0300 | [diff] [blame] | 440 | wl_surface_attach(wind->wl_surface, buffer->proxy, 0, 0); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 441 | wl_surface_damage(wind->wl_surface, 0, 0, 40, 50); |
| 442 | wl_surface_commit(wind->wl_surface); |
| 443 | |
| 444 | runner_run(runner, "surface_configure_notification_p3"); |
| 445 | |
Pekka Paalanen | 41d5231 | 2016-05-20 18:01:05 +0300 | [diff] [blame] | 446 | buffer_destroy(buffer); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 447 | ivi_window_destroy(wind); |
| 448 | runner_destroy(runner); |
| 449 | } |
| 450 | |
| 451 | TEST(ivi_layout_surface_create_notification) |
| 452 | { |
| 453 | struct client *client; |
| 454 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 455 | struct ivi_application *iviapp; |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 456 | struct ivi_window *wind; |
| 457 | |
| 458 | client = create_client(); |
| 459 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 460 | iviapp = get_ivi_application(client); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 461 | |
| 462 | runner_run(runner, "surface_create_notification_p1"); |
| 463 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 464 | wind = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 465 | |
| 466 | runner_run(runner, "surface_create_notification_p2"); |
| 467 | |
| 468 | ivi_window_destroy(wind); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 469 | wind = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 470 | runner_run(runner, "surface_create_notification_p3"); |
| 471 | |
| 472 | ivi_window_destroy(wind); |
| 473 | runner_destroy(runner); |
| 474 | } |
| 475 | |
| 476 | TEST(ivi_layout_surface_remove_notification) |
| 477 | { |
| 478 | struct client *client; |
| 479 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 480 | struct ivi_application *iviapp; |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 481 | struct ivi_window *wind; |
| 482 | |
| 483 | client = create_client(); |
| 484 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 485 | iviapp = get_ivi_application(client); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 486 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 487 | wind = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 488 | runner_run(runner, "surface_remove_notification_p1"); |
| 489 | ivi_window_destroy(wind); |
| 490 | |
| 491 | runner_run(runner, "surface_remove_notification_p2"); |
| 492 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 493 | wind = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 494 | ivi_window_destroy(wind); |
| 495 | runner_run(runner, "surface_remove_notification_p3"); |
| 496 | |
| 497 | runner_destroy(runner); |
| 498 | } |