Kristian Høgsberg | 3018b44 | 2012-04-27 15:02:56 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2012 Intel Corporation |
Pekka Paalanen | d1c426e | 2013-02-08 17:01:27 +0200 | [diff] [blame] | 3 | * Copyright © 2013 Collabora, Ltd. |
Kristian Høgsberg | 3018b44 | 2012-04-27 15:02:56 -0400 | [diff] [blame] | 4 | * |
| 5 | * Permission to use, copy, modify, distribute, and sell this software and |
| 6 | * its documentation for any purpose is hereby granted without fee, provided |
| 7 | * that the above copyright notice appear in all copies and that both that |
| 8 | * copyright notice and this permission notice appear in supporting |
| 9 | * documentation, and that the name of the copyright holders not be used in |
| 10 | * advertising or publicity pertaining to distribution of the software |
| 11 | * without specific, written prior permission. The copyright holders make |
| 12 | * no representations about the suitability of this software for any |
| 13 | * purpose. It is provided "as is" without express or implied warranty. |
| 14 | * |
| 15 | * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS |
| 16 | * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND |
| 17 | * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 18 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER |
| 19 | * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF |
| 20 | * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
| 21 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 22 | */ |
| 23 | |
Bryce Harrington | 12cc405 | 2014-11-19 17:18:33 -0800 | [diff] [blame] | 24 | #include "config.h" |
| 25 | |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 26 | #include "weston-test-client-helper.h" |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 27 | |
| 28 | static void |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 29 | check_pointer(struct client *client, int x, int y) |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 30 | { |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 31 | int sx, sy; |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 32 | |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 33 | /* check that the client got the global pointer update */ |
| 34 | assert(client->test->pointer_x == x); |
| 35 | assert(client->test->pointer_y == y); |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 36 | |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 37 | /* Does global pointer map onto the surface? */ |
| 38 | if (surface_contains(client->surface, x, y)) { |
| 39 | /* check that the surface has the pointer focus */ |
| 40 | assert(client->input->pointer->focus == client->surface); |
| 41 | |
| 42 | /* |
| 43 | * check that the local surface pointer maps |
| 44 | * to the global pointer. |
| 45 | */ |
| 46 | sx = client->input->pointer->x + client->surface->x; |
| 47 | sy = client->input->pointer->y + client->surface->y; |
| 48 | assert(sx == x); |
| 49 | assert(sy == y); |
| 50 | } else { |
| 51 | /* |
| 52 | * The global pointer does not map onto surface. So |
| 53 | * check that it doesn't have the pointer focus. |
| 54 | */ |
| 55 | assert(client->input->pointer->focus == NULL); |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 56 | } |
| 57 | } |
| 58 | |
| 59 | static void |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 60 | check_pointer_move(struct client *client, int x, int y) |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 61 | { |
Derek Foreman | f6a6592 | 2015-02-24 09:32:14 -0600 | [diff] [blame] | 62 | weston_test_move_pointer(client->test->weston_test, x, y); |
Pekka Paalanen | f2aa64f | 2012-12-12 14:26:41 +0200 | [diff] [blame] | 63 | client_roundtrip(client); |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 64 | check_pointer(client, x, y); |
| 65 | } |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 66 | |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 67 | TEST(test_pointer_top_left) |
| 68 | { |
| 69 | struct client *client; |
| 70 | int x, y; |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 71 | |
Pekka Paalanen | 4ac06ff | 2015-03-26 12:56:10 +0200 | [diff] [blame^] | 72 | client = create_client_and_test_surface(46, 76, 111, 134); |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 73 | assert(client); |
| 74 | |
| 75 | /* move pointer outside top left */ |
| 76 | x = client->surface->x - 1; |
| 77 | y = client->surface->y - 1; |
| 78 | assert(!surface_contains(client->surface, x, y)); |
| 79 | check_pointer_move(client, x, y); |
| 80 | |
| 81 | /* move pointer on top left */ |
| 82 | x += 1; y += 1; |
| 83 | assert(surface_contains(client->surface, x, y)); |
| 84 | check_pointer_move(client, x, y); |
| 85 | |
| 86 | /* move pointer outside top left */ |
| 87 | x -= 1; y -= 1; |
| 88 | assert(!surface_contains(client->surface, x, y)); |
| 89 | check_pointer_move(client, x, y); |
| 90 | } |
| 91 | |
| 92 | TEST(test_pointer_bottom_left) |
| 93 | { |
| 94 | struct client *client; |
| 95 | int x, y; |
| 96 | |
Pekka Paalanen | 4ac06ff | 2015-03-26 12:56:10 +0200 | [diff] [blame^] | 97 | client = create_client_and_test_surface(99, 100, 100, 98); |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 98 | assert(client); |
| 99 | |
| 100 | /* move pointer outside bottom left */ |
| 101 | x = client->surface->x - 1; |
| 102 | y = client->surface->y + client->surface->height; |
| 103 | assert(!surface_contains(client->surface, x, y)); |
| 104 | check_pointer_move(client, x, y); |
| 105 | |
| 106 | /* move pointer on bottom left */ |
| 107 | x += 1; y -= 1; |
| 108 | assert(surface_contains(client->surface, x, y)); |
| 109 | check_pointer_move(client, x, y); |
| 110 | |
| 111 | /* move pointer outside bottom left */ |
| 112 | x -= 1; y += 1; |
| 113 | assert(!surface_contains(client->surface, x, y)); |
| 114 | check_pointer_move(client, x, y); |
| 115 | } |
| 116 | |
| 117 | TEST(test_pointer_top_right) |
| 118 | { |
| 119 | struct client *client; |
| 120 | int x, y; |
| 121 | |
Pekka Paalanen | 4ac06ff | 2015-03-26 12:56:10 +0200 | [diff] [blame^] | 122 | client = create_client_and_test_surface(48, 100, 67, 100); |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 123 | assert(client); |
| 124 | |
| 125 | /* move pointer outside top right */ |
| 126 | x = client->surface->x + client->surface->width; |
| 127 | y = client->surface->y - 1; |
| 128 | assert(!surface_contains(client->surface, x, y)); |
| 129 | check_pointer_move(client, x, y); |
| 130 | |
| 131 | /* move pointer on top right */ |
| 132 | x -= 1; y += 1; |
| 133 | assert(surface_contains(client->surface, x, y)); |
| 134 | check_pointer_move(client, x, y); |
| 135 | |
| 136 | /* move pointer outside top right */ |
| 137 | x += 1; y -= 1; |
| 138 | assert(!surface_contains(client->surface, x, y)); |
| 139 | check_pointer_move(client, x, y); |
| 140 | } |
| 141 | |
| 142 | TEST(test_pointer_bottom_right) |
| 143 | { |
| 144 | struct client *client; |
| 145 | int x, y; |
| 146 | |
Pekka Paalanen | 4ac06ff | 2015-03-26 12:56:10 +0200 | [diff] [blame^] | 147 | client = create_client_and_test_surface(100, 123, 100, 69); |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 148 | assert(client); |
| 149 | |
| 150 | /* move pointer outside bottom right */ |
| 151 | x = client->surface->x + client->surface->width; |
| 152 | y = client->surface->y + client->surface->height; |
| 153 | assert(!surface_contains(client->surface, x, y)); |
| 154 | check_pointer_move(client, x, y); |
| 155 | |
| 156 | /* move pointer on bottom right */ |
| 157 | x -= 1; y -= 1; |
| 158 | assert(surface_contains(client->surface, x, y)); |
| 159 | check_pointer_move(client, x, y); |
| 160 | |
| 161 | /* move pointer outside bottom right */ |
| 162 | x += 1; y += 1; |
| 163 | assert(!surface_contains(client->surface, x, y)); |
| 164 | check_pointer_move(client, x, y); |
| 165 | } |
| 166 | |
| 167 | TEST(test_pointer_top_center) |
| 168 | { |
| 169 | struct client *client; |
| 170 | int x, y; |
| 171 | |
Pekka Paalanen | 4ac06ff | 2015-03-26 12:56:10 +0200 | [diff] [blame^] | 172 | client = create_client_and_test_surface(100, 201, 100, 50); |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 173 | assert(client); |
| 174 | |
| 175 | /* move pointer outside top center */ |
| 176 | x = client->surface->x + client->surface->width/2; |
| 177 | y = client->surface->y - 1; |
| 178 | assert(!surface_contains(client->surface, x, y)); |
| 179 | check_pointer_move(client, x, y); |
| 180 | |
| 181 | /* move pointer on top center */ |
| 182 | y += 1; |
| 183 | assert(surface_contains(client->surface, x, y)); |
| 184 | check_pointer_move(client, x, y); |
| 185 | |
| 186 | /* move pointer outside top center */ |
| 187 | y -= 1; |
| 188 | assert(!surface_contains(client->surface, x, y)); |
| 189 | check_pointer_move(client, x, y); |
| 190 | } |
| 191 | |
| 192 | TEST(test_pointer_bottom_center) |
| 193 | { |
| 194 | struct client *client; |
| 195 | int x, y; |
| 196 | |
Pekka Paalanen | 4ac06ff | 2015-03-26 12:56:10 +0200 | [diff] [blame^] | 197 | client = create_client_and_test_surface(100, 45, 67, 100); |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 198 | assert(client); |
| 199 | |
| 200 | /* move pointer outside bottom center */ |
| 201 | x = client->surface->x + client->surface->width/2; |
| 202 | y = client->surface->y + client->surface->height; |
| 203 | assert(!surface_contains(client->surface, x, y)); |
| 204 | check_pointer_move(client, x, y); |
| 205 | |
| 206 | /* move pointer on bottom center */ |
| 207 | y -= 1; |
| 208 | assert(surface_contains(client->surface, x, y)); |
| 209 | check_pointer_move(client, x, y); |
| 210 | |
| 211 | /* move pointer outside bottom center */ |
| 212 | y += 1; |
| 213 | assert(!surface_contains(client->surface, x, y)); |
| 214 | check_pointer_move(client, x, y); |
| 215 | } |
| 216 | |
| 217 | TEST(test_pointer_left_center) |
| 218 | { |
| 219 | struct client *client; |
| 220 | int x, y; |
| 221 | |
Pekka Paalanen | 4ac06ff | 2015-03-26 12:56:10 +0200 | [diff] [blame^] | 222 | client = create_client_and_test_surface(167, 45, 78, 100); |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 223 | assert(client); |
| 224 | |
| 225 | /* move pointer outside left center */ |
| 226 | x = client->surface->x - 1; |
| 227 | y = client->surface->y + client->surface->height/2; |
| 228 | assert(!surface_contains(client->surface, x, y)); |
| 229 | check_pointer_move(client, x, y); |
| 230 | |
| 231 | /* move pointer on left center */ |
| 232 | x += 1; |
| 233 | assert(surface_contains(client->surface, x, y)); |
| 234 | check_pointer_move(client, x, y); |
| 235 | |
| 236 | /* move pointer outside left center */ |
| 237 | x -= 1; |
| 238 | assert(!surface_contains(client->surface, x, y)); |
| 239 | check_pointer_move(client, x, y); |
| 240 | } |
| 241 | |
| 242 | TEST(test_pointer_right_center) |
| 243 | { |
| 244 | struct client *client; |
| 245 | int x, y; |
| 246 | |
Pekka Paalanen | 4ac06ff | 2015-03-26 12:56:10 +0200 | [diff] [blame^] | 247 | client = create_client_and_test_surface(110, 37, 100, 46); |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 248 | assert(client); |
| 249 | |
| 250 | /* move pointer outside right center */ |
| 251 | x = client->surface->x + client->surface->width; |
| 252 | y = client->surface->y + client->surface->height/2; |
| 253 | assert(!surface_contains(client->surface, x, y)); |
| 254 | check_pointer_move(client, x, y); |
| 255 | |
| 256 | /* move pointer on right center */ |
| 257 | x -= 1; |
| 258 | assert(surface_contains(client->surface, x, y)); |
| 259 | check_pointer_move(client, x, y); |
| 260 | |
| 261 | /* move pointer outside right center */ |
| 262 | x += 1; |
| 263 | assert(!surface_contains(client->surface, x, y)); |
| 264 | check_pointer_move(client, x, y); |
| 265 | } |
| 266 | |
| 267 | TEST(test_pointer_surface_move) |
| 268 | { |
| 269 | struct client *client; |
| 270 | |
Pekka Paalanen | 4ac06ff | 2015-03-26 12:56:10 +0200 | [diff] [blame^] | 271 | client = create_client_and_test_surface(100, 100, 100, 100); |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 272 | assert(client); |
| 273 | |
| 274 | /* move pointer outside of client */ |
| 275 | assert(!surface_contains(client->surface, 50, 50)); |
| 276 | check_pointer_move(client, 50, 50); |
| 277 | |
| 278 | /* move client center to pointer */ |
| 279 | move_client(client, 0, 0); |
| 280 | assert(surface_contains(client->surface, 50, 50)); |
| 281 | check_pointer(client, 50, 50); |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 282 | } |
| 283 | |
| 284 | static int |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 285 | output_contains_client(struct client *client) |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 286 | { |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 287 | struct output *output = client->output; |
| 288 | struct surface *surface = client->surface; |
| 289 | |
| 290 | return !(output->x >= surface->x + surface->width |
| 291 | || output->x + output->width <= surface->x |
| 292 | || output->y >= surface->y + surface->height |
| 293 | || output->y + output->height <= surface->y); |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 294 | } |
| 295 | |
| 296 | static void |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 297 | check_client_move(struct client *client, int x, int y) |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 298 | { |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 299 | move_client(client, x, y); |
| 300 | |
| 301 | if (output_contains_client(client)) { |
| 302 | assert(client->surface->output == client->output); |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 303 | } else { |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 304 | assert(client->surface->output == NULL); |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 305 | } |
| 306 | } |
| 307 | |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 308 | TEST(test_surface_output) |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 309 | { |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 310 | struct client *client; |
| 311 | int x, y; |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 312 | |
Pekka Paalanen | 4ac06ff | 2015-03-26 12:56:10 +0200 | [diff] [blame^] | 313 | client = create_client_and_test_surface(100, 100, 100, 100); |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 314 | assert(client); |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 315 | |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 316 | assert(output_contains_client(client)); |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 317 | |
| 318 | /* not visible */ |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 319 | x = 0; |
| 320 | y = -client->surface->height; |
| 321 | check_client_move(client, x, y); |
| 322 | |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 323 | /* visible */ |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 324 | check_client_move(client, x, ++y); |
| 325 | |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 326 | /* not visible */ |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 327 | x = -client->surface->width; |
| 328 | y = 0; |
| 329 | check_client_move(client, x, y); |
| 330 | |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 331 | /* visible */ |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 332 | check_client_move(client, ++x, y); |
| 333 | |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 334 | /* not visible */ |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 335 | x = client->output->width; |
| 336 | y = 0; |
| 337 | check_client_move(client, x, y); |
| 338 | |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 339 | /* visible */ |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 340 | check_client_move(client, --x, y); |
| 341 | assert(output_contains_client(client)); |
| 342 | |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 343 | /* not visible */ |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 344 | x = 0; |
| 345 | y = client->output->height; |
| 346 | check_client_move(client, x, y); |
| 347 | assert(!output_contains_client(client)); |
| 348 | |
U. Artie Eoff | 1ae298f | 2012-09-28 06:39:30 -0700 | [diff] [blame] | 349 | /* visible */ |
U. Artie Eoff | 84f9db5 | 2012-12-07 13:50:33 -0800 | [diff] [blame] | 350 | check_client_move(client, x, --y); |
| 351 | assert(output_contains_client(client)); |
Kristian Høgsberg | 3018b44 | 2012-04-27 15:02:56 -0400 | [diff] [blame] | 352 | } |
Pekka Paalanen | d1c426e | 2013-02-08 17:01:27 +0200 | [diff] [blame] | 353 | |
| 354 | static void |
| 355 | buffer_release_handler(void *data, struct wl_buffer *buffer) |
| 356 | { |
| 357 | int *released = data; |
| 358 | |
| 359 | *released = 1; |
| 360 | } |
| 361 | |
| 362 | static struct wl_buffer_listener buffer_listener = { |
| 363 | buffer_release_handler |
| 364 | }; |
| 365 | |
| 366 | TEST(buffer_release) |
| 367 | { |
| 368 | struct client *client; |
| 369 | struct wl_surface *surface; |
| 370 | struct wl_buffer *buf1; |
| 371 | struct wl_buffer *buf2; |
| 372 | struct wl_buffer *buf3; |
| 373 | int buf1_released = 0; |
| 374 | int buf2_released = 0; |
| 375 | int buf3_released = 0; |
| 376 | int frame; |
| 377 | |
Pekka Paalanen | 4ac06ff | 2015-03-26 12:56:10 +0200 | [diff] [blame^] | 378 | client = create_client_and_test_surface(100, 100, 100, 100); |
Pekka Paalanen | d1c426e | 2013-02-08 17:01:27 +0200 | [diff] [blame] | 379 | assert(client); |
| 380 | surface = client->surface->wl_surface; |
| 381 | |
| 382 | buf1 = create_shm_buffer(client, 100, 100, NULL); |
| 383 | wl_buffer_add_listener(buf1, &buffer_listener, &buf1_released); |
| 384 | |
| 385 | buf2 = create_shm_buffer(client, 100, 100, NULL); |
| 386 | wl_buffer_add_listener(buf2, &buffer_listener, &buf2_released); |
| 387 | |
| 388 | buf3 = create_shm_buffer(client, 100, 100, NULL); |
| 389 | wl_buffer_add_listener(buf3, &buffer_listener, &buf3_released); |
| 390 | |
| 391 | /* |
| 392 | * buf1 must never be released, since it is replaced before |
| 393 | * it is committed, therefore it never becomes busy. |
| 394 | */ |
| 395 | |
| 396 | wl_surface_attach(surface, buf1, 0, 0); |
| 397 | wl_surface_attach(surface, buf2, 0, 0); |
| 398 | frame_callback_set(surface, &frame); |
| 399 | wl_surface_commit(surface); |
| 400 | frame_callback_wait(client, &frame); |
| 401 | assert(buf1_released == 0); |
| 402 | /* buf2 may or may not be released */ |
| 403 | assert(buf3_released == 0); |
| 404 | |
| 405 | wl_surface_attach(surface, buf3, 0, 0); |
| 406 | frame_callback_set(surface, &frame); |
| 407 | wl_surface_commit(surface); |
| 408 | frame_callback_wait(client, &frame); |
| 409 | assert(buf1_released == 0); |
| 410 | assert(buf2_released == 1); |
| 411 | /* buf3 may or may not be released */ |
| 412 | |
| 413 | wl_surface_attach(surface, client->surface->wl_buffer, 0, 0); |
| 414 | frame_callback_set(surface, &frame); |
| 415 | wl_surface_commit(surface); |
| 416 | frame_callback_wait(client, &frame); |
| 417 | assert(buf1_released == 0); |
| 418 | assert(buf2_released == 1); |
| 419 | assert(buf3_released == 1); |
| 420 | } |