blob: 2dfe486a16cb5865162062b1437b0409b81625a5 [file] [log] [blame]
Pekka Paalanen46804ca2015-03-27 11:55:21 +02001/*
2 * Copyright © 2013 DENSO CORPORATION
3 * Copyright © 2015 Collabora, Ltd.
4 *
Bryce Harrington2cc92972015-06-11 15:39:40 -07005 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
Pekka Paalanen46804ca2015-03-27 11:55:21 +020012 *
Bryce Harrington2cc92972015-06-11 15:39:40 -070013 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
21 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
22 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 * SOFTWARE.
Pekka Paalanen46804ca2015-03-27 11:55:21 +020025 */
26
27#include "config.h"
28
29#include <unistd.h>
30#include <signal.h>
31#include <string.h>
32#include <stdbool.h>
33
Jon Cruz4678bab2015-06-15 15:37:07 -070034#include "src/compositor.h"
35#include "ivi-shell/ivi-layout-export.h"
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +090036#include "ivi-shell/ivi-layout-private.h"
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +090037#include "ivi-test.h"
Pekka Paalanen46804ca2015-03-27 11:55:21 +020038
39struct test_context {
40 struct weston_compositor *compositor;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000041 const struct ivi_layout_interface *layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +090042 uint32_t user_flags;
Pekka Paalanen46804ca2015-03-27 11:55:21 +020043};
44
45static void
46iassert_fail(const char *cond, const char *file, int line,
47 const char *func, struct test_context *ctx)
48{
49 weston_log("Assert failure in %s:%d, %s: '%s'\n",
50 file, line, func, cond);
51 weston_compositor_exit_with_code(ctx->compositor, EXIT_FAILURE);
52}
53
54#define iassert(cond) ({ \
55 bool b_ = (cond); \
56 if (!b_) \
57 iassert_fail(#cond, __FILE__, __LINE__, __func__, ctx); \
58 b_; \
59})
60
61/************************ tests begin ******************************/
62
63/*
64 * These are all internal ivi_layout API tests that do not require
65 * any client objects.
66 */
Pekka Paalanen46804ca2015-03-27 11:55:21 +020067static void
68test_surface_bad_visibility(struct test_context *ctx)
69{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000070 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Pekka Paalanen46804ca2015-03-27 11:55:21 +020071
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000072 iassert(lyt->surface_set_visibility(NULL, true) == IVI_FAILED);
Pekka Paalanen46804ca2015-03-27 11:55:21 +020073
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000074 lyt->commit_changes();
Pekka Paalanen46804ca2015-03-27 11:55:21 +020075}
76
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090077static void
78test_surface_bad_destination_rectangle(struct test_context *ctx)
79{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000080 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090081
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000082 iassert(lyt->surface_set_destination_rectangle(NULL, 20, 30, 200, 300) == IVI_FAILED);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090083}
84
85static void
86test_surface_bad_orientation(struct test_context *ctx)
87{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000088 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090089
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000090 iassert(lyt->surface_set_orientation(NULL, WL_OUTPUT_TRANSFORM_90) == IVI_FAILED);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090091}
92
93static void
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090094test_surface_bad_source_rectangle(struct test_context *ctx)
95{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000096 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090097
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000098 iassert(lyt->surface_set_source_rectangle(NULL, 20, 30, 200, 300) == IVI_FAILED);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090099}
100
101static void
102test_surface_bad_properties(struct test_context *ctx)
103{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000104 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900105
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000106 iassert(lyt->get_properties_of_surface(NULL) == NULL);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900107}
108
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900109static void
110test_layer_create(struct test_context *ctx)
111{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000112 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900113 uint32_t id1;
114 uint32_t id2;
115 struct ivi_layout_layer *ivilayer;
116 struct ivi_layout_layer *new_ivilayer;
117
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000118 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900119 iassert(ivilayer != NULL);
120
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000121 iassert(IVI_TEST_LAYER_ID(0) == lyt->get_id_of_layer(ivilayer));
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900122
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000123 new_ivilayer = lyt->get_layer_from_id(IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900124 iassert(ivilayer == new_ivilayer);
125
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000126 id1 = lyt->get_id_of_layer(ivilayer);
127 id2 = lyt->get_id_of_layer(new_ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900128 iassert(id1 == id2);
129
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000130 lyt->layer_destroy(ivilayer);
131 iassert(lyt->get_layer_from_id(IVI_TEST_LAYER_ID(0)) == NULL);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900132}
133
134static void
135test_layer_visibility(struct test_context *ctx)
136{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000137 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900138 struct ivi_layout_layer *ivilayer;
139 const struct ivi_layout_layer_properties *prop;
140
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000141 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900142 iassert(ivilayer != NULL);
143
Ucan, Emre \(ADITG/SW1\)17610f22016-03-04 12:50:07 +0000144 prop = lyt->get_properties_of_layer(ivilayer);
145
146 iassert(prop->visibility == false);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900147
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000148 iassert(lyt->layer_set_visibility(ivilayer, true) == IVI_SUCCEEDED);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900149
Ucan, Emre \(ADITG/SW1\)17610f22016-03-04 12:50:07 +0000150 iassert(prop->visibility == false);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900151
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000152 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900153
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900154 iassert(prop->visibility == true);
155
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000156 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900157}
158
159static void
160test_layer_opacity(struct test_context *ctx)
161{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000162 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900163 struct ivi_layout_layer *ivilayer;
164 const struct ivi_layout_layer_properties *prop;
165
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000166 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900167 iassert(ivilayer != NULL);
168
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000169 prop = lyt->get_properties_of_layer(ivilayer);
170 iassert(prop->opacity == wl_fixed_from_double(1.0));
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900171
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000172 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900173 ivilayer, wl_fixed_from_double(0.5)) == IVI_SUCCEEDED);
174
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000175 iassert(prop->opacity == wl_fixed_from_double(1.0));
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900176
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000177 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900178
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900179 iassert(prop->opacity == wl_fixed_from_double(0.5));
180
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000181 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900182}
183
184static void
185test_layer_orientation(struct test_context *ctx)
186{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000187 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900188 struct ivi_layout_layer *ivilayer;
189 const struct ivi_layout_layer_properties *prop;
190
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000191 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900192 iassert(ivilayer != NULL);
193
Ucan, Emre \(ADITG/SW1\)5bb068d2016-03-04 12:50:39 +0000194 prop = lyt->get_properties_of_layer(ivilayer);
195 iassert(prop->orientation == WL_OUTPUT_TRANSFORM_NORMAL);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900196
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000197 iassert(lyt->layer_set_orientation(
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900198 ivilayer, WL_OUTPUT_TRANSFORM_90) == IVI_SUCCEEDED);
199
Ucan, Emre \(ADITG/SW1\)5bb068d2016-03-04 12:50:39 +0000200 iassert(prop->orientation == WL_OUTPUT_TRANSFORM_NORMAL);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900201
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000202 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900203
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900204 iassert(prop->orientation == WL_OUTPUT_TRANSFORM_90);
205
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000206 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900207}
208
209static void
210test_layer_dimension(struct test_context *ctx)
211{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000212 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900213 struct ivi_layout_layer *ivilayer;
214 const struct ivi_layout_layer_properties *prop;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900215
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000216 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900217 iassert(ivilayer != NULL);
218
Ucan, Emre \(ADITG/SW1\)18691f02016-03-04 12:50:32 +0000219 prop = lyt->get_properties_of_layer(ivilayer);
220 iassert(prop->dest_width == 200);
221 iassert(prop->dest_height == 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900222
Ucan, Emre \(ADITG/SW1\)16d1fa12016-03-04 12:50:52 +0000223 iassert(lyt->layer_set_destination_rectangle(ivilayer, prop->dest_x, prop->dest_y,
224 400, 600) == IVI_SUCCEEDED);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900225
Ucan, Emre \(ADITG/SW1\)18691f02016-03-04 12:50:32 +0000226 iassert(prop->dest_width == 200);
227 iassert(prop->dest_height == 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900228
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000229 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900230
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900231 iassert(prop->dest_width == 400);
232 iassert(prop->dest_height == 600);
233
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000234 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900235}
236
237static void
238test_layer_position(struct test_context *ctx)
239{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000240 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900241 struct ivi_layout_layer *ivilayer;
242 const struct ivi_layout_layer_properties *prop;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900243
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000244 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900245 iassert(ivilayer != NULL);
246
Ucan, Emre \(ADITG/SW1\)dfc2d762016-03-04 12:50:24 +0000247 prop = lyt->get_properties_of_layer(ivilayer);
248 iassert(prop->dest_x == 0);
249 iassert(prop->dest_y == 0);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900250
Ucan, Emre \(ADITG/SW1\)e62bfd82016-03-04 12:50:46 +0000251 iassert(lyt->layer_set_destination_rectangle(ivilayer, 20, 30,
252 prop->dest_width, prop->dest_height) == IVI_SUCCEEDED);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900253
Ucan, Emre \(ADITG/SW1\)dfc2d762016-03-04 12:50:24 +0000254 iassert(prop->dest_x == 0);
255 iassert(prop->dest_y == 0);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900256
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000257 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900258
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000259 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900260 iassert(prop->dest_x == 20);
261 iassert(prop->dest_y == 30);
262
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000263 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900264}
265
266static void
267test_layer_destination_rectangle(struct test_context *ctx)
268{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000269 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900270 struct ivi_layout_layer *ivilayer;
271 const struct ivi_layout_layer_properties *prop;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900272
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000273 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900274 iassert(ivilayer != NULL);
275
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000276 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900277 iassert(prop->dest_width == 200);
278 iassert(prop->dest_height == 300);
279 iassert(prop->dest_x == 0);
280 iassert(prop->dest_y == 0);
281
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000282 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900283 ivilayer, 20, 30, 400, 600) == IVI_SUCCEEDED);
284
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000285 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900286 iassert(prop->dest_width == 200);
287 iassert(prop->dest_height == 300);
288 iassert(prop->dest_x == 0);
289 iassert(prop->dest_y == 0);
290
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000291 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900292
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900293 iassert(prop->dest_width == 400);
294 iassert(prop->dest_height == 600);
295 iassert(prop->dest_x == 20);
296 iassert(prop->dest_y == 30);
297
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000298 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900299}
300
301static void
302test_layer_source_rectangle(struct test_context *ctx)
303{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000304 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900305 struct ivi_layout_layer *ivilayer;
306 const struct ivi_layout_layer_properties *prop;
307
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000308 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900309 iassert(ivilayer != NULL);
310
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000311 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900312 iassert(prop->source_width == 200);
313 iassert(prop->source_height == 300);
314 iassert(prop->source_x == 0);
315 iassert(prop->source_y == 0);
316
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000317 iassert(lyt->layer_set_source_rectangle(
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900318 ivilayer, 20, 30, 400, 600) == IVI_SUCCEEDED);
319
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000320 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900321 iassert(prop->source_width == 200);
322 iassert(prop->source_height == 300);
323 iassert(prop->source_x == 0);
324 iassert(prop->source_y == 0);
325
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000326 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900327
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000328 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900329 iassert(prop->source_width == 400);
330 iassert(prop->source_height == 600);
331 iassert(prop->source_x == 20);
332 iassert(prop->source_y == 30);
333
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000334 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900335}
336
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900337static void
338test_layer_bad_remove(struct test_context *ctx)
339{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000340 const struct ivi_layout_interface *lyt = ctx->layout_interface;
341 lyt->layer_destroy(NULL);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900342}
343
344static void
345test_layer_bad_visibility(struct test_context *ctx)
346{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000347 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900348
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000349 iassert(lyt->layer_set_visibility(NULL, true) == IVI_FAILED);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900350
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000351 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900352}
353
354static void
355test_layer_bad_opacity(struct test_context *ctx)
356{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000357 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900358 struct ivi_layout_layer *ivilayer;
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000359 const struct ivi_layout_layer_properties *prop;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900360
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000361 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900362 iassert(ivilayer != NULL);
363
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000364 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900365 NULL, wl_fixed_from_double(0.3)) == IVI_FAILED);
366
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000367 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900368 ivilayer, wl_fixed_from_double(0.3)) == IVI_SUCCEEDED);
369
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000370 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900371 ivilayer, wl_fixed_from_double(-1)) == IVI_FAILED);
372
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000373 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900374
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000375 prop = lyt->get_properties_of_layer(ivilayer);
376 iassert(prop->opacity == wl_fixed_from_double(0.3));
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900377
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000378 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900379 ivilayer, wl_fixed_from_double(1.1)) == IVI_FAILED);
380
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000381 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900382
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000383 iassert(prop->opacity == wl_fixed_from_double(0.3));
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900384
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000385 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900386 NULL, wl_fixed_from_double(0.5)) == IVI_FAILED);
387
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000388 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900389
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000390 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900391}
392
393static void
394test_layer_bad_destination_rectangle(struct test_context *ctx)
395{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000396 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900397
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000398 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900399 NULL, 20, 30, 200, 300) == IVI_FAILED);
400}
401
402static void
403test_layer_bad_orientation(struct test_context *ctx)
404{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000405 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900406
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000407 iassert(lyt->layer_set_orientation(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900408 NULL, WL_OUTPUT_TRANSFORM_90) == IVI_FAILED);
409
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000410 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900411}
412
413static void
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900414test_layer_bad_source_rectangle(struct test_context *ctx)
415{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000416 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900417
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000418 iassert(lyt->layer_set_source_rectangle(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900419 NULL, 20, 30, 200, 300) == IVI_FAILED);
420}
421
422static void
423test_layer_bad_properties(struct test_context *ctx)
424{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000425 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900426
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000427 iassert(lyt->get_properties_of_layer(NULL) == NULL);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900428}
429
430static void
431test_commit_changes_after_visibility_set_layer_destroy(struct test_context *ctx)
432{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000433 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900434 struct ivi_layout_layer *ivilayer;
435
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000436 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900437 iassert(ivilayer != NULL);
438
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000439 iassert(lyt->layer_set_visibility(ivilayer, true) == IVI_SUCCEEDED);
440 lyt->layer_destroy(ivilayer);
441 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900442}
443
444static void
445test_commit_changes_after_opacity_set_layer_destroy(struct test_context *ctx)
446{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000447 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900448 struct ivi_layout_layer *ivilayer;
449
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000450 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900451 iassert(ivilayer != NULL);
452
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000453 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900454 ivilayer, wl_fixed_from_double(0.5)) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000455 lyt->layer_destroy(ivilayer);
456 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900457}
458
459static void
460test_commit_changes_after_orientation_set_layer_destroy(struct test_context *ctx)
461{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000462 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900463 struct ivi_layout_layer *ivilayer;
464
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000465 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900466 iassert(ivilayer != NULL);
467
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000468 iassert(lyt->layer_set_orientation(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900469 ivilayer, WL_OUTPUT_TRANSFORM_90) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000470 lyt->layer_destroy(ivilayer);
471 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900472}
473
474static void
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900475test_commit_changes_after_source_rectangle_set_layer_destroy(struct test_context *ctx)
476{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000477 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900478 struct ivi_layout_layer *ivilayer;
479
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000480 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900481 iassert(ivilayer != NULL);
482
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000483 iassert(lyt->layer_set_source_rectangle(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900484 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000485 lyt->layer_destroy(ivilayer);
486 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900487}
488
489static void
490test_commit_changes_after_destination_rectangle_set_layer_destroy(struct test_context *ctx)
491{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000492 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900493 struct ivi_layout_layer *ivilayer;
494
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000495 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900496 iassert(ivilayer != NULL);
497
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000498 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900499 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000500 lyt->layer_destroy(ivilayer);
501 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900502}
503
504static void
505test_layer_create_duplicate(struct test_context *ctx)
506{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000507 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900508 struct ivi_layout_layer *ivilayer;
509 struct ivi_layout_layer *duplicatelayer;
510
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000511 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900512 iassert(ivilayer != NULL);
513
514 if (ivilayer != NULL)
515 iassert(ivilayer->ref_count == 1);
516
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000517 duplicatelayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900518 iassert(ivilayer == duplicatelayer);
519
520 if (ivilayer != NULL)
521 iassert(ivilayer->ref_count == 2);
522
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000523 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900524
525 if (ivilayer != NULL)
526 iassert(ivilayer->ref_count == 1);
527
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000528 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900529}
530
531static void
532test_get_layer_after_destory_layer(struct test_context *ctx)
533{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000534 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900535 struct ivi_layout_layer *ivilayer;
536
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000537 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900538 iassert(ivilayer != NULL);
539
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000540 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900541
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000542 ivilayer = lyt->get_layer_from_id(IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900543 iassert(ivilayer == NULL);
544}
545
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900546static void
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900547test_screen_render_order(struct test_context *ctx)
548{
549#define LAYER_NUM (3)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000550 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900551 struct ivi_layout_screen *iviscrn;
552 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
553 struct ivi_layout_layer **array;
554 int32_t length = 0;
555 uint32_t i;
556
Ucan, Emre (ADITG/SW1)3a8521e2016-03-17 15:30:39 +0000557 if (wl_list_empty(&ctx->compositor->output_list))
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900558 return;
559
Ucan, Emre (ADITG/SW1)3a8521e2016-03-17 15:30:39 +0000560 iviscrn = lyt->get_screen_from_id(0);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900561
562 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000563 ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900564
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000565 iassert(lyt->screen_set_render_order(iviscrn, ivilayers, LAYER_NUM) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900566
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000567 lyt->commit_changes();
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900568
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000569 iassert(lyt->get_layers_on_screen(iviscrn, &length, &array) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900570 iassert(length == LAYER_NUM);
571 for (i = 0; i < LAYER_NUM; i++)
572 iassert(array[i] == ivilayers[i]);
573
574 if (length > 0)
575 free(array);
576
577 array = NULL;
578
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000579 iassert(lyt->screen_set_render_order(iviscrn, NULL, 0) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900580
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000581 lyt->commit_changes();
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900582
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000583 iassert(lyt->get_layers_on_screen(iviscrn, &length, &array) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900584 iassert(length == 0 && array == NULL);
585
586 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000587 lyt->layer_destroy(ivilayers[i]);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900588
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900589#undef LAYER_NUM
590}
591
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900592static void
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900593test_screen_bad_render_order(struct test_context *ctx)
594{
595#define LAYER_NUM (3)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000596 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900597 struct ivi_layout_screen *iviscrn;
598 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
599 struct ivi_layout_layer **array;
600 int32_t length = 0;
601 uint32_t i;
602
Ucan, Emre (ADITG/SW1)3a8521e2016-03-17 15:30:39 +0000603 if (wl_list_empty(&ctx->compositor->output_list))
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900604 return;
605
Ucan, Emre (ADITG/SW1)3a8521e2016-03-17 15:30:39 +0000606 iviscrn = lyt->get_screen_from_id(0);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900607
608 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000609 ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900610
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000611 iassert(lyt->screen_set_render_order(NULL, ivilayers, LAYER_NUM) == IVI_FAILED);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900612
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000613 lyt->commit_changes();
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900614
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000615 iassert(lyt->get_layers_on_screen(NULL, &length, &array) == IVI_FAILED);
616 iassert(lyt->get_layers_on_screen(iviscrn, NULL, &array) == IVI_FAILED);
617 iassert(lyt->get_layers_on_screen(iviscrn, &length, NULL) == IVI_FAILED);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900618
619 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000620 lyt->layer_destroy(ivilayers[i]);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900621
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900622#undef LAYER_NUM
623}
624
625static void
626test_commit_changes_after_render_order_set_layer_destroy(
627 struct test_context *ctx)
628{
629#define LAYER_NUM (3)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000630 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900631 struct ivi_layout_screen *iviscrn;
632 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
633 uint32_t i;
634
Ucan, Emre (ADITG/SW1)3a8521e2016-03-17 15:30:39 +0000635 if (wl_list_empty(&ctx->compositor->output_list))
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900636 return;
637
Ucan, Emre (ADITG/SW1)3a8521e2016-03-17 15:30:39 +0000638 iviscrn = lyt->get_screen_from_id(0);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900639
640 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000641 ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900642
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000643 iassert(lyt->screen_set_render_order(iviscrn, ivilayers, LAYER_NUM) == IVI_SUCCEEDED);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900644
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000645 lyt->layer_destroy(ivilayers[1]);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900646
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000647 lyt->commit_changes();
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900648
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000649 lyt->layer_destroy(ivilayers[0]);
650 lyt->layer_destroy(ivilayers[2]);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900651#undef LAYER_NUM
652}
653
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900654static void
655test_layer_properties_changed_notification_callback(struct ivi_layout_layer *ivilayer,
656 const struct ivi_layout_layer_properties *prop,
657 enum ivi_layout_notification_mask mask,
658 void *userdata)
659{
660 struct test_context *ctx = userdata;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000661 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900662
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000663 iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900664 iassert(prop->source_width == 200);
665 iassert(prop->source_height == 300);
666
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000667 if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900668 prop->source_width == 200 && prop->source_height == 300)
669 ctx->user_flags = 1;
670}
671
672static void
673test_layer_properties_changed_notification(struct test_context *ctx)
674{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000675 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900676 struct ivi_layout_layer *ivilayer;
677
678 ctx->user_flags = 0;
679
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000680 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900681
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000682 iassert(lyt->layer_add_notification(ivilayer, test_layer_properties_changed_notification_callback, ctx) == IVI_SUCCEEDED);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900683
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000684 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900685
686 iassert(ctx->user_flags == 0);
687
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000688 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900689 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
690
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000691 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900692
693 iassert(ctx->user_flags == 1);
694
695 ctx->user_flags = 0;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000696 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900697 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
698
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000699 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900700
701 iassert(ctx->user_flags == 0);
702
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000703 lyt->layer_remove_notification(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900704
705 ctx->user_flags = 0;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000706 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900707
708 iassert(ctx->user_flags == 0);
709
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000710 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900711}
712
713static void
714test_layer_create_notification_callback(struct ivi_layout_layer *ivilayer,
715 void *userdata)
716{
717 struct test_context *ctx = userdata;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000718 const struct ivi_layout_interface *lyt = ctx->layout_interface;
719 const struct ivi_layout_layer_properties *prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900720
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000721 iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900722 iassert(prop->source_width == 200);
723 iassert(prop->source_height == 300);
724
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000725 if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900726 prop->source_width == 200 && prop->source_height == 300)
727 ctx->user_flags = 1;
728}
729
730static void
731test_layer_create_notification(struct test_context *ctx)
732{
733#define LAYER_NUM (2)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000734 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900735 static const uint32_t layers[LAYER_NUM] = {IVI_TEST_LAYER_ID(0), IVI_TEST_LAYER_ID(1)};
736 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
737
738 ctx->user_flags = 0;
739
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000740 iassert(lyt->add_notification_create_layer(
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900741 test_layer_create_notification_callback, ctx) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000742 ivilayers[0] = lyt->layer_create_with_dimension(layers[0], 200, 300);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900743
744 iassert(ctx->user_flags == 1);
745
746 ctx->user_flags = 0;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000747 lyt->remove_notification_create_layer(test_layer_create_notification_callback, ctx);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900748
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000749 ivilayers[1] = lyt->layer_create_with_dimension(layers[1], 400, 500);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900750
751 iassert(ctx->user_flags == 0);
752
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000753 lyt->layer_destroy(ivilayers[0]);
754 lyt->layer_destroy(ivilayers[1]);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900755#undef LAYER_NUM
756}
757
758static void
759test_layer_remove_notification_callback(struct ivi_layout_layer *ivilayer,
760 void *userdata)
761{
762 struct test_context *ctx = userdata;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000763 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900764 const struct ivi_layout_layer_properties *prop =
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000765 lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900766
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000767 iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900768 iassert(prop->source_width == 200);
769 iassert(prop->source_height == 300);
770
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000771 if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900772 prop->source_width == 200 && prop->source_height == 300)
773 ctx->user_flags = 1;
774}
775
776static void
777test_layer_remove_notification(struct test_context *ctx)
778{
779#define LAYER_NUM (2)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000780 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900781 static const uint32_t layers[LAYER_NUM] = {IVI_TEST_LAYER_ID(0), IVI_TEST_LAYER_ID(1)};
782 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
783
784 ctx->user_flags = 0;
785
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000786 ivilayers[0] = lyt->layer_create_with_dimension(layers[0], 200, 300);
787 iassert(lyt->add_notification_remove_layer(
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900788 test_layer_remove_notification_callback, ctx) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000789 lyt->layer_destroy(ivilayers[0]);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900790
791 iassert(ctx->user_flags == 1);
792
793 ctx->user_flags = 0;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000794 ivilayers[1] = lyt->layer_create_with_dimension(layers[1], 250, 350);
795 lyt->remove_notification_remove_layer(test_layer_remove_notification_callback, ctx);
796 lyt->layer_destroy(ivilayers[1]);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900797
798 iassert(ctx->user_flags == 0);
799#undef LAYER_NUM
800}
801
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900802static void
803test_layer_bad_properties_changed_notification_callback(struct ivi_layout_layer *ivilayer,
804 const struct ivi_layout_layer_properties *prop,
805 enum ivi_layout_notification_mask mask,
806 void *userdata)
807{
808}
809
810static void
811test_layer_bad_properties_changed_notification(struct test_context *ctx)
812{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000813 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900814 struct ivi_layout_layer *ivilayer;
815
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000816 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900817
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000818 iassert(lyt->layer_add_notification(
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900819 NULL, test_layer_bad_properties_changed_notification_callback, NULL) == IVI_FAILED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000820 iassert(lyt->layer_add_notification(ivilayer, NULL, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900821
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000822 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900823}
824
825static void
826test_surface_bad_configure_notification(struct test_context *ctx)
827{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000828 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900829
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000830 iassert(lyt->add_notification_configure_surface(NULL, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900831}
832
833static void
834test_layer_bad_create_notification(struct test_context *ctx)
835{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000836 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900837
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000838 iassert(lyt->add_notification_create_layer(NULL, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900839}
840
841static void
842test_surface_bad_create_notification(struct test_context *ctx)
843{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000844 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900845
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000846 iassert(lyt->add_notification_create_surface(NULL, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900847}
848
849static void
850test_layer_bad_remove_notification(struct test_context *ctx)
851{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000852 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900853
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000854 iassert(lyt->add_notification_remove_layer(NULL, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900855}
856
857static void
858test_surface_bad_remove_notification(struct test_context *ctx)
859{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000860 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900861
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000862 iassert(lyt->add_notification_remove_surface(NULL, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900863}
864
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200865/************************ tests end ********************************/
866
867static void
868run_internal_tests(void *data)
869{
870 struct test_context *ctx = data;
871
872 test_surface_bad_visibility(ctx);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900873 test_surface_bad_destination_rectangle(ctx);
874 test_surface_bad_orientation(ctx);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900875 test_surface_bad_source_rectangle(ctx);
876 test_surface_bad_properties(ctx);
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200877
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900878 test_layer_create(ctx);
879 test_layer_visibility(ctx);
880 test_layer_opacity(ctx);
881 test_layer_orientation(ctx);
882 test_layer_dimension(ctx);
883 test_layer_position(ctx);
884 test_layer_destination_rectangle(ctx);
885 test_layer_source_rectangle(ctx);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900886 test_layer_bad_remove(ctx);
887 test_layer_bad_visibility(ctx);
888 test_layer_bad_opacity(ctx);
889 test_layer_bad_destination_rectangle(ctx);
890 test_layer_bad_orientation(ctx);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900891 test_layer_bad_source_rectangle(ctx);
892 test_layer_bad_properties(ctx);
893 test_commit_changes_after_visibility_set_layer_destroy(ctx);
894 test_commit_changes_after_opacity_set_layer_destroy(ctx);
895 test_commit_changes_after_orientation_set_layer_destroy(ctx);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900896 test_commit_changes_after_source_rectangle_set_layer_destroy(ctx);
897 test_commit_changes_after_destination_rectangle_set_layer_destroy(ctx);
898 test_layer_create_duplicate(ctx);
899 test_get_layer_after_destory_layer(ctx);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900900
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900901 test_screen_render_order(ctx);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900902 test_screen_bad_render_order(ctx);
903 test_commit_changes_after_render_order_set_layer_destroy(ctx);
904
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900905 test_layer_properties_changed_notification(ctx);
906 test_layer_create_notification(ctx);
907 test_layer_remove_notification(ctx);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900908 test_layer_bad_properties_changed_notification(ctx);
909 test_surface_bad_configure_notification(ctx);
910 test_layer_bad_create_notification(ctx);
911 test_surface_bad_create_notification(ctx);
912 test_layer_bad_remove_notification(ctx);
913 test_surface_bad_remove_notification(ctx);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900914
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200915 weston_compositor_exit_with_code(ctx->compositor, EXIT_SUCCESS);
916 free(ctx);
917}
918
919int
920controller_module_init(struct weston_compositor *compositor,
921 int *argc, char *argv[],
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000922 const struct ivi_layout_interface *iface,
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200923 size_t iface_version);
924
925WL_EXPORT int
926controller_module_init(struct weston_compositor *compositor,
927 int *argc, char *argv[],
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000928 const struct ivi_layout_interface *iface,
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200929 size_t iface_version)
930{
931 struct wl_event_loop *loop;
932 struct test_context *ctx;
933
934 /* strict check, since this is an internal test module */
935 if (iface_version != sizeof(*iface)) {
936 weston_log("fatal: controller interface mismatch\n");
937 return -1;
938 }
939
940 ctx = zalloc(sizeof(*ctx));
941 if (!ctx)
942 return -1;
943
944 ctx->compositor = compositor;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000945 ctx->layout_interface = iface;
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200946
947 loop = wl_display_get_event_loop(compositor->wl_display);
948 wl_event_loop_add_idle(loop, run_internal_tests, ctx);
949
950 return 0;
951}