blob: fd3eec5452b7d9117d800ceece9e8b7eeff51e55 [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 Paalanenad1a4102019-11-11 16:28:28 +020041#include "weston-test-runner.h"
42#include "weston-test-fixture-compositor.h"
43
44static enum test_result_code
45fixture_setup(struct weston_test_harness *harness)
46{
47 struct compositor_setup setup;
48
49 compositor_setup_defaults(&setup);
50 setup.shell = SHELL_IVI;
51
52 return weston_test_harness_execute_as_plugin(harness, &setup);
53}
54DECLARE_FIXTURE_SETUP(fixture_setup);
Pekka Paalanen46804ca2015-03-27 11:55:21 +020055
56struct test_context {
57 struct weston_compositor *compositor;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000058 const struct ivi_layout_interface *layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +090059 uint32_t user_flags;
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +000060
61 struct wl_listener layer_property_changed;
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +000062 struct wl_listener layer_created;
Ucan, Emre (ADITG/SW1)562f2ec2016-04-04 08:05:15 +000063 struct wl_listener layer_removed;
Pekka Paalanen46804ca2015-03-27 11:55:21 +020064};
65
66static void
67iassert_fail(const char *cond, const char *file, int line,
68 const char *func, struct test_context *ctx)
69{
70 weston_log("Assert failure in %s:%d, %s: '%s'\n",
71 file, line, func, cond);
72 weston_compositor_exit_with_code(ctx->compositor, EXIT_FAILURE);
73}
74
75#define iassert(cond) ({ \
76 bool b_ = (cond); \
77 if (!b_) \
78 iassert_fail(#cond, __FILE__, __LINE__, __func__, ctx); \
79 b_; \
80})
81
82/************************ tests begin ******************************/
83
84/*
85 * These are all internal ivi_layout API tests that do not require
86 * any client objects.
87 */
Pekka Paalanen46804ca2015-03-27 11:55:21 +020088static void
89test_surface_bad_visibility(struct test_context *ctx)
90{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000091 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Pekka Paalanen46804ca2015-03-27 11:55:21 +020092
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000093 iassert(lyt->surface_set_visibility(NULL, true) == IVI_FAILED);
Pekka Paalanen46804ca2015-03-27 11:55:21 +020094
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000095 lyt->commit_changes();
Pekka Paalanen46804ca2015-03-27 11:55:21 +020096}
97
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090098static void
99test_surface_bad_destination_rectangle(struct test_context *ctx)
100{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000101 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900102
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000103 iassert(lyt->surface_set_destination_rectangle(NULL, 20, 30, 200, 300) == IVI_FAILED);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900104}
105
106static void
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900107test_surface_bad_source_rectangle(struct test_context *ctx)
108{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000109 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900110
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000111 iassert(lyt->surface_set_source_rectangle(NULL, 20, 30, 200, 300) == IVI_FAILED);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900112}
113
114static void
115test_surface_bad_properties(struct test_context *ctx)
116{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000117 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900118
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000119 iassert(lyt->get_properties_of_surface(NULL) == NULL);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900120}
121
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900122static void
123test_layer_create(struct test_context *ctx)
124{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000125 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900126 uint32_t id1;
127 uint32_t id2;
128 struct ivi_layout_layer *ivilayer;
129 struct ivi_layout_layer *new_ivilayer;
130
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000131 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900132 iassert(ivilayer != NULL);
133
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000134 iassert(IVI_TEST_LAYER_ID(0) == lyt->get_id_of_layer(ivilayer));
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900135
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000136 new_ivilayer = lyt->get_layer_from_id(IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900137 iassert(ivilayer == new_ivilayer);
138
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000139 id1 = lyt->get_id_of_layer(ivilayer);
140 id2 = lyt->get_id_of_layer(new_ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900141 iassert(id1 == id2);
142
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000143 lyt->layer_destroy(ivilayer);
144 iassert(lyt->get_layer_from_id(IVI_TEST_LAYER_ID(0)) == NULL);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900145}
146
147static void
148test_layer_visibility(struct test_context *ctx)
149{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000150 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900151 struct ivi_layout_layer *ivilayer;
152 const struct ivi_layout_layer_properties *prop;
153
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000154 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900155 iassert(ivilayer != NULL);
156
Ucan, Emre \(ADITG/SW1\)17610f22016-03-04 12:50:07 +0000157 prop = lyt->get_properties_of_layer(ivilayer);
158
159 iassert(prop->visibility == false);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900160
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000161 iassert(lyt->layer_set_visibility(ivilayer, true) == IVI_SUCCEEDED);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900162
Ucan, Emre \(ADITG/SW1\)17610f22016-03-04 12:50:07 +0000163 iassert(prop->visibility == false);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900164
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000165 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900166
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900167 iassert(prop->visibility == true);
168
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000169 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900170}
171
172static void
173test_layer_opacity(struct test_context *ctx)
174{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000175 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900176 struct ivi_layout_layer *ivilayer;
177 const struct ivi_layout_layer_properties *prop;
178
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000179 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900180 iassert(ivilayer != NULL);
181
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000182 prop = lyt->get_properties_of_layer(ivilayer);
183 iassert(prop->opacity == wl_fixed_from_double(1.0));
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900184
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000185 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900186 ivilayer, wl_fixed_from_double(0.5)) == IVI_SUCCEEDED);
187
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000188 iassert(prop->opacity == wl_fixed_from_double(1.0));
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900189
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000190 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900191
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900192 iassert(prop->opacity == wl_fixed_from_double(0.5));
193
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000194 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900195}
196
197static void
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900198test_layer_dimension(struct test_context *ctx)
199{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000200 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900201 struct ivi_layout_layer *ivilayer;
202 const struct ivi_layout_layer_properties *prop;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900203
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000204 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900205 iassert(ivilayer != NULL);
206
Ucan, Emre \(ADITG/SW1\)18691f02016-03-04 12:50:32 +0000207 prop = lyt->get_properties_of_layer(ivilayer);
208 iassert(prop->dest_width == 200);
209 iassert(prop->dest_height == 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900210
Ucan, Emre \(ADITG/SW1\)16d1fa12016-03-04 12:50:52 +0000211 iassert(lyt->layer_set_destination_rectangle(ivilayer, prop->dest_x, prop->dest_y,
212 400, 600) == IVI_SUCCEEDED);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900213
Ucan, Emre \(ADITG/SW1\)18691f02016-03-04 12:50:32 +0000214 iassert(prop->dest_width == 200);
215 iassert(prop->dest_height == 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900216
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000217 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900218
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900219 iassert(prop->dest_width == 400);
220 iassert(prop->dest_height == 600);
221
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000222 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900223}
224
225static void
226test_layer_position(struct test_context *ctx)
227{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000228 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900229 struct ivi_layout_layer *ivilayer;
230 const struct ivi_layout_layer_properties *prop;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900231
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000232 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900233 iassert(ivilayer != NULL);
234
Ucan, Emre \(ADITG/SW1\)dfc2d762016-03-04 12:50:24 +0000235 prop = lyt->get_properties_of_layer(ivilayer);
236 iassert(prop->dest_x == 0);
237 iassert(prop->dest_y == 0);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900238
Ucan, Emre \(ADITG/SW1\)e62bfd82016-03-04 12:50:46 +0000239 iassert(lyt->layer_set_destination_rectangle(ivilayer, 20, 30,
240 prop->dest_width, prop->dest_height) == IVI_SUCCEEDED);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900241
Ucan, Emre \(ADITG/SW1\)dfc2d762016-03-04 12:50:24 +0000242 iassert(prop->dest_x == 0);
243 iassert(prop->dest_y == 0);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900244
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000245 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900246
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000247 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900248 iassert(prop->dest_x == 20);
249 iassert(prop->dest_y == 30);
250
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000251 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900252}
253
254static void
255test_layer_destination_rectangle(struct test_context *ctx)
256{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000257 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900258 struct ivi_layout_layer *ivilayer;
259 const struct ivi_layout_layer_properties *prop;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900260
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000261 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900262 iassert(ivilayer != NULL);
263
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000264 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900265 iassert(prop->dest_width == 200);
266 iassert(prop->dest_height == 300);
267 iassert(prop->dest_x == 0);
268 iassert(prop->dest_y == 0);
269
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000270 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900271 ivilayer, 20, 30, 400, 600) == IVI_SUCCEEDED);
272
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000273 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900274 iassert(prop->dest_width == 200);
275 iassert(prop->dest_height == 300);
276 iassert(prop->dest_x == 0);
277 iassert(prop->dest_y == 0);
278
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000279 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900280
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900281 iassert(prop->dest_width == 400);
282 iassert(prop->dest_height == 600);
283 iassert(prop->dest_x == 20);
284 iassert(prop->dest_y == 30);
285
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000286 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900287}
288
289static void
290test_layer_source_rectangle(struct test_context *ctx)
291{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000292 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900293 struct ivi_layout_layer *ivilayer;
294 const struct ivi_layout_layer_properties *prop;
295
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000296 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900297 iassert(ivilayer != NULL);
298
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000299 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900300 iassert(prop->source_width == 200);
301 iassert(prop->source_height == 300);
302 iassert(prop->source_x == 0);
303 iassert(prop->source_y == 0);
304
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000305 iassert(lyt->layer_set_source_rectangle(
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900306 ivilayer, 20, 30, 400, 600) == IVI_SUCCEEDED);
307
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000308 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900309 iassert(prop->source_width == 200);
310 iassert(prop->source_height == 300);
311 iassert(prop->source_x == 0);
312 iassert(prop->source_y == 0);
313
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000314 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900315
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000316 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900317 iassert(prop->source_width == 400);
318 iassert(prop->source_height == 600);
319 iassert(prop->source_x == 20);
320 iassert(prop->source_y == 30);
321
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000322 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900323}
324
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900325static void
326test_layer_bad_remove(struct test_context *ctx)
327{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000328 const struct ivi_layout_interface *lyt = ctx->layout_interface;
329 lyt->layer_destroy(NULL);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900330}
331
332static void
333test_layer_bad_visibility(struct test_context *ctx)
334{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000335 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900336
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000337 iassert(lyt->layer_set_visibility(NULL, true) == IVI_FAILED);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900338
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000339 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900340}
341
342static void
343test_layer_bad_opacity(struct test_context *ctx)
344{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000345 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900346 struct ivi_layout_layer *ivilayer;
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000347 const struct ivi_layout_layer_properties *prop;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900348
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000349 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900350 iassert(ivilayer != NULL);
351
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000352 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900353 NULL, wl_fixed_from_double(0.3)) == IVI_FAILED);
354
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000355 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900356 ivilayer, wl_fixed_from_double(0.3)) == IVI_SUCCEEDED);
357
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000358 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900359 ivilayer, wl_fixed_from_double(-1)) == IVI_FAILED);
360
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000361 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900362
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000363 prop = lyt->get_properties_of_layer(ivilayer);
364 iassert(prop->opacity == wl_fixed_from_double(0.3));
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900365
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000366 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900367 ivilayer, wl_fixed_from_double(1.1)) == IVI_FAILED);
368
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000369 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900370
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000371 iassert(prop->opacity == wl_fixed_from_double(0.3));
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900372
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000373 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900374 NULL, wl_fixed_from_double(0.5)) == IVI_FAILED);
375
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000376 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900377
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000378 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900379}
380
381static void
382test_layer_bad_destination_rectangle(struct test_context *ctx)
383{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000384 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900385
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000386 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900387 NULL, 20, 30, 200, 300) == IVI_FAILED);
388}
389
390static void
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900391test_layer_bad_source_rectangle(struct test_context *ctx)
392{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000393 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900394
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000395 iassert(lyt->layer_set_source_rectangle(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900396 NULL, 20, 30, 200, 300) == IVI_FAILED);
397}
398
399static void
400test_layer_bad_properties(struct test_context *ctx)
401{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000402 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900403
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000404 iassert(lyt->get_properties_of_layer(NULL) == NULL);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900405}
406
407static void
408test_commit_changes_after_visibility_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_visibility(ivilayer, true) == IVI_SUCCEEDED);
417 lyt->layer_destroy(ivilayer);
418 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900419}
420
421static void
422test_commit_changes_after_opacity_set_layer_destroy(struct test_context *ctx)
423{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000424 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900425 struct ivi_layout_layer *ivilayer;
426
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000427 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900428 iassert(ivilayer != NULL);
429
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000430 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900431 ivilayer, wl_fixed_from_double(0.5)) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000432 lyt->layer_destroy(ivilayer);
433 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900434}
435
436static void
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900437test_commit_changes_after_source_rectangle_set_layer_destroy(struct test_context *ctx)
438{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000439 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900440 struct ivi_layout_layer *ivilayer;
441
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000442 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900443 iassert(ivilayer != NULL);
444
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000445 iassert(lyt->layer_set_source_rectangle(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900446 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000447 lyt->layer_destroy(ivilayer);
448 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900449}
450
451static void
452test_commit_changes_after_destination_rectangle_set_layer_destroy(struct test_context *ctx)
453{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000454 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900455 struct ivi_layout_layer *ivilayer;
456
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000457 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900458 iassert(ivilayer != NULL);
459
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000460 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900461 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000462 lyt->layer_destroy(ivilayer);
463 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900464}
465
466static void
467test_layer_create_duplicate(struct test_context *ctx)
468{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000469 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900470 struct ivi_layout_layer *ivilayer;
471 struct ivi_layout_layer *duplicatelayer;
472
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000473 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900474 iassert(ivilayer != NULL);
475
476 if (ivilayer != NULL)
477 iassert(ivilayer->ref_count == 1);
478
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000479 duplicatelayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900480 iassert(ivilayer == duplicatelayer);
481
482 if (ivilayer != NULL)
483 iassert(ivilayer->ref_count == 2);
484
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000485 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900486
487 if (ivilayer != NULL)
488 iassert(ivilayer->ref_count == 1);
489
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000490 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900491}
492
493static void
Dongjin Kimba89f002024-09-30 17:49:36 +0900494test_get_layer_after_destroy_layer(struct test_context *ctx)
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900495{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000496 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900497 struct ivi_layout_layer *ivilayer;
498
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000499 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900500 iassert(ivilayer != NULL);
501
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000502 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900503
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000504 ivilayer = lyt->get_layer_from_id(IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900505 iassert(ivilayer == NULL);
506}
507
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900508static void
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900509test_screen_render_order(struct test_context *ctx)
510{
511#define LAYER_NUM (3)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000512 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000513 struct weston_output *output;
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900514 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
515 struct ivi_layout_layer **array;
516 int32_t length = 0;
517 uint32_t i;
518
Pekka Paalanend05a8192017-08-17 13:30:11 +0300519 if (!iassert(!wl_list_empty(&ctx->compositor->output_list)))
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900520 return;
521
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000522 output = wl_container_of(ctx->compositor->output_list.next, output, link);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900523
524 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000525 ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900526
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000527 iassert(lyt->screen_set_render_order(output, ivilayers, LAYER_NUM) == 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 == LAYER_NUM);
533 for (i = 0; i < LAYER_NUM; i++)
534 iassert(array[i] == ivilayers[i]);
535
536 if (length > 0)
537 free(array);
538
539 array = NULL;
540
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000541 iassert(lyt->screen_set_render_order(output, NULL, 0) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900542
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000543 lyt->commit_changes();
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900544
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000545 iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900546 iassert(length == 0 && array == NULL);
547
548 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000549 lyt->layer_destroy(ivilayers[i]);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900550
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900551#undef LAYER_NUM
552}
553
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900554static void
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900555test_screen_bad_render_order(struct test_context *ctx)
556{
557#define LAYER_NUM (3)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000558 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000559 struct weston_output *output;
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900560 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
561 struct ivi_layout_layer **array;
562 int32_t length = 0;
563 uint32_t i;
564
Pekka Paalanend05a8192017-08-17 13:30:11 +0300565 if (!iassert(!wl_list_empty(&ctx->compositor->output_list)))
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900566 return;
567
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000568 output = wl_container_of(ctx->compositor->output_list.next, output, link);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900569
570 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000571 ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900572
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000573 iassert(lyt->screen_set_render_order(NULL, ivilayers, LAYER_NUM) == IVI_FAILED);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900574
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000575 lyt->commit_changes();
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900576
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000577 iassert(lyt->get_layers_on_screen(NULL, &length, &array) == IVI_FAILED);
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000578 iassert(lyt->get_layers_on_screen(output, NULL, &array) == IVI_FAILED);
579 iassert(lyt->get_layers_on_screen(output, &length, NULL) == IVI_FAILED);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900580
581 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000582 lyt->layer_destroy(ivilayers[i]);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900583
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900584#undef LAYER_NUM
585}
586
587static void
Ucan, Emre (ADITG/SW1)fbce2f52017-01-18 15:25:36 +0000588test_screen_add_layers(struct test_context *ctx)
589{
590#define LAYER_NUM (3)
591 const struct ivi_layout_interface *lyt = ctx->layout_interface;
592 struct weston_output *output;
593 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
594 struct ivi_layout_layer **array;
595 int32_t length = 0;
596 uint32_t i;
597
Pekka Paalanend05a8192017-08-17 13:30:11 +0300598 if (!iassert(!wl_list_empty(&ctx->compositor->output_list)))
Ucan, Emre (ADITG/SW1)fbce2f52017-01-18 15:25:36 +0000599 return;
600
601 output = wl_container_of(ctx->compositor->output_list.next, output, link);
602
603 for (i = 0; i < LAYER_NUM; i++) {
604 ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
605 iassert(lyt->screen_add_layer(output, ivilayers[i]) == IVI_SUCCEEDED);
606 }
607
608 lyt->commit_changes();
609
610 iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
611 iassert(length == LAYER_NUM);
612 for (i = 0; i < (uint32_t)length; i++)
613 iassert(array[i] == ivilayers[i]);
614
615 if (length > 0)
616 free(array);
617
618 array = NULL;
619
620 iassert(lyt->screen_set_render_order(output, NULL, 0) == IVI_SUCCEEDED);
621 for (i = LAYER_NUM; i-- > 0;)
622 iassert(lyt->screen_add_layer(output, ivilayers[i]) == IVI_SUCCEEDED);
623
624 lyt->commit_changes();
625
626 iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
627 iassert(length == LAYER_NUM);
628 for (i = 0; i < (uint32_t)length; i++)
629 iassert(array[i] == ivilayers[LAYER_NUM - (i + 1)]);
630
631 if (length > 0)
632 free(array);
633
634 for (i = 0; i < LAYER_NUM; i++)
635 lyt->layer_destroy(ivilayers[i]);
636
637#undef LAYER_NUM
638}
639
640static void
Michael Teyfel156bd062017-07-26 14:22:49 +0200641test_screen_remove_layer(struct test_context *ctx)
642{
643 const struct ivi_layout_interface *lyt = ctx->layout_interface;
644 struct ivi_layout_layer *ivilayer;
645 struct weston_output *output;
646 struct ivi_layout_layer **array;
647 int32_t length = 0;
648
649 if (wl_list_empty(&ctx->compositor->output_list))
650 return;
651
652 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
653 iassert(ivilayer != NULL);
654
655 output = wl_container_of(ctx->compositor->output_list.next, output, link);
656
657 iassert(lyt->screen_add_layer(output, ivilayer) == IVI_SUCCEEDED);
658 lyt->commit_changes();
659
660 iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
661 iassert(length == 1);
662 iassert(array[0] == ivilayer);
663
664 iassert(lyt->screen_remove_layer(output, ivilayer) == IVI_SUCCEEDED);
665 lyt->commit_changes();
666
667 if (length > 0)
668 free(array);
669
670 array = NULL;
671
672 iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
673 iassert(length == 0);
674 iassert(array == NULL);
675
676 lyt->layer_destroy(ivilayer);
677}
678
679static void
680test_screen_bad_remove_layer(struct test_context *ctx)
681{
682 const struct ivi_layout_interface *lyt = ctx->layout_interface;
683 struct ivi_layout_layer *ivilayer;
684 struct weston_output *output;
685
686 if (wl_list_empty(&ctx->compositor->output_list))
687 return;
688
689 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
690 iassert(ivilayer != NULL);
691
692 output = wl_container_of(ctx->compositor->output_list.next, output, link);
693
694 iassert(lyt->screen_remove_layer(NULL, ivilayer) == IVI_FAILED);
695 lyt->commit_changes();
696
697 iassert(lyt->screen_remove_layer(output, NULL) == IVI_FAILED);
698 lyt->commit_changes();
699
700 iassert(lyt->screen_remove_layer(NULL, NULL) == IVI_FAILED);
701 lyt->commit_changes();
702
703 lyt->layer_destroy(ivilayer);
704}
705
706
707static void
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900708test_commit_changes_after_render_order_set_layer_destroy(
709 struct test_context *ctx)
710{
711#define LAYER_NUM (3)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000712 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000713 struct weston_output *output;
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900714 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
715 uint32_t i;
716
Pekka Paalanend05a8192017-08-17 13:30:11 +0300717 if (!iassert(!wl_list_empty(&ctx->compositor->output_list)))
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900718 return;
719
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000720 output = wl_container_of(ctx->compositor->output_list.next, output, link);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900721
722 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000723 ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900724
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000725 iassert(lyt->screen_set_render_order(output, ivilayers, LAYER_NUM) == IVI_SUCCEEDED);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900726
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000727 lyt->layer_destroy(ivilayers[1]);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900728
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000729 lyt->commit_changes();
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900730
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000731 lyt->layer_destroy(ivilayers[0]);
732 lyt->layer_destroy(ivilayers[2]);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900733#undef LAYER_NUM
734}
735
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900736static void
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000737test_layer_properties_changed_notification_callback(struct wl_listener *listener, void *data)
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900738{
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000739 struct test_context *ctx =
740 container_of(listener, struct test_context,
741 layer_property_changed);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000742 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000743 struct ivi_layout_layer *ivilayer = data;
744 const struct ivi_layout_layer_properties *prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900745
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000746 iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900747 iassert(prop->source_width == 200);
748 iassert(prop->source_height == 300);
749
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000750 if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900751 prop->source_width == 200 && prop->source_height == 300)
752 ctx->user_flags = 1;
753}
754
755static void
756test_layer_properties_changed_notification(struct test_context *ctx)
757{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000758 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900759 struct ivi_layout_layer *ivilayer;
760
761 ctx->user_flags = 0;
762
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000763 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900764
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000765 ctx->layer_property_changed.notify = test_layer_properties_changed_notification_callback;
766
767 iassert(lyt->layer_add_listener(ivilayer, &ctx->layer_property_changed) == IVI_SUCCEEDED);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900768
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000769 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900770
771 iassert(ctx->user_flags == 0);
772
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000773 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900774 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
775
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000776 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900777
778 iassert(ctx->user_flags == 1);
779
780 ctx->user_flags = 0;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000781 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900782 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
783
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000784 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900785
786 iassert(ctx->user_flags == 0);
787
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000788 // remove layer property changed listener.
789 wl_list_remove(&ctx->layer_property_changed.link);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900790
791 ctx->user_flags = 0;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000792 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900793
794 iassert(ctx->user_flags == 0);
795
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000796 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900797}
798
799static void
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +0000800test_layer_create_notification_callback(struct wl_listener *listener, void *data)
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900801{
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +0000802 struct test_context *ctx =
803 container_of(listener, struct test_context,
804 layer_created);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000805 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +0000806 struct ivi_layout_layer *ivilayer = data;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000807 const struct ivi_layout_layer_properties *prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900808
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000809 iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900810 iassert(prop->source_width == 200);
811 iassert(prop->source_height == 300);
812
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000813 if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900814 prop->source_width == 200 && prop->source_height == 300)
815 ctx->user_flags = 1;
816}
817
818static void
819test_layer_create_notification(struct test_context *ctx)
820{
821#define LAYER_NUM (2)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000822 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900823 static const uint32_t layers[LAYER_NUM] = {IVI_TEST_LAYER_ID(0), IVI_TEST_LAYER_ID(1)};
824 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
825
826 ctx->user_flags = 0;
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +0000827 ctx->layer_created.notify = test_layer_create_notification_callback;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900828
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +0000829 iassert(lyt->add_listener_create_layer(&ctx->layer_created) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000830 ivilayers[0] = lyt->layer_create_with_dimension(layers[0], 200, 300);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900831
832 iassert(ctx->user_flags == 1);
833
834 ctx->user_flags = 0;
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +0000835 // remove layer created listener.
836 wl_list_remove(&ctx->layer_created.link);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900837
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000838 ivilayers[1] = lyt->layer_create_with_dimension(layers[1], 400, 500);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900839
840 iassert(ctx->user_flags == 0);
841
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000842 lyt->layer_destroy(ivilayers[0]);
843 lyt->layer_destroy(ivilayers[1]);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900844#undef LAYER_NUM
845}
846
847static void
Ucan, Emre (ADITG/SW1)562f2ec2016-04-04 08:05:15 +0000848test_layer_remove_notification_callback(struct wl_listener *listener, void *data)
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900849{
Ucan, Emre (ADITG/SW1)562f2ec2016-04-04 08:05:15 +0000850 struct test_context *ctx =
851 container_of(listener, struct test_context,
852 layer_removed);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000853 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Ucan, Emre (ADITG/SW1)562f2ec2016-04-04 08:05:15 +0000854 struct ivi_layout_layer *ivilayer = data;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900855 const struct ivi_layout_layer_properties *prop =
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000856 lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900857
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000858 iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900859 iassert(prop->source_width == 200);
860 iassert(prop->source_height == 300);
861
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000862 if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900863 prop->source_width == 200 && prop->source_height == 300)
864 ctx->user_flags = 1;
865}
866
867static void
868test_layer_remove_notification(struct test_context *ctx)
869{
870#define LAYER_NUM (2)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000871 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900872 static const uint32_t layers[LAYER_NUM] = {IVI_TEST_LAYER_ID(0), IVI_TEST_LAYER_ID(1)};
873 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
874
875 ctx->user_flags = 0;
Ucan, Emre (ADITG/SW1)562f2ec2016-04-04 08:05:15 +0000876 ctx->layer_removed.notify = test_layer_remove_notification_callback;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900877
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000878 ivilayers[0] = lyt->layer_create_with_dimension(layers[0], 200, 300);
Ucan, Emre (ADITG/SW1)562f2ec2016-04-04 08:05:15 +0000879 iassert(lyt->add_listener_remove_layer(&ctx->layer_removed) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000880 lyt->layer_destroy(ivilayers[0]);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900881
882 iassert(ctx->user_flags == 1);
883
884 ctx->user_flags = 0;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000885 ivilayers[1] = lyt->layer_create_with_dimension(layers[1], 250, 350);
Ucan, Emre (ADITG/SW1)562f2ec2016-04-04 08:05:15 +0000886
887 // remove layer property changed listener.
888 wl_list_remove(&ctx->layer_removed.link);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000889 lyt->layer_destroy(ivilayers[1]);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900890
891 iassert(ctx->user_flags == 0);
892#undef LAYER_NUM
893}
894
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900895static void
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000896test_layer_bad_properties_changed_notification_callback(struct wl_listener *listener, void *data)
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900897{
898}
899
900static void
901test_layer_bad_properties_changed_notification(struct test_context *ctx)
902{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000903 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900904 struct ivi_layout_layer *ivilayer;
905
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000906 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900907
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000908 ctx->layer_property_changed.notify = test_layer_bad_properties_changed_notification_callback;
909
910 iassert(lyt->layer_add_listener(NULL, &ctx->layer_property_changed) == IVI_FAILED);
911 iassert(lyt->layer_add_listener(ivilayer, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900912
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000913 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900914}
915
916static void
917test_surface_bad_configure_notification(struct test_context *ctx)
918{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000919 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900920
Ucan, Emre (ADITG/SW1)c49aa5a2016-04-04 08:05:20 +0000921 iassert(lyt->add_listener_configure_surface(NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900922}
923
924static void
925test_layer_bad_create_notification(struct test_context *ctx)
926{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000927 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900928
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +0000929 iassert(lyt->add_listener_create_layer(NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900930}
931
932static void
933test_surface_bad_create_notification(struct test_context *ctx)
934{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000935 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900936
Ucan, Emre (ADITG/SW1)970f8312016-04-04 08:05:09 +0000937 iassert(lyt->add_listener_create_surface(NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900938}
939
940static void
941test_layer_bad_remove_notification(struct test_context *ctx)
942{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000943 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900944
Ucan, Emre (ADITG/SW1)562f2ec2016-04-04 08:05:15 +0000945 iassert(lyt->add_listener_remove_layer(NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900946}
947
948static void
949test_surface_bad_remove_notification(struct test_context *ctx)
950{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000951 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900952
Ucan, Emre (ADITG/SW1)67f0aa82016-04-04 08:05:18 +0000953 iassert(lyt->add_listener_remove_surface(NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900954}
955
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200956/************************ tests end ********************************/
957
958static void
Pekka Paalanenad1a4102019-11-11 16:28:28 +0200959run_internal_tests(struct test_context *ctx)
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200960{
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200961 test_surface_bad_visibility(ctx);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900962 test_surface_bad_destination_rectangle(ctx);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900963 test_surface_bad_source_rectangle(ctx);
964 test_surface_bad_properties(ctx);
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200965
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900966 test_layer_create(ctx);
967 test_layer_visibility(ctx);
968 test_layer_opacity(ctx);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900969 test_layer_dimension(ctx);
970 test_layer_position(ctx);
971 test_layer_destination_rectangle(ctx);
972 test_layer_source_rectangle(ctx);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900973 test_layer_bad_remove(ctx);
974 test_layer_bad_visibility(ctx);
975 test_layer_bad_opacity(ctx);
976 test_layer_bad_destination_rectangle(ctx);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900977 test_layer_bad_source_rectangle(ctx);
978 test_layer_bad_properties(ctx);
979 test_commit_changes_after_visibility_set_layer_destroy(ctx);
980 test_commit_changes_after_opacity_set_layer_destroy(ctx);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900981 test_commit_changes_after_source_rectangle_set_layer_destroy(ctx);
982 test_commit_changes_after_destination_rectangle_set_layer_destroy(ctx);
983 test_layer_create_duplicate(ctx);
Dongjin Kimba89f002024-09-30 17:49:36 +0900984 test_get_layer_after_destroy_layer(ctx);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900985
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900986 test_screen_render_order(ctx);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900987 test_screen_bad_render_order(ctx);
Ucan, Emre (ADITG/SW1)fbce2f52017-01-18 15:25:36 +0000988 test_screen_add_layers(ctx);
Michael Teyfel156bd062017-07-26 14:22:49 +0200989 test_screen_remove_layer(ctx);
990 test_screen_bad_remove_layer(ctx);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900991 test_commit_changes_after_render_order_set_layer_destroy(ctx);
992
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900993 test_layer_properties_changed_notification(ctx);
994 test_layer_create_notification(ctx);
995 test_layer_remove_notification(ctx);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900996 test_layer_bad_properties_changed_notification(ctx);
997 test_surface_bad_configure_notification(ctx);
998 test_layer_bad_create_notification(ctx);
999 test_surface_bad_create_notification(ctx);
1000 test_layer_bad_remove_notification(ctx);
1001 test_surface_bad_remove_notification(ctx);
Pekka Paalanen46804ca2015-03-27 11:55:21 +02001002}
1003
Pekka Paalanenad1a4102019-11-11 16:28:28 +02001004PLUGIN_TEST(ivi_layout_internal)
Pekka Paalanen46804ca2015-03-27 11:55:21 +02001005{
Pekka Paalanenad1a4102019-11-11 16:28:28 +02001006 /* struct weston_compositor *compositor; */
1007 struct test_context ctx = {};
Emre Ucan0707b0e2018-01-25 14:36:13 +01001008 const struct ivi_layout_interface *iface;
Pekka Paalanen46804ca2015-03-27 11:55:21 +02001009
Emre Ucan0707b0e2018-01-25 14:36:13 +01001010 iface = ivi_layout_get_api(compositor);
1011
1012 if (!iface) {
1013 weston_log("fatal: cannot use ivi_layout_interface.\n");
Pekka Paalanenad1a4102019-11-11 16:28:28 +02001014 weston_compositor_exit_with_code(compositor, RESULT_HARD_ERROR);
1015 return;
Pekka Paalanen46804ca2015-03-27 11:55:21 +02001016 }
1017
Pekka Paalanenad1a4102019-11-11 16:28:28 +02001018 ctx.compositor = compositor;
1019 ctx.layout_interface = iface;
Pekka Paalanen46804ca2015-03-27 11:55:21 +02001020
Pekka Paalanenad1a4102019-11-11 16:28:28 +02001021 run_internal_tests(&ctx);
Pekka Paalanen46804ca2015-03-27 11:55:21 +02001022}