blob: 9a552681db2d8119ca55f613114702237789fd53 [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>
Jussi Kukkonen649bbce2016-07-19 14:16:27 +030033#include <stdint.h>
Pekka Paalanen46804ca2015-03-27 11:55:21 +020034
Pekka Paalanen3d5d9472019-03-28 16:28:47 +020035#include <libweston/libweston.h>
Emre Ucan0707b0e2018-01-25 14:36:13 +010036#include "compositor/weston.h"
Jon Cruz4678bab2015-06-15 15:37:07 -070037#include "ivi-shell/ivi-layout-export.h"
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +090038#include "ivi-shell/ivi-layout-private.h"
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +090039#include "ivi-test.h"
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +000040#include "shared/helpers.h"
Pekka Paalanen46804ca2015-03-27 11:55:21 +020041
42struct test_context {
43 struct weston_compositor *compositor;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000044 const struct ivi_layout_interface *layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +090045 uint32_t user_flags;
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +000046
47 struct wl_listener layer_property_changed;
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +000048 struct wl_listener layer_created;
Ucan, Emre (ADITG/SW1)562f2ec2016-04-04 08:05:15 +000049 struct wl_listener layer_removed;
Pekka Paalanen46804ca2015-03-27 11:55:21 +020050};
51
52static void
53iassert_fail(const char *cond, const char *file, int line,
54 const char *func, struct test_context *ctx)
55{
56 weston_log("Assert failure in %s:%d, %s: '%s'\n",
57 file, line, func, cond);
58 weston_compositor_exit_with_code(ctx->compositor, EXIT_FAILURE);
59}
60
61#define iassert(cond) ({ \
62 bool b_ = (cond); \
63 if (!b_) \
64 iassert_fail(#cond, __FILE__, __LINE__, __func__, ctx); \
65 b_; \
66})
67
68/************************ tests begin ******************************/
69
70/*
71 * These are all internal ivi_layout API tests that do not require
72 * any client objects.
73 */
Pekka Paalanen46804ca2015-03-27 11:55:21 +020074static void
75test_surface_bad_visibility(struct test_context *ctx)
76{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000077 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Pekka Paalanen46804ca2015-03-27 11:55:21 +020078
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000079 iassert(lyt->surface_set_visibility(NULL, true) == IVI_FAILED);
Pekka Paalanen46804ca2015-03-27 11:55:21 +020080
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000081 lyt->commit_changes();
Pekka Paalanen46804ca2015-03-27 11:55:21 +020082}
83
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090084static void
85test_surface_bad_destination_rectangle(struct test_context *ctx)
86{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000087 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090088
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000089 iassert(lyt->surface_set_destination_rectangle(NULL, 20, 30, 200, 300) == IVI_FAILED);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090090}
91
92static void
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090093test_surface_bad_source_rectangle(struct test_context *ctx)
94{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000095 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090096
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000097 iassert(lyt->surface_set_source_rectangle(NULL, 20, 30, 200, 300) == IVI_FAILED);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090098}
99
100static void
101test_surface_bad_properties(struct test_context *ctx)
102{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000103 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900104
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000105 iassert(lyt->get_properties_of_surface(NULL) == NULL);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900106}
107
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900108static void
109test_layer_create(struct test_context *ctx)
110{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000111 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900112 uint32_t id1;
113 uint32_t id2;
114 struct ivi_layout_layer *ivilayer;
115 struct ivi_layout_layer *new_ivilayer;
116
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000117 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900118 iassert(ivilayer != NULL);
119
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000120 iassert(IVI_TEST_LAYER_ID(0) == lyt->get_id_of_layer(ivilayer));
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900121
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000122 new_ivilayer = lyt->get_layer_from_id(IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900123 iassert(ivilayer == new_ivilayer);
124
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000125 id1 = lyt->get_id_of_layer(ivilayer);
126 id2 = lyt->get_id_of_layer(new_ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900127 iassert(id1 == id2);
128
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000129 lyt->layer_destroy(ivilayer);
130 iassert(lyt->get_layer_from_id(IVI_TEST_LAYER_ID(0)) == NULL);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900131}
132
133static void
134test_layer_visibility(struct test_context *ctx)
135{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000136 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900137 struct ivi_layout_layer *ivilayer;
138 const struct ivi_layout_layer_properties *prop;
139
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000140 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900141 iassert(ivilayer != NULL);
142
Ucan, Emre \(ADITG/SW1\)17610f22016-03-04 12:50:07 +0000143 prop = lyt->get_properties_of_layer(ivilayer);
144
145 iassert(prop->visibility == false);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900146
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000147 iassert(lyt->layer_set_visibility(ivilayer, true) == IVI_SUCCEEDED);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900148
Ucan, Emre \(ADITG/SW1\)17610f22016-03-04 12:50:07 +0000149 iassert(prop->visibility == false);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900150
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000151 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900152
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900153 iassert(prop->visibility == true);
154
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000155 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900156}
157
158static void
159test_layer_opacity(struct test_context *ctx)
160{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000161 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900162 struct ivi_layout_layer *ivilayer;
163 const struct ivi_layout_layer_properties *prop;
164
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000165 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900166 iassert(ivilayer != NULL);
167
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000168 prop = lyt->get_properties_of_layer(ivilayer);
169 iassert(prop->opacity == wl_fixed_from_double(1.0));
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900170
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000171 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900172 ivilayer, wl_fixed_from_double(0.5)) == IVI_SUCCEEDED);
173
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000174 iassert(prop->opacity == wl_fixed_from_double(1.0));
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900175
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000176 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900177
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900178 iassert(prop->opacity == wl_fixed_from_double(0.5));
179
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000180 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900181}
182
183static void
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900184test_layer_dimension(struct test_context *ctx)
185{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000186 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900187 struct ivi_layout_layer *ivilayer;
188 const struct ivi_layout_layer_properties *prop;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900189
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000190 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900191 iassert(ivilayer != NULL);
192
Ucan, Emre \(ADITG/SW1\)18691f02016-03-04 12:50:32 +0000193 prop = lyt->get_properties_of_layer(ivilayer);
194 iassert(prop->dest_width == 200);
195 iassert(prop->dest_height == 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900196
Ucan, Emre \(ADITG/SW1\)16d1fa12016-03-04 12:50:52 +0000197 iassert(lyt->layer_set_destination_rectangle(ivilayer, prop->dest_x, prop->dest_y,
198 400, 600) == IVI_SUCCEEDED);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900199
Ucan, Emre \(ADITG/SW1\)18691f02016-03-04 12:50:32 +0000200 iassert(prop->dest_width == 200);
201 iassert(prop->dest_height == 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900202
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000203 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900204
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900205 iassert(prop->dest_width == 400);
206 iassert(prop->dest_height == 600);
207
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000208 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900209}
210
211static void
212test_layer_position(struct test_context *ctx)
213{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000214 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900215 struct ivi_layout_layer *ivilayer;
216 const struct ivi_layout_layer_properties *prop;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900217
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000218 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900219 iassert(ivilayer != NULL);
220
Ucan, Emre \(ADITG/SW1\)dfc2d762016-03-04 12:50:24 +0000221 prop = lyt->get_properties_of_layer(ivilayer);
222 iassert(prop->dest_x == 0);
223 iassert(prop->dest_y == 0);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900224
Ucan, Emre \(ADITG/SW1\)e62bfd82016-03-04 12:50:46 +0000225 iassert(lyt->layer_set_destination_rectangle(ivilayer, 20, 30,
226 prop->dest_width, prop->dest_height) == IVI_SUCCEEDED);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900227
Ucan, Emre \(ADITG/SW1\)dfc2d762016-03-04 12:50:24 +0000228 iassert(prop->dest_x == 0);
229 iassert(prop->dest_y == 0);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900230
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000231 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900232
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000233 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900234 iassert(prop->dest_x == 20);
235 iassert(prop->dest_y == 30);
236
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000237 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900238}
239
240static void
241test_layer_destination_rectangle(struct test_context *ctx)
242{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000243 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900244 struct ivi_layout_layer *ivilayer;
245 const struct ivi_layout_layer_properties *prop;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900246
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000247 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900248 iassert(ivilayer != NULL);
249
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000250 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900251 iassert(prop->dest_width == 200);
252 iassert(prop->dest_height == 300);
253 iassert(prop->dest_x == 0);
254 iassert(prop->dest_y == 0);
255
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000256 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900257 ivilayer, 20, 30, 400, 600) == IVI_SUCCEEDED);
258
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_width == 200);
261 iassert(prop->dest_height == 300);
262 iassert(prop->dest_x == 0);
263 iassert(prop->dest_y == 0);
264
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000265 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900266
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900267 iassert(prop->dest_width == 400);
268 iassert(prop->dest_height == 600);
269 iassert(prop->dest_x == 20);
270 iassert(prop->dest_y == 30);
271
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000272 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900273}
274
275static void
276test_layer_source_rectangle(struct test_context *ctx)
277{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000278 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900279 struct ivi_layout_layer *ivilayer;
280 const struct ivi_layout_layer_properties *prop;
281
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000282 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900283 iassert(ivilayer != NULL);
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->source_width == 200);
287 iassert(prop->source_height == 300);
288 iassert(prop->source_x == 0);
289 iassert(prop->source_y == 0);
290
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000291 iassert(lyt->layer_set_source_rectangle(
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900292 ivilayer, 20, 30, 400, 600) == IVI_SUCCEEDED);
293
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000294 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900295 iassert(prop->source_width == 200);
296 iassert(prop->source_height == 300);
297 iassert(prop->source_x == 0);
298 iassert(prop->source_y == 0);
299
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000300 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900301
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000302 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900303 iassert(prop->source_width == 400);
304 iassert(prop->source_height == 600);
305 iassert(prop->source_x == 20);
306 iassert(prop->source_y == 30);
307
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000308 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900309}
310
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900311static void
312test_layer_bad_remove(struct test_context *ctx)
313{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000314 const struct ivi_layout_interface *lyt = ctx->layout_interface;
315 lyt->layer_destroy(NULL);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900316}
317
318static void
319test_layer_bad_visibility(struct test_context *ctx)
320{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000321 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900322
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000323 iassert(lyt->layer_set_visibility(NULL, true) == IVI_FAILED);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900324
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000325 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900326}
327
328static void
329test_layer_bad_opacity(struct test_context *ctx)
330{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000331 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900332 struct ivi_layout_layer *ivilayer;
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000333 const struct ivi_layout_layer_properties *prop;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900334
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000335 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900336 iassert(ivilayer != NULL);
337
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000338 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900339 NULL, wl_fixed_from_double(0.3)) == IVI_FAILED);
340
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000341 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900342 ivilayer, wl_fixed_from_double(0.3)) == IVI_SUCCEEDED);
343
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000344 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900345 ivilayer, wl_fixed_from_double(-1)) == IVI_FAILED);
346
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000347 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900348
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000349 prop = lyt->get_properties_of_layer(ivilayer);
350 iassert(prop->opacity == wl_fixed_from_double(0.3));
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900351
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000352 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900353 ivilayer, wl_fixed_from_double(1.1)) == IVI_FAILED);
354
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000355 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900356
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000357 iassert(prop->opacity == wl_fixed_from_double(0.3));
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900358
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000359 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900360 NULL, wl_fixed_from_double(0.5)) == IVI_FAILED);
361
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000362 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900363
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000364 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900365}
366
367static void
368test_layer_bad_destination_rectangle(struct test_context *ctx)
369{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000370 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900371
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000372 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900373 NULL, 20, 30, 200, 300) == IVI_FAILED);
374}
375
376static void
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900377test_layer_bad_source_rectangle(struct test_context *ctx)
378{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000379 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900380
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000381 iassert(lyt->layer_set_source_rectangle(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900382 NULL, 20, 30, 200, 300) == IVI_FAILED);
383}
384
385static void
386test_layer_bad_properties(struct test_context *ctx)
387{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000388 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900389
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000390 iassert(lyt->get_properties_of_layer(NULL) == NULL);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900391}
392
393static void
394test_commit_changes_after_visibility_set_layer_destroy(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 struct ivi_layout_layer *ivilayer;
398
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000399 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900400 iassert(ivilayer != NULL);
401
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000402 iassert(lyt->layer_set_visibility(ivilayer, true) == IVI_SUCCEEDED);
403 lyt->layer_destroy(ivilayer);
404 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900405}
406
407static void
408test_commit_changes_after_opacity_set_layer_destroy(struct test_context *ctx)
409{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000410 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900411 struct ivi_layout_layer *ivilayer;
412
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000413 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900414 iassert(ivilayer != NULL);
415
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000416 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900417 ivilayer, wl_fixed_from_double(0.5)) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000418 lyt->layer_destroy(ivilayer);
419 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900420}
421
422static void
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900423test_commit_changes_after_source_rectangle_set_layer_destroy(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 struct ivi_layout_layer *ivilayer;
427
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000428 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900429 iassert(ivilayer != NULL);
430
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000431 iassert(lyt->layer_set_source_rectangle(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900432 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000433 lyt->layer_destroy(ivilayer);
434 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900435}
436
437static void
438test_commit_changes_after_destination_rectangle_set_layer_destroy(struct test_context *ctx)
439{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000440 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900441 struct ivi_layout_layer *ivilayer;
442
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000443 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900444 iassert(ivilayer != NULL);
445
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000446 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900447 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000448 lyt->layer_destroy(ivilayer);
449 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900450}
451
452static void
453test_layer_create_duplicate(struct test_context *ctx)
454{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000455 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900456 struct ivi_layout_layer *ivilayer;
457 struct ivi_layout_layer *duplicatelayer;
458
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000459 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900460 iassert(ivilayer != NULL);
461
462 if (ivilayer != NULL)
463 iassert(ivilayer->ref_count == 1);
464
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000465 duplicatelayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900466 iassert(ivilayer == duplicatelayer);
467
468 if (ivilayer != NULL)
469 iassert(ivilayer->ref_count == 2);
470
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000471 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900472
473 if (ivilayer != NULL)
474 iassert(ivilayer->ref_count == 1);
475
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000476 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900477}
478
479static void
480test_get_layer_after_destory_layer(struct test_context *ctx)
481{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000482 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900483 struct ivi_layout_layer *ivilayer;
484
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000485 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900486 iassert(ivilayer != NULL);
487
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000488 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900489
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000490 ivilayer = lyt->get_layer_from_id(IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900491 iassert(ivilayer == NULL);
492}
493
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900494static void
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900495test_screen_render_order(struct test_context *ctx)
496{
497#define LAYER_NUM (3)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000498 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000499 struct weston_output *output;
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900500 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
501 struct ivi_layout_layer **array;
502 int32_t length = 0;
503 uint32_t i;
504
Pekka Paalanend05a8192017-08-17 13:30:11 +0300505 if (!iassert(!wl_list_empty(&ctx->compositor->output_list)))
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900506 return;
507
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000508 output = wl_container_of(ctx->compositor->output_list.next, output, link);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900509
510 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000511 ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900512
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000513 iassert(lyt->screen_set_render_order(output, ivilayers, LAYER_NUM) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900514
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000515 lyt->commit_changes();
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900516
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000517 iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900518 iassert(length == LAYER_NUM);
519 for (i = 0; i < LAYER_NUM; i++)
520 iassert(array[i] == ivilayers[i]);
521
522 if (length > 0)
523 free(array);
524
525 array = NULL;
526
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000527 iassert(lyt->screen_set_render_order(output, NULL, 0) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900528
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000529 lyt->commit_changes();
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900530
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000531 iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900532 iassert(length == 0 && array == NULL);
533
534 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000535 lyt->layer_destroy(ivilayers[i]);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900536
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900537#undef LAYER_NUM
538}
539
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900540static void
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900541test_screen_bad_render_order(struct test_context *ctx)
542{
543#define LAYER_NUM (3)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000544 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000545 struct weston_output *output;
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900546 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
547 struct ivi_layout_layer **array;
548 int32_t length = 0;
549 uint32_t i;
550
Pekka Paalanend05a8192017-08-17 13:30:11 +0300551 if (!iassert(!wl_list_empty(&ctx->compositor->output_list)))
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900552 return;
553
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000554 output = wl_container_of(ctx->compositor->output_list.next, output, link);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900555
556 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000557 ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900558
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000559 iassert(lyt->screen_set_render_order(NULL, ivilayers, LAYER_NUM) == IVI_FAILED);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900560
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000561 lyt->commit_changes();
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900562
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000563 iassert(lyt->get_layers_on_screen(NULL, &length, &array) == IVI_FAILED);
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000564 iassert(lyt->get_layers_on_screen(output, NULL, &array) == IVI_FAILED);
565 iassert(lyt->get_layers_on_screen(output, &length, NULL) == IVI_FAILED);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900566
567 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000568 lyt->layer_destroy(ivilayers[i]);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900569
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900570#undef LAYER_NUM
571}
572
573static void
Ucan, Emre (ADITG/SW1)fbce2f52017-01-18 15:25:36 +0000574test_screen_add_layers(struct test_context *ctx)
575{
576#define LAYER_NUM (3)
577 const struct ivi_layout_interface *lyt = ctx->layout_interface;
578 struct weston_output *output;
579 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
580 struct ivi_layout_layer **array;
581 int32_t length = 0;
582 uint32_t i;
583
Pekka Paalanend05a8192017-08-17 13:30:11 +0300584 if (!iassert(!wl_list_empty(&ctx->compositor->output_list)))
Ucan, Emre (ADITG/SW1)fbce2f52017-01-18 15:25:36 +0000585 return;
586
587 output = wl_container_of(ctx->compositor->output_list.next, output, link);
588
589 for (i = 0; i < LAYER_NUM; i++) {
590 ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
591 iassert(lyt->screen_add_layer(output, ivilayers[i]) == IVI_SUCCEEDED);
592 }
593
594 lyt->commit_changes();
595
596 iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
597 iassert(length == LAYER_NUM);
598 for (i = 0; i < (uint32_t)length; i++)
599 iassert(array[i] == ivilayers[i]);
600
601 if (length > 0)
602 free(array);
603
604 array = NULL;
605
606 iassert(lyt->screen_set_render_order(output, NULL, 0) == IVI_SUCCEEDED);
607 for (i = LAYER_NUM; i-- > 0;)
608 iassert(lyt->screen_add_layer(output, ivilayers[i]) == IVI_SUCCEEDED);
609
610 lyt->commit_changes();
611
612 iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
613 iassert(length == LAYER_NUM);
614 for (i = 0; i < (uint32_t)length; i++)
615 iassert(array[i] == ivilayers[LAYER_NUM - (i + 1)]);
616
617 if (length > 0)
618 free(array);
619
620 for (i = 0; i < LAYER_NUM; i++)
621 lyt->layer_destroy(ivilayers[i]);
622
623#undef LAYER_NUM
624}
625
626static void
Michael Teyfel156bd062017-07-26 14:22:49 +0200627test_screen_remove_layer(struct test_context *ctx)
628{
629 const struct ivi_layout_interface *lyt = ctx->layout_interface;
630 struct ivi_layout_layer *ivilayer;
631 struct weston_output *output;
632 struct ivi_layout_layer **array;
633 int32_t length = 0;
634
635 if (wl_list_empty(&ctx->compositor->output_list))
636 return;
637
638 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
639 iassert(ivilayer != NULL);
640
641 output = wl_container_of(ctx->compositor->output_list.next, output, link);
642
643 iassert(lyt->screen_add_layer(output, ivilayer) == IVI_SUCCEEDED);
644 lyt->commit_changes();
645
646 iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
647 iassert(length == 1);
648 iassert(array[0] == ivilayer);
649
650 iassert(lyt->screen_remove_layer(output, ivilayer) == IVI_SUCCEEDED);
651 lyt->commit_changes();
652
653 if (length > 0)
654 free(array);
655
656 array = NULL;
657
658 iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
659 iassert(length == 0);
660 iassert(array == NULL);
661
662 lyt->layer_destroy(ivilayer);
663}
664
665static void
666test_screen_bad_remove_layer(struct test_context *ctx)
667{
668 const struct ivi_layout_interface *lyt = ctx->layout_interface;
669 struct ivi_layout_layer *ivilayer;
670 struct weston_output *output;
671
672 if (wl_list_empty(&ctx->compositor->output_list))
673 return;
674
675 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
676 iassert(ivilayer != NULL);
677
678 output = wl_container_of(ctx->compositor->output_list.next, output, link);
679
680 iassert(lyt->screen_remove_layer(NULL, ivilayer) == IVI_FAILED);
681 lyt->commit_changes();
682
683 iassert(lyt->screen_remove_layer(output, NULL) == IVI_FAILED);
684 lyt->commit_changes();
685
686 iassert(lyt->screen_remove_layer(NULL, NULL) == IVI_FAILED);
687 lyt->commit_changes();
688
689 lyt->layer_destroy(ivilayer);
690}
691
692
693static void
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900694test_commit_changes_after_render_order_set_layer_destroy(
695 struct test_context *ctx)
696{
697#define LAYER_NUM (3)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000698 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000699 struct weston_output *output;
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900700 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
701 uint32_t i;
702
Pekka Paalanend05a8192017-08-17 13:30:11 +0300703 if (!iassert(!wl_list_empty(&ctx->compositor->output_list)))
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900704 return;
705
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000706 output = wl_container_of(ctx->compositor->output_list.next, output, link);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900707
708 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000709 ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900710
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000711 iassert(lyt->screen_set_render_order(output, ivilayers, LAYER_NUM) == IVI_SUCCEEDED);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900712
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000713 lyt->layer_destroy(ivilayers[1]);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900714
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000715 lyt->commit_changes();
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900716
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000717 lyt->layer_destroy(ivilayers[0]);
718 lyt->layer_destroy(ivilayers[2]);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900719#undef LAYER_NUM
720}
721
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900722static void
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000723test_layer_properties_changed_notification_callback(struct wl_listener *listener, void *data)
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900724{
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000725 struct test_context *ctx =
726 container_of(listener, struct test_context,
727 layer_property_changed);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000728 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000729 struct ivi_layout_layer *ivilayer = data;
730 const struct ivi_layout_layer_properties *prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900731
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000732 iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900733 iassert(prop->source_width == 200);
734 iassert(prop->source_height == 300);
735
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000736 if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900737 prop->source_width == 200 && prop->source_height == 300)
738 ctx->user_flags = 1;
739}
740
741static void
742test_layer_properties_changed_notification(struct test_context *ctx)
743{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000744 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900745 struct ivi_layout_layer *ivilayer;
746
747 ctx->user_flags = 0;
748
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000749 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900750
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000751 ctx->layer_property_changed.notify = test_layer_properties_changed_notification_callback;
752
753 iassert(lyt->layer_add_listener(ivilayer, &ctx->layer_property_changed) == IVI_SUCCEEDED);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900754
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000755 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900756
757 iassert(ctx->user_flags == 0);
758
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000759 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900760 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
761
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000762 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900763
764 iassert(ctx->user_flags == 1);
765
766 ctx->user_flags = 0;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000767 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900768 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
769
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000770 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900771
772 iassert(ctx->user_flags == 0);
773
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000774 // remove layer property changed listener.
775 wl_list_remove(&ctx->layer_property_changed.link);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900776
777 ctx->user_flags = 0;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000778 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900779
780 iassert(ctx->user_flags == 0);
781
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000782 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900783}
784
785static void
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +0000786test_layer_create_notification_callback(struct wl_listener *listener, void *data)
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900787{
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +0000788 struct test_context *ctx =
789 container_of(listener, struct test_context,
790 layer_created);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000791 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +0000792 struct ivi_layout_layer *ivilayer = data;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000793 const struct ivi_layout_layer_properties *prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900794
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000795 iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900796 iassert(prop->source_width == 200);
797 iassert(prop->source_height == 300);
798
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000799 if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900800 prop->source_width == 200 && prop->source_height == 300)
801 ctx->user_flags = 1;
802}
803
804static void
805test_layer_create_notification(struct test_context *ctx)
806{
807#define LAYER_NUM (2)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000808 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900809 static const uint32_t layers[LAYER_NUM] = {IVI_TEST_LAYER_ID(0), IVI_TEST_LAYER_ID(1)};
810 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
811
812 ctx->user_flags = 0;
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +0000813 ctx->layer_created.notify = test_layer_create_notification_callback;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900814
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +0000815 iassert(lyt->add_listener_create_layer(&ctx->layer_created) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000816 ivilayers[0] = lyt->layer_create_with_dimension(layers[0], 200, 300);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900817
818 iassert(ctx->user_flags == 1);
819
820 ctx->user_flags = 0;
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +0000821 // remove layer created listener.
822 wl_list_remove(&ctx->layer_created.link);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900823
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000824 ivilayers[1] = lyt->layer_create_with_dimension(layers[1], 400, 500);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900825
826 iassert(ctx->user_flags == 0);
827
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000828 lyt->layer_destroy(ivilayers[0]);
829 lyt->layer_destroy(ivilayers[1]);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900830#undef LAYER_NUM
831}
832
833static void
Ucan, Emre (ADITG/SW1)562f2ec2016-04-04 08:05:15 +0000834test_layer_remove_notification_callback(struct wl_listener *listener, void *data)
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900835{
Ucan, Emre (ADITG/SW1)562f2ec2016-04-04 08:05:15 +0000836 struct test_context *ctx =
837 container_of(listener, struct test_context,
838 layer_removed);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000839 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Ucan, Emre (ADITG/SW1)562f2ec2016-04-04 08:05:15 +0000840 struct ivi_layout_layer *ivilayer = data;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900841 const struct ivi_layout_layer_properties *prop =
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000842 lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900843
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000844 iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900845 iassert(prop->source_width == 200);
846 iassert(prop->source_height == 300);
847
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000848 if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900849 prop->source_width == 200 && prop->source_height == 300)
850 ctx->user_flags = 1;
851}
852
853static void
854test_layer_remove_notification(struct test_context *ctx)
855{
856#define LAYER_NUM (2)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000857 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900858 static const uint32_t layers[LAYER_NUM] = {IVI_TEST_LAYER_ID(0), IVI_TEST_LAYER_ID(1)};
859 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
860
861 ctx->user_flags = 0;
Ucan, Emre (ADITG/SW1)562f2ec2016-04-04 08:05:15 +0000862 ctx->layer_removed.notify = test_layer_remove_notification_callback;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900863
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000864 ivilayers[0] = lyt->layer_create_with_dimension(layers[0], 200, 300);
Ucan, Emre (ADITG/SW1)562f2ec2016-04-04 08:05:15 +0000865 iassert(lyt->add_listener_remove_layer(&ctx->layer_removed) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000866 lyt->layer_destroy(ivilayers[0]);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900867
868 iassert(ctx->user_flags == 1);
869
870 ctx->user_flags = 0;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000871 ivilayers[1] = lyt->layer_create_with_dimension(layers[1], 250, 350);
Ucan, Emre (ADITG/SW1)562f2ec2016-04-04 08:05:15 +0000872
873 // remove layer property changed listener.
874 wl_list_remove(&ctx->layer_removed.link);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000875 lyt->layer_destroy(ivilayers[1]);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900876
877 iassert(ctx->user_flags == 0);
878#undef LAYER_NUM
879}
880
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900881static void
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000882test_layer_bad_properties_changed_notification_callback(struct wl_listener *listener, void *data)
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900883{
884}
885
886static void
887test_layer_bad_properties_changed_notification(struct test_context *ctx)
888{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000889 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900890 struct ivi_layout_layer *ivilayer;
891
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000892 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900893
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000894 ctx->layer_property_changed.notify = test_layer_bad_properties_changed_notification_callback;
895
896 iassert(lyt->layer_add_listener(NULL, &ctx->layer_property_changed) == IVI_FAILED);
897 iassert(lyt->layer_add_listener(ivilayer, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900898
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000899 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900900}
901
902static void
903test_surface_bad_configure_notification(struct test_context *ctx)
904{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000905 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900906
Ucan, Emre (ADITG/SW1)c49aa5a2016-04-04 08:05:20 +0000907 iassert(lyt->add_listener_configure_surface(NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900908}
909
910static void
911test_layer_bad_create_notification(struct test_context *ctx)
912{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000913 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900914
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +0000915 iassert(lyt->add_listener_create_layer(NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900916}
917
918static void
919test_surface_bad_create_notification(struct test_context *ctx)
920{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000921 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900922
Ucan, Emre (ADITG/SW1)970f8312016-04-04 08:05:09 +0000923 iassert(lyt->add_listener_create_surface(NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900924}
925
926static void
927test_layer_bad_remove_notification(struct test_context *ctx)
928{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000929 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900930
Ucan, Emre (ADITG/SW1)562f2ec2016-04-04 08:05:15 +0000931 iassert(lyt->add_listener_remove_layer(NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900932}
933
934static void
935test_surface_bad_remove_notification(struct test_context *ctx)
936{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000937 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900938
Ucan, Emre (ADITG/SW1)67f0aa82016-04-04 08:05:18 +0000939 iassert(lyt->add_listener_remove_surface(NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900940}
941
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200942/************************ tests end ********************************/
943
944static void
945run_internal_tests(void *data)
946{
947 struct test_context *ctx = data;
948
949 test_surface_bad_visibility(ctx);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900950 test_surface_bad_destination_rectangle(ctx);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900951 test_surface_bad_source_rectangle(ctx);
952 test_surface_bad_properties(ctx);
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200953
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900954 test_layer_create(ctx);
955 test_layer_visibility(ctx);
956 test_layer_opacity(ctx);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900957 test_layer_dimension(ctx);
958 test_layer_position(ctx);
959 test_layer_destination_rectangle(ctx);
960 test_layer_source_rectangle(ctx);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900961 test_layer_bad_remove(ctx);
962 test_layer_bad_visibility(ctx);
963 test_layer_bad_opacity(ctx);
964 test_layer_bad_destination_rectangle(ctx);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900965 test_layer_bad_source_rectangle(ctx);
966 test_layer_bad_properties(ctx);
967 test_commit_changes_after_visibility_set_layer_destroy(ctx);
968 test_commit_changes_after_opacity_set_layer_destroy(ctx);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900969 test_commit_changes_after_source_rectangle_set_layer_destroy(ctx);
970 test_commit_changes_after_destination_rectangle_set_layer_destroy(ctx);
971 test_layer_create_duplicate(ctx);
972 test_get_layer_after_destory_layer(ctx);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900973
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900974 test_screen_render_order(ctx);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900975 test_screen_bad_render_order(ctx);
Ucan, Emre (ADITG/SW1)fbce2f52017-01-18 15:25:36 +0000976 test_screen_add_layers(ctx);
Michael Teyfel156bd062017-07-26 14:22:49 +0200977 test_screen_remove_layer(ctx);
978 test_screen_bad_remove_layer(ctx);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900979 test_commit_changes_after_render_order_set_layer_destroy(ctx);
980
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900981 test_layer_properties_changed_notification(ctx);
982 test_layer_create_notification(ctx);
983 test_layer_remove_notification(ctx);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900984 test_layer_bad_properties_changed_notification(ctx);
985 test_surface_bad_configure_notification(ctx);
986 test_layer_bad_create_notification(ctx);
987 test_surface_bad_create_notification(ctx);
988 test_layer_bad_remove_notification(ctx);
989 test_surface_bad_remove_notification(ctx);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900990
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200991 weston_compositor_exit_with_code(ctx->compositor, EXIT_SUCCESS);
992 free(ctx);
993}
994
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200995WL_EXPORT int
Emre Ucan0707b0e2018-01-25 14:36:13 +0100996wet_module_init(struct weston_compositor *compositor,
997 int *argc, char *argv[])
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200998{
999 struct wl_event_loop *loop;
1000 struct test_context *ctx;
Emre Ucan0707b0e2018-01-25 14:36:13 +01001001 const struct ivi_layout_interface *iface;
Pekka Paalanen46804ca2015-03-27 11:55:21 +02001002
Emre Ucan0707b0e2018-01-25 14:36:13 +01001003 iface = ivi_layout_get_api(compositor);
1004
1005 if (!iface) {
1006 weston_log("fatal: cannot use ivi_layout_interface.\n");
Pekka Paalanen46804ca2015-03-27 11:55:21 +02001007 return -1;
1008 }
1009
1010 ctx = zalloc(sizeof(*ctx));
1011 if (!ctx)
1012 return -1;
1013
1014 ctx->compositor = compositor;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +00001015 ctx->layout_interface = iface;
Pekka Paalanen46804ca2015-03-27 11:55:21 +02001016
1017 loop = wl_display_get_event_loop(compositor->wl_display);
1018 wl_event_loop_add_idle(loop, run_internal_tests, ctx);
1019
1020 return 0;
1021}