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" |
Pekka Paalanen | 7f840b7 | 2019-11-11 15:30:07 +0200 | [diff] [blame] | 37 | #include "weston-test-fixture-compositor.h" |
| 38 | |
| 39 | static enum test_result_code |
| 40 | fixture_setup(struct weston_test_harness *harness) |
| 41 | { |
| 42 | struct compositor_setup setup; |
| 43 | |
| 44 | compositor_setup_defaults(&setup); |
| 45 | setup.shell = SHELL_IVI; |
| 46 | setup.extra_module = "test-ivi-layout.so"; |
| 47 | |
| 48 | return weston_test_harness_execute_as_client(harness, &setup); |
| 49 | } |
| 50 | DECLARE_FIXTURE_SETUP(fixture_setup); |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 51 | |
| 52 | struct runner { |
| 53 | struct client *client; |
| 54 | struct weston_test_runner *test_runner; |
| 55 | int done; |
| 56 | }; |
| 57 | |
| 58 | static void |
| 59 | runner_finished_handler(void *data, struct weston_test_runner *test_runner) |
| 60 | { |
| 61 | struct runner *runner = data; |
| 62 | |
| 63 | runner->done = 1; |
| 64 | } |
| 65 | |
| 66 | static const struct weston_test_runner_listener test_runner_listener = { |
| 67 | runner_finished_handler |
| 68 | }; |
| 69 | |
| 70 | static struct runner * |
| 71 | client_create_runner(struct client *client) |
| 72 | { |
| 73 | struct runner *runner; |
| 74 | struct global *g; |
| 75 | struct global *global_runner = NULL; |
| 76 | |
| 77 | runner = xzalloc(sizeof(*runner)); |
| 78 | runner->client = client; |
| 79 | |
| 80 | wl_list_for_each(g, &client->global_list, link) { |
| 81 | if (strcmp(g->interface, "weston_test_runner")) |
| 82 | continue; |
| 83 | |
| 84 | if (global_runner) |
| 85 | assert(0 && "multiple weston_test_runner objects"); |
| 86 | |
| 87 | global_runner = g; |
| 88 | } |
| 89 | |
| 90 | assert(global_runner && "no weston_test_runner found"); |
| 91 | assert(global_runner->version == 1); |
| 92 | |
| 93 | runner->test_runner = wl_registry_bind(client->wl_registry, |
| 94 | global_runner->name, |
| 95 | &weston_test_runner_interface, |
| 96 | 1); |
| 97 | assert(runner->test_runner); |
| 98 | |
| 99 | weston_test_runner_add_listener(runner->test_runner, |
| 100 | &test_runner_listener, runner); |
| 101 | |
| 102 | return runner; |
| 103 | } |
| 104 | |
| 105 | static void |
| 106 | runner_destroy(struct runner *runner) |
| 107 | { |
| 108 | weston_test_runner_destroy(runner->test_runner); |
| 109 | client_roundtrip(runner->client); |
| 110 | free(runner); |
| 111 | } |
| 112 | |
| 113 | static void |
| 114 | runner_run(struct runner *runner, const char *test_name) |
| 115 | { |
Pekka Paalanen | 12a138d | 2019-11-06 15:59:33 +0200 | [diff] [blame] | 116 | testlog("weston_test_runner.run(\"%s\")\n", test_name); |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 117 | |
| 118 | runner->done = 0; |
| 119 | weston_test_runner_run(runner->test_runner, test_name); |
| 120 | |
| 121 | while (!runner->done) { |
| 122 | if (wl_display_dispatch(runner->client->wl_display) < 0) |
| 123 | assert(0 && "runner wait"); |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | static struct ivi_application * |
| 128 | get_ivi_application(struct client *client) |
| 129 | { |
| 130 | struct global *g; |
| 131 | struct global *global_iviapp = NULL; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 132 | struct ivi_application *iviapp; |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 133 | |
| 134 | wl_list_for_each(g, &client->global_list, link) { |
| 135 | if (strcmp(g->interface, "ivi_application")) |
| 136 | continue; |
| 137 | |
| 138 | if (global_iviapp) |
| 139 | assert(0 && "multiple ivi_application objects"); |
| 140 | |
| 141 | global_iviapp = g; |
| 142 | } |
| 143 | |
| 144 | assert(global_iviapp && "no ivi_application found"); |
| 145 | |
| 146 | assert(global_iviapp->version == 1); |
| 147 | |
| 148 | iviapp = wl_registry_bind(client->wl_registry, global_iviapp->name, |
| 149 | &ivi_application_interface, 1); |
| 150 | assert(iviapp); |
| 151 | |
| 152 | return iviapp; |
| 153 | } |
| 154 | |
| 155 | struct ivi_window { |
| 156 | struct wl_surface *wl_surface; |
| 157 | struct ivi_surface *ivi_surface; |
| 158 | uint32_t ivi_id; |
| 159 | }; |
| 160 | |
| 161 | static struct ivi_window * |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 162 | client_create_ivi_window(struct client *client, |
| 163 | struct ivi_application *iviapp, |
| 164 | uint32_t ivi_id) |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 165 | { |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 166 | struct ivi_window *wnd; |
| 167 | |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 168 | wnd = xzalloc(sizeof(*wnd)); |
| 169 | wnd->wl_surface = wl_compositor_create_surface(client->wl_compositor); |
| 170 | wnd->ivi_surface = ivi_application_surface_create(iviapp, ivi_id, |
| 171 | wnd->wl_surface); |
| 172 | wnd->ivi_id = ivi_id; |
| 173 | |
| 174 | return wnd; |
| 175 | } |
| 176 | |
| 177 | static void |
| 178 | ivi_window_destroy(struct ivi_window *wnd) |
| 179 | { |
| 180 | ivi_surface_destroy(wnd->ivi_surface); |
| 181 | wl_surface_destroy(wnd->wl_surface); |
| 182 | free(wnd); |
| 183 | } |
| 184 | |
| 185 | /******************************** tests ********************************/ |
| 186 | |
| 187 | /* |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 188 | * These tests make use of weston_test_runner global interface exposed by |
Daniel Stone | 78a4211 | 2016-11-28 15:54:06 +0000 | [diff] [blame] | 189 | * 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] | 190 | * checks. |
| 191 | * |
Daniel Stone | 78a4211 | 2016-11-28 15:54:06 +0000 | [diff] [blame] | 192 | * See ivi-layout-test-plugin.c for further details. |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 193 | */ |
| 194 | |
| 195 | /** |
Daniel Stone | 78a4211 | 2016-11-28 15:54:06 +0000 | [diff] [blame] | 196 | * RUNNER_TEST() names are defined in ivi-layout-test-plugin.c. |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 197 | * Each RUNNER_TEST name listed here uses the same simple initial client setup. |
| 198 | */ |
| 199 | const char * const basic_test_names[] = { |
| 200 | "surface_visibility", |
| 201 | "surface_opacity", |
Nobuhiko Tanibata | 23d9582 | 2015-06-22 15:33:17 +0900 | [diff] [blame] | 202 | "surface_dimension", |
| 203 | "surface_position", |
| 204 | "surface_destination_rectangle", |
| 205 | "surface_source_rectangle", |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 206 | "surface_bad_opacity", |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 207 | "surface_properties_changed_notification", |
Nobuhiko Tanibata | 0af22d4 | 2015-06-22 15:36:21 +0900 | [diff] [blame] | 208 | "surface_bad_properties_changed_notification", |
Ucan, Emre (ADITG/SW1) | 37d25bb | 2016-06-07 09:40:21 +0000 | [diff] [blame] | 209 | "surface_on_many_layer", |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 210 | }; |
| 211 | |
| 212 | const char * const surface_property_commit_changes_test_names[] = { |
| 213 | "commit_changes_after_visibility_set_surface_destroy", |
| 214 | "commit_changes_after_opacity_set_surface_destroy", |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 215 | "commit_changes_after_source_rectangle_set_surface_destroy", |
| 216 | "commit_changes_after_destination_rectangle_set_surface_destroy", |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 217 | }; |
| 218 | |
Nobuhiko Tanibata | d364393 | 2015-06-22 15:34:09 +0900 | [diff] [blame] | 219 | const char * const render_order_test_names[] = { |
| 220 | "layer_render_order", |
Nobuhiko Tanibata | 0671b4d | 2015-06-22 15:34:42 +0900 | [diff] [blame] | 221 | "layer_bad_render_order", |
Ucan, Emre (ADITG/SW1) | 5d6aa9b | 2017-01-18 15:25:35 +0000 | [diff] [blame] | 222 | "layer_add_surfaces", |
Nobuhiko Tanibata | d364393 | 2015-06-22 15:34:09 +0900 | [diff] [blame] | 223 | }; |
| 224 | |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 225 | TEST_P(ivi_layout_runner, basic_test_names) |
| 226 | { |
| 227 | /* an element from basic_test_names */ |
| 228 | const char * const *test_name = data; |
| 229 | struct client *client; |
| 230 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 231 | struct ivi_application *iviapp; |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 232 | struct ivi_window *wnd; |
| 233 | |
| 234 | client = create_client(); |
| 235 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 236 | iviapp = get_ivi_application(client); |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 237 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 238 | wnd = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 239 | |
| 240 | runner_run(runner, *test_name); |
| 241 | |
| 242 | ivi_window_destroy(wnd); |
| 243 | runner_destroy(runner); |
Pekka Paalanen | fda3696 | 2021-06-14 14:38:04 +0300 | [diff] [blame] | 244 | ivi_application_destroy(iviapp); |
| 245 | client_destroy(client); |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 246 | } |
| 247 | |
| 248 | TEST(ivi_layout_surface_create) |
| 249 | { |
| 250 | struct client *client; |
| 251 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 252 | struct ivi_application *iviapp; |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 253 | struct ivi_window *winds[2]; |
| 254 | |
| 255 | client = create_client(); |
| 256 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 257 | iviapp = get_ivi_application(client); |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 258 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 259 | winds[0] = client_create_ivi_window(client, iviapp, |
| 260 | IVI_TEST_SURFACE_ID(0)); |
| 261 | winds[1] = client_create_ivi_window(client, iviapp, |
| 262 | IVI_TEST_SURFACE_ID(1)); |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 263 | |
| 264 | runner_run(runner, "surface_create_p1"); |
| 265 | |
| 266 | ivi_window_destroy(winds[0]); |
| 267 | |
| 268 | runner_run(runner, "surface_create_p2"); |
| 269 | |
| 270 | ivi_window_destroy(winds[1]); |
| 271 | runner_destroy(runner); |
Pekka Paalanen | fda3696 | 2021-06-14 14:38:04 +0300 | [diff] [blame] | 272 | ivi_application_destroy(iviapp); |
| 273 | client_destroy(client); |
Pekka Paalanen | f5b74f7 | 2015-03-25 12:50:31 +0200 | [diff] [blame] | 274 | } |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 275 | |
| 276 | TEST_P(commit_changes_after_properties_set_surface_destroy, surface_property_commit_changes_test_names) |
| 277 | { |
| 278 | /* an element from surface_property_commit_changes_test_names */ |
| 279 | const char * const *test_name = data; |
| 280 | struct client *client; |
| 281 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 282 | struct ivi_application *iviapp; |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 283 | struct ivi_window *wnd; |
| 284 | |
| 285 | client = create_client(); |
| 286 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 287 | iviapp = get_ivi_application(client); |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 288 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 289 | wnd = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 290 | |
| 291 | runner_run(runner, *test_name); |
| 292 | |
| 293 | ivi_window_destroy(wnd); |
| 294 | |
| 295 | runner_run(runner, "ivi_layout_commit_changes"); |
| 296 | |
| 297 | runner_destroy(runner); |
Pekka Paalanen | fda3696 | 2021-06-14 14:38:04 +0300 | [diff] [blame] | 298 | ivi_application_destroy(iviapp); |
| 299 | client_destroy(client); |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 300 | } |
| 301 | |
| 302 | TEST(get_surface_after_destroy_ivi_surface) |
| 303 | { |
| 304 | struct client *client; |
| 305 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 306 | struct ivi_application *iviapp; |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 307 | struct ivi_window *wnd; |
| 308 | |
| 309 | client = create_client(); |
| 310 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 311 | iviapp = get_ivi_application(client); |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 312 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 313 | wnd = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 314 | |
| 315 | ivi_surface_destroy(wnd->ivi_surface); |
| 316 | |
| 317 | runner_run(runner, "get_surface_after_destroy_surface"); |
| 318 | |
| 319 | wl_surface_destroy(wnd->wl_surface); |
| 320 | free(wnd); |
| 321 | runner_destroy(runner); |
Pekka Paalanen | fda3696 | 2021-06-14 14:38:04 +0300 | [diff] [blame] | 322 | ivi_application_destroy(iviapp); |
| 323 | client_destroy(client); |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 324 | } |
| 325 | |
| 326 | TEST(get_surface_after_destroy_wl_surface) |
| 327 | { |
| 328 | struct client *client; |
| 329 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 330 | struct ivi_application *iviapp; |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 331 | struct ivi_window *wnd; |
| 332 | |
| 333 | client = create_client(); |
| 334 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 335 | iviapp = get_ivi_application(client); |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 336 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 337 | wnd = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 338 | |
| 339 | wl_surface_destroy(wnd->wl_surface); |
| 340 | |
| 341 | runner_run(runner, "get_surface_after_destroy_surface"); |
| 342 | |
| 343 | ivi_surface_destroy(wnd->ivi_surface); |
| 344 | free(wnd); |
| 345 | runner_destroy(runner); |
Pekka Paalanen | fda3696 | 2021-06-14 14:38:04 +0300 | [diff] [blame] | 346 | ivi_application_destroy(iviapp); |
| 347 | client_destroy(client); |
Nobuhiko Tanibata | c74bafa | 2015-06-22 15:33:26 +0900 | [diff] [blame] | 348 | } |
Nobuhiko Tanibata | d364393 | 2015-06-22 15:34:09 +0900 | [diff] [blame] | 349 | |
| 350 | TEST_P(ivi_layout_layer_render_order_runner, render_order_test_names) |
| 351 | { |
| 352 | /* an element from render_order_test_names */ |
| 353 | const char * const *test_name = data; |
| 354 | struct client *client; |
| 355 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 356 | struct ivi_application *iviapp; |
Nobuhiko Tanibata | d364393 | 2015-06-22 15:34:09 +0900 | [diff] [blame] | 357 | struct ivi_window *winds[3]; |
| 358 | |
| 359 | client = create_client(); |
| 360 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 361 | iviapp = get_ivi_application(client); |
Nobuhiko Tanibata | d364393 | 2015-06-22 15:34:09 +0900 | [diff] [blame] | 362 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 363 | winds[0] = client_create_ivi_window(client, iviapp, |
| 364 | IVI_TEST_SURFACE_ID(0)); |
| 365 | winds[1] = client_create_ivi_window(client, iviapp, |
| 366 | IVI_TEST_SURFACE_ID(1)); |
| 367 | winds[2] = client_create_ivi_window(client, iviapp, |
| 368 | IVI_TEST_SURFACE_ID(2)); |
Nobuhiko Tanibata | d364393 | 2015-06-22 15:34:09 +0900 | [diff] [blame] | 369 | |
| 370 | runner_run(runner, *test_name); |
| 371 | |
| 372 | ivi_window_destroy(winds[0]); |
| 373 | ivi_window_destroy(winds[1]); |
| 374 | ivi_window_destroy(winds[2]); |
| 375 | runner_destroy(runner); |
Pekka Paalanen | fda3696 | 2021-06-14 14:38:04 +0300 | [diff] [blame] | 376 | ivi_application_destroy(iviapp); |
| 377 | client_destroy(client); |
Nobuhiko Tanibata | d364393 | 2015-06-22 15:34:09 +0900 | [diff] [blame] | 378 | } |
Nobuhiko Tanibata | 0671b4d | 2015-06-22 15:34:42 +0900 | [diff] [blame] | 379 | |
| 380 | TEST(destroy_surface_after_layer_render_order) |
| 381 | { |
| 382 | struct client *client; |
| 383 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 384 | struct ivi_application *iviapp; |
Nobuhiko Tanibata | 0671b4d | 2015-06-22 15:34:42 +0900 | [diff] [blame] | 385 | struct ivi_window *winds[3]; |
| 386 | |
| 387 | client = create_client(); |
| 388 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 389 | iviapp = get_ivi_application(client); |
Nobuhiko Tanibata | 0671b4d | 2015-06-22 15:34:42 +0900 | [diff] [blame] | 390 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 391 | winds[0] = client_create_ivi_window(client, iviapp, |
| 392 | IVI_TEST_SURFACE_ID(0)); |
| 393 | winds[1] = client_create_ivi_window(client, iviapp, |
| 394 | IVI_TEST_SURFACE_ID(1)); |
| 395 | winds[2] = client_create_ivi_window(client, iviapp, |
| 396 | IVI_TEST_SURFACE_ID(2)); |
Nobuhiko Tanibata | 0671b4d | 2015-06-22 15:34:42 +0900 | [diff] [blame] | 397 | |
| 398 | runner_run(runner, "test_layer_render_order_destroy_one_surface_p1"); |
| 399 | |
| 400 | ivi_window_destroy(winds[1]); |
| 401 | |
| 402 | runner_run(runner, "test_layer_render_order_destroy_one_surface_p2"); |
| 403 | |
| 404 | ivi_window_destroy(winds[0]); |
| 405 | ivi_window_destroy(winds[2]); |
| 406 | runner_destroy(runner); |
Pekka Paalanen | fda3696 | 2021-06-14 14:38:04 +0300 | [diff] [blame] | 407 | ivi_application_destroy(iviapp); |
| 408 | client_destroy(client); |
Nobuhiko Tanibata | 0671b4d | 2015-06-22 15:34:42 +0900 | [diff] [blame] | 409 | } |
| 410 | |
| 411 | TEST(commit_changes_after_render_order_set_surface_destroy) |
| 412 | { |
| 413 | struct client *client; |
| 414 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 415 | struct ivi_application *iviapp; |
Nobuhiko Tanibata | 0671b4d | 2015-06-22 15:34:42 +0900 | [diff] [blame] | 416 | struct ivi_window *winds[3]; |
| 417 | |
| 418 | client = create_client(); |
| 419 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 420 | iviapp = get_ivi_application(client); |
Nobuhiko Tanibata | 0671b4d | 2015-06-22 15:34:42 +0900 | [diff] [blame] | 421 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 422 | winds[0] = client_create_ivi_window(client, iviapp, |
| 423 | IVI_TEST_SURFACE_ID(0)); |
| 424 | winds[1] = client_create_ivi_window(client, iviapp, |
| 425 | IVI_TEST_SURFACE_ID(1)); |
| 426 | winds[2] = client_create_ivi_window(client, iviapp, |
| 427 | IVI_TEST_SURFACE_ID(2)); |
Nobuhiko Tanibata | 0671b4d | 2015-06-22 15:34:42 +0900 | [diff] [blame] | 428 | |
| 429 | runner_run(runner, "commit_changes_after_render_order_set_surface_destroy"); |
| 430 | |
| 431 | ivi_window_destroy(winds[1]); |
| 432 | |
| 433 | runner_run(runner, "ivi_layout_commit_changes"); |
| 434 | runner_run(runner, "cleanup_layer"); |
| 435 | |
| 436 | ivi_window_destroy(winds[0]); |
| 437 | ivi_window_destroy(winds[2]); |
| 438 | runner_destroy(runner); |
Pekka Paalanen | fda3696 | 2021-06-14 14:38:04 +0300 | [diff] [blame] | 439 | ivi_application_destroy(iviapp); |
| 440 | client_destroy(client); |
Nobuhiko Tanibata | 0671b4d | 2015-06-22 15:34:42 +0900 | [diff] [blame] | 441 | } |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 442 | |
| 443 | TEST(ivi_layout_surface_configure_notification) |
| 444 | { |
| 445 | struct client *client; |
| 446 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 447 | struct ivi_application *iviapp; |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 448 | struct ivi_window *wind; |
Pekka Paalanen | 41d5231 | 2016-05-20 18:01:05 +0300 | [diff] [blame] | 449 | struct buffer *buffer; |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 450 | |
| 451 | client = create_client(); |
| 452 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 453 | iviapp = get_ivi_application(client); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 454 | |
| 455 | runner_run(runner, "surface_configure_notification_p1"); |
| 456 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 457 | wind = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 458 | |
Pekka Paalanen | 41d5231 | 2016-05-20 18:01:05 +0300 | [diff] [blame] | 459 | buffer = create_shm_buffer_a8r8g8b8(client, 200, 300); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 460 | |
Pekka Paalanen | 41d5231 | 2016-05-20 18:01:05 +0300 | [diff] [blame] | 461 | wl_surface_attach(wind->wl_surface, buffer->proxy, 0, 0); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 462 | wl_surface_damage(wind->wl_surface, 0, 0, 20, 30); |
| 463 | wl_surface_commit(wind->wl_surface); |
| 464 | |
| 465 | runner_run(runner, "surface_configure_notification_p2"); |
| 466 | |
Pekka Paalanen | 41d5231 | 2016-05-20 18:01:05 +0300 | [diff] [blame] | 467 | wl_surface_attach(wind->wl_surface, buffer->proxy, 0, 0); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 468 | wl_surface_damage(wind->wl_surface, 0, 0, 40, 50); |
| 469 | wl_surface_commit(wind->wl_surface); |
| 470 | |
| 471 | runner_run(runner, "surface_configure_notification_p3"); |
| 472 | |
Pekka Paalanen | 41d5231 | 2016-05-20 18:01:05 +0300 | [diff] [blame] | 473 | buffer_destroy(buffer); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 474 | ivi_window_destroy(wind); |
| 475 | runner_destroy(runner); |
Pekka Paalanen | fda3696 | 2021-06-14 14:38:04 +0300 | [diff] [blame] | 476 | ivi_application_destroy(iviapp); |
| 477 | client_destroy(client); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 478 | } |
| 479 | |
| 480 | TEST(ivi_layout_surface_create_notification) |
| 481 | { |
| 482 | struct client *client; |
| 483 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 484 | struct ivi_application *iviapp; |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 485 | struct ivi_window *wind; |
| 486 | |
| 487 | client = create_client(); |
| 488 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 489 | iviapp = get_ivi_application(client); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 490 | |
| 491 | runner_run(runner, "surface_create_notification_p1"); |
| 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 | |
| 495 | runner_run(runner, "surface_create_notification_p2"); |
| 496 | |
| 497 | ivi_window_destroy(wind); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 498 | wind = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 499 | runner_run(runner, "surface_create_notification_p3"); |
| 500 | |
| 501 | ivi_window_destroy(wind); |
| 502 | runner_destroy(runner); |
Pekka Paalanen | fda3696 | 2021-06-14 14:38:04 +0300 | [diff] [blame] | 503 | ivi_application_destroy(iviapp); |
| 504 | client_destroy(client); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 505 | } |
| 506 | |
| 507 | TEST(ivi_layout_surface_remove_notification) |
| 508 | { |
| 509 | struct client *client; |
| 510 | struct runner *runner; |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 511 | struct ivi_application *iviapp; |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 512 | struct ivi_window *wind; |
| 513 | |
| 514 | client = create_client(); |
| 515 | runner = client_create_runner(client); |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 516 | iviapp = get_ivi_application(client); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 517 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 518 | wind = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 519 | runner_run(runner, "surface_remove_notification_p1"); |
| 520 | ivi_window_destroy(wind); |
| 521 | |
| 522 | runner_run(runner, "surface_remove_notification_p2"); |
| 523 | |
Pekka Paalanen | f8086fb | 2019-11-05 17:03:34 +0200 | [diff] [blame] | 524 | wind = client_create_ivi_window(client, iviapp, IVI_TEST_SURFACE_ID(0)); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 525 | ivi_window_destroy(wind); |
| 526 | runner_run(runner, "surface_remove_notification_p3"); |
| 527 | |
| 528 | runner_destroy(runner); |
Pekka Paalanen | fda3696 | 2021-06-14 14:38:04 +0300 | [diff] [blame] | 529 | ivi_application_destroy(iviapp); |
| 530 | client_destroy(client); |
Nobuhiko Tanibata | 915303a | 2015-06-22 15:35:58 +0900 | [diff] [blame] | 531 | } |