blob: 6b7ca20d0a97d7277165516b202b114c1c51f633 [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
547test_screen_id(struct test_context *ctx)
548{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000549 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900550 struct ivi_layout_screen **iviscrns;
Ucan, Emre (ADITG/SW1)d56b90d2016-03-17 15:30:32 +0000551 struct weston_output *output;
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900552 int32_t screen_length = 0;
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900553 int32_t i;
554
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000555 iassert(lyt->get_screens(&screen_length, &iviscrns) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900556 iassert(screen_length > 0);
557
558 for (i = 0; i < screen_length; ++i) {
Ucan, Emre (ADITG/SW1)d56b90d2016-03-17 15:30:32 +0000559 output = lyt->screen_get_output(iviscrns[i]);
560 iassert(lyt->get_screen_from_id(output->id) == iviscrns[i]);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900561 }
562
563 if (screen_length > 0)
564 free(iviscrns);
565}
566
567static void
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900568test_screen_render_order(struct test_context *ctx)
569{
570#define LAYER_NUM (3)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000571 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900572 struct ivi_layout_screen **iviscrns;
573 int32_t screen_length = 0;
574 struct ivi_layout_screen *iviscrn;
575 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
576 struct ivi_layout_layer **array;
577 int32_t length = 0;
578 uint32_t i;
579
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000580 iassert(lyt->get_screens(&screen_length, &iviscrns) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900581 iassert(screen_length > 0);
582
583 if (screen_length <= 0)
584 return;
585
586 iviscrn = iviscrns[0];
587
588 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000589 ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900590
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000591 iassert(lyt->screen_set_render_order(iviscrn, ivilayers, LAYER_NUM) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900592
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000593 lyt->commit_changes();
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900594
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000595 iassert(lyt->get_layers_on_screen(iviscrn, &length, &array) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900596 iassert(length == LAYER_NUM);
597 for (i = 0; i < LAYER_NUM; i++)
598 iassert(array[i] == ivilayers[i]);
599
600 if (length > 0)
601 free(array);
602
603 array = NULL;
604
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000605 iassert(lyt->screen_set_render_order(iviscrn, NULL, 0) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900606
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000607 lyt->commit_changes();
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900608
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000609 iassert(lyt->get_layers_on_screen(iviscrn, &length, &array) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900610 iassert(length == 0 && array == NULL);
611
612 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000613 lyt->layer_destroy(ivilayers[i]);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900614
615 free(iviscrns);
616#undef LAYER_NUM
617}
618
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900619static void
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900620test_screen_bad_render_order(struct test_context *ctx)
621{
622#define LAYER_NUM (3)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000623 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900624 struct ivi_layout_screen **iviscrns;
625 int32_t screen_length;
626 struct ivi_layout_screen *iviscrn;
627 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
628 struct ivi_layout_layer **array;
629 int32_t length = 0;
630 uint32_t i;
631
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000632 iassert(lyt->get_screens(&screen_length, &iviscrns) == IVI_SUCCEEDED);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900633 iassert(screen_length > 0);
634
635 if (screen_length <= 0)
636 return;
637
638 iviscrn = iviscrns[0];
639
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(NULL, ivilayers, LAYER_NUM) == IVI_FAILED);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900644
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000645 lyt->commit_changes();
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900646
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000647 iassert(lyt->get_layers_on_screen(NULL, &length, &array) == IVI_FAILED);
648 iassert(lyt->get_layers_on_screen(iviscrn, NULL, &array) == IVI_FAILED);
649 iassert(lyt->get_layers_on_screen(iviscrn, &length, NULL) == IVI_FAILED);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900650
651 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000652 lyt->layer_destroy(ivilayers[i]);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900653
654 free(iviscrns);
655#undef LAYER_NUM
656}
657
658static void
659test_commit_changes_after_render_order_set_layer_destroy(
660 struct test_context *ctx)
661{
662#define LAYER_NUM (3)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000663 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900664 struct ivi_layout_screen **iviscrns;
665 int32_t screen_length;
666 struct ivi_layout_screen *iviscrn;
667 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
668 uint32_t i;
669
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000670 iassert(lyt->get_screens(&screen_length, &iviscrns) == IVI_SUCCEEDED);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900671 iassert(screen_length > 0);
672
673 if (screen_length <= 0)
674 return;
675
676 iviscrn = iviscrns[0];
677
678 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000679 ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900680
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000681 iassert(lyt->screen_set_render_order(iviscrn, ivilayers, LAYER_NUM) == IVI_SUCCEEDED);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900682
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000683 lyt->layer_destroy(ivilayers[1]);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900684
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000685 lyt->commit_changes();
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900686
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000687 lyt->layer_destroy(ivilayers[0]);
688 lyt->layer_destroy(ivilayers[2]);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900689
690 free(iviscrns);
691#undef LAYER_NUM
692}
693
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900694static void
695test_layer_properties_changed_notification_callback(struct ivi_layout_layer *ivilayer,
696 const struct ivi_layout_layer_properties *prop,
697 enum ivi_layout_notification_mask mask,
698 void *userdata)
699{
700 struct test_context *ctx = userdata;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000701 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900702
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000703 iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900704 iassert(prop->source_width == 200);
705 iassert(prop->source_height == 300);
706
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000707 if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900708 prop->source_width == 200 && prop->source_height == 300)
709 ctx->user_flags = 1;
710}
711
712static void
713test_layer_properties_changed_notification(struct test_context *ctx)
714{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000715 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900716 struct ivi_layout_layer *ivilayer;
717
718 ctx->user_flags = 0;
719
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000720 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900721
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000722 iassert(lyt->layer_add_notification(ivilayer, test_layer_properties_changed_notification_callback, ctx) == IVI_SUCCEEDED);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900723
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000724 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900725
726 iassert(ctx->user_flags == 0);
727
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000728 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900729 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
730
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000731 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900732
733 iassert(ctx->user_flags == 1);
734
735 ctx->user_flags = 0;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000736 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900737 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
738
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000739 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900740
741 iassert(ctx->user_flags == 0);
742
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000743 lyt->layer_remove_notification(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900744
745 ctx->user_flags = 0;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000746 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900747
748 iassert(ctx->user_flags == 0);
749
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000750 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900751}
752
753static void
754test_layer_create_notification_callback(struct ivi_layout_layer *ivilayer,
755 void *userdata)
756{
757 struct test_context *ctx = userdata;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000758 const struct ivi_layout_interface *lyt = ctx->layout_interface;
759 const struct ivi_layout_layer_properties *prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900760
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000761 iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900762 iassert(prop->source_width == 200);
763 iassert(prop->source_height == 300);
764
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000765 if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900766 prop->source_width == 200 && prop->source_height == 300)
767 ctx->user_flags = 1;
768}
769
770static void
771test_layer_create_notification(struct test_context *ctx)
772{
773#define LAYER_NUM (2)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000774 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900775 static const uint32_t layers[LAYER_NUM] = {IVI_TEST_LAYER_ID(0), IVI_TEST_LAYER_ID(1)};
776 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
777
778 ctx->user_flags = 0;
779
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000780 iassert(lyt->add_notification_create_layer(
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900781 test_layer_create_notification_callback, ctx) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000782 ivilayers[0] = lyt->layer_create_with_dimension(layers[0], 200, 300);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900783
784 iassert(ctx->user_flags == 1);
785
786 ctx->user_flags = 0;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000787 lyt->remove_notification_create_layer(test_layer_create_notification_callback, ctx);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900788
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000789 ivilayers[1] = lyt->layer_create_with_dimension(layers[1], 400, 500);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900790
791 iassert(ctx->user_flags == 0);
792
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000793 lyt->layer_destroy(ivilayers[0]);
794 lyt->layer_destroy(ivilayers[1]);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900795#undef LAYER_NUM
796}
797
798static void
799test_layer_remove_notification_callback(struct ivi_layout_layer *ivilayer,
800 void *userdata)
801{
802 struct test_context *ctx = userdata;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000803 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900804 const struct ivi_layout_layer_properties *prop =
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000805 lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900806
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000807 iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900808 iassert(prop->source_width == 200);
809 iassert(prop->source_height == 300);
810
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000811 if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900812 prop->source_width == 200 && prop->source_height == 300)
813 ctx->user_flags = 1;
814}
815
816static void
817test_layer_remove_notification(struct test_context *ctx)
818{
819#define LAYER_NUM (2)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000820 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900821 static const uint32_t layers[LAYER_NUM] = {IVI_TEST_LAYER_ID(0), IVI_TEST_LAYER_ID(1)};
822 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
823
824 ctx->user_flags = 0;
825
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000826 ivilayers[0] = lyt->layer_create_with_dimension(layers[0], 200, 300);
827 iassert(lyt->add_notification_remove_layer(
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900828 test_layer_remove_notification_callback, ctx) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000829 lyt->layer_destroy(ivilayers[0]);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900830
831 iassert(ctx->user_flags == 1);
832
833 ctx->user_flags = 0;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000834 ivilayers[1] = lyt->layer_create_with_dimension(layers[1], 250, 350);
835 lyt->remove_notification_remove_layer(test_layer_remove_notification_callback, ctx);
836 lyt->layer_destroy(ivilayers[1]);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900837
838 iassert(ctx->user_flags == 0);
839#undef LAYER_NUM
840}
841
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900842static void
843test_layer_bad_properties_changed_notification_callback(struct ivi_layout_layer *ivilayer,
844 const struct ivi_layout_layer_properties *prop,
845 enum ivi_layout_notification_mask mask,
846 void *userdata)
847{
848}
849
850static void
851test_layer_bad_properties_changed_notification(struct test_context *ctx)
852{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000853 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900854 struct ivi_layout_layer *ivilayer;
855
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000856 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900857
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000858 iassert(lyt->layer_add_notification(
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900859 NULL, test_layer_bad_properties_changed_notification_callback, NULL) == IVI_FAILED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000860 iassert(lyt->layer_add_notification(ivilayer, NULL, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900861
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000862 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900863}
864
865static void
866test_surface_bad_configure_notification(struct test_context *ctx)
867{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000868 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900869
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000870 iassert(lyt->add_notification_configure_surface(NULL, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900871}
872
873static void
874test_layer_bad_create_notification(struct test_context *ctx)
875{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000876 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900877
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000878 iassert(lyt->add_notification_create_layer(NULL, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900879}
880
881static void
882test_surface_bad_create_notification(struct test_context *ctx)
883{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000884 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900885
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000886 iassert(lyt->add_notification_create_surface(NULL, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900887}
888
889static void
890test_layer_bad_remove_notification(struct test_context *ctx)
891{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000892 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900893
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000894 iassert(lyt->add_notification_remove_layer(NULL, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900895}
896
897static void
898test_surface_bad_remove_notification(struct test_context *ctx)
899{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000900 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900901
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000902 iassert(lyt->add_notification_remove_surface(NULL, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900903}
904
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200905/************************ tests end ********************************/
906
907static void
908run_internal_tests(void *data)
909{
910 struct test_context *ctx = data;
911
912 test_surface_bad_visibility(ctx);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900913 test_surface_bad_destination_rectangle(ctx);
914 test_surface_bad_orientation(ctx);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900915 test_surface_bad_source_rectangle(ctx);
916 test_surface_bad_properties(ctx);
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200917
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900918 test_layer_create(ctx);
919 test_layer_visibility(ctx);
920 test_layer_opacity(ctx);
921 test_layer_orientation(ctx);
922 test_layer_dimension(ctx);
923 test_layer_position(ctx);
924 test_layer_destination_rectangle(ctx);
925 test_layer_source_rectangle(ctx);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900926 test_layer_bad_remove(ctx);
927 test_layer_bad_visibility(ctx);
928 test_layer_bad_opacity(ctx);
929 test_layer_bad_destination_rectangle(ctx);
930 test_layer_bad_orientation(ctx);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900931 test_layer_bad_source_rectangle(ctx);
932 test_layer_bad_properties(ctx);
933 test_commit_changes_after_visibility_set_layer_destroy(ctx);
934 test_commit_changes_after_opacity_set_layer_destroy(ctx);
935 test_commit_changes_after_orientation_set_layer_destroy(ctx);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900936 test_commit_changes_after_source_rectangle_set_layer_destroy(ctx);
937 test_commit_changes_after_destination_rectangle_set_layer_destroy(ctx);
938 test_layer_create_duplicate(ctx);
939 test_get_layer_after_destory_layer(ctx);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900940
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900941 test_screen_id(ctx);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900942 test_screen_render_order(ctx);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900943 test_screen_bad_render_order(ctx);
944 test_commit_changes_after_render_order_set_layer_destroy(ctx);
945
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900946 test_layer_properties_changed_notification(ctx);
947 test_layer_create_notification(ctx);
948 test_layer_remove_notification(ctx);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900949 test_layer_bad_properties_changed_notification(ctx);
950 test_surface_bad_configure_notification(ctx);
951 test_layer_bad_create_notification(ctx);
952 test_surface_bad_create_notification(ctx);
953 test_layer_bad_remove_notification(ctx);
954 test_surface_bad_remove_notification(ctx);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900955
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200956 weston_compositor_exit_with_code(ctx->compositor, EXIT_SUCCESS);
957 free(ctx);
958}
959
960int
961controller_module_init(struct weston_compositor *compositor,
962 int *argc, char *argv[],
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000963 const struct ivi_layout_interface *iface,
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200964 size_t iface_version);
965
966WL_EXPORT int
967controller_module_init(struct weston_compositor *compositor,
968 int *argc, char *argv[],
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000969 const struct ivi_layout_interface *iface,
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200970 size_t iface_version)
971{
972 struct wl_event_loop *loop;
973 struct test_context *ctx;
974
975 /* strict check, since this is an internal test module */
976 if (iface_version != sizeof(*iface)) {
977 weston_log("fatal: controller interface mismatch\n");
978 return -1;
979 }
980
981 ctx = zalloc(sizeof(*ctx));
982 if (!ctx)
983 return -1;
984
985 ctx->compositor = compositor;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000986 ctx->layout_interface = iface;
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200987
988 loop = wl_display_get_event_loop(compositor->wl_display);
989 wl_event_loop_add_idle(loop, run_internal_tests, ctx);
990
991 return 0;
992}