blob: ca47b017f3aa8609fa3a09c243933e51d90bed15 [file] [log] [blame]
Pekka Paalanen46804ca2015-03-27 11:55:21 +02001/*
2 * Copyright © 2013 DENSO CORPORATION
3 * Copyright © 2015 Collabora, Ltd.
4 *
Bryce Harrington2cc92972015-06-11 15:39:40 -07005 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
Pekka Paalanen46804ca2015-03-27 11:55:21 +020012 *
Bryce Harrington2cc92972015-06-11 15:39:40 -070013 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
21 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
22 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 * SOFTWARE.
Pekka Paalanen46804ca2015-03-27 11:55:21 +020025 */
26
27#include "config.h"
28
29#include <unistd.h>
30#include <signal.h>
31#include <string.h>
32#include <stdbool.h>
33
Jon Cruz4678bab2015-06-15 15:37:07 -070034#include "src/compositor.h"
35#include "ivi-shell/ivi-layout-export.h"
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +090036#include "ivi-shell/ivi-layout-private.h"
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +090037#include "ivi-test.h"
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +000038#include "shared/helpers.h"
Pekka Paalanen46804ca2015-03-27 11:55:21 +020039
40struct test_context {
41 struct weston_compositor *compositor;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000042 const struct ivi_layout_interface *layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +090043 uint32_t user_flags;
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +000044
45 struct wl_listener layer_property_changed;
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +000046 struct wl_listener layer_created;
Pekka Paalanen46804ca2015-03-27 11:55:21 +020047};
48
49static void
50iassert_fail(const char *cond, const char *file, int line,
51 const char *func, struct test_context *ctx)
52{
53 weston_log("Assert failure in %s:%d, %s: '%s'\n",
54 file, line, func, cond);
55 weston_compositor_exit_with_code(ctx->compositor, EXIT_FAILURE);
56}
57
58#define iassert(cond) ({ \
59 bool b_ = (cond); \
60 if (!b_) \
61 iassert_fail(#cond, __FILE__, __LINE__, __func__, ctx); \
62 b_; \
63})
64
65/************************ tests begin ******************************/
66
67/*
68 * These are all internal ivi_layout API tests that do not require
69 * any client objects.
70 */
Pekka Paalanen46804ca2015-03-27 11:55:21 +020071static void
72test_surface_bad_visibility(struct test_context *ctx)
73{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000074 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Pekka Paalanen46804ca2015-03-27 11:55:21 +020075
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000076 iassert(lyt->surface_set_visibility(NULL, true) == IVI_FAILED);
Pekka Paalanen46804ca2015-03-27 11:55:21 +020077
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000078 lyt->commit_changes();
Pekka Paalanen46804ca2015-03-27 11:55:21 +020079}
80
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090081static void
82test_surface_bad_destination_rectangle(struct test_context *ctx)
83{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000084 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090085
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000086 iassert(lyt->surface_set_destination_rectangle(NULL, 20, 30, 200, 300) == IVI_FAILED);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090087}
88
89static void
90test_surface_bad_orientation(struct test_context *ctx)
91{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000092 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090093
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000094 iassert(lyt->surface_set_orientation(NULL, WL_OUTPUT_TRANSFORM_90) == IVI_FAILED);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090095}
96
97static void
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090098test_surface_bad_source_rectangle(struct test_context *ctx)
99{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000100 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900101
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000102 iassert(lyt->surface_set_source_rectangle(NULL, 20, 30, 200, 300) == IVI_FAILED);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900103}
104
105static void
106test_surface_bad_properties(struct test_context *ctx)
107{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000108 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900109
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000110 iassert(lyt->get_properties_of_surface(NULL) == NULL);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900111}
112
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900113static void
114test_layer_create(struct test_context *ctx)
115{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000116 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900117 uint32_t id1;
118 uint32_t id2;
119 struct ivi_layout_layer *ivilayer;
120 struct ivi_layout_layer *new_ivilayer;
121
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000122 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900123 iassert(ivilayer != NULL);
124
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000125 iassert(IVI_TEST_LAYER_ID(0) == lyt->get_id_of_layer(ivilayer));
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900126
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000127 new_ivilayer = lyt->get_layer_from_id(IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900128 iassert(ivilayer == new_ivilayer);
129
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000130 id1 = lyt->get_id_of_layer(ivilayer);
131 id2 = lyt->get_id_of_layer(new_ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900132 iassert(id1 == id2);
133
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000134 lyt->layer_destroy(ivilayer);
135 iassert(lyt->get_layer_from_id(IVI_TEST_LAYER_ID(0)) == NULL);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900136}
137
138static void
139test_layer_visibility(struct test_context *ctx)
140{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000141 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900142 struct ivi_layout_layer *ivilayer;
143 const struct ivi_layout_layer_properties *prop;
144
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000145 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900146 iassert(ivilayer != NULL);
147
Ucan, Emre \(ADITG/SW1\)17610f22016-03-04 12:50:07 +0000148 prop = lyt->get_properties_of_layer(ivilayer);
149
150 iassert(prop->visibility == false);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900151
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000152 iassert(lyt->layer_set_visibility(ivilayer, true) == IVI_SUCCEEDED);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900153
Ucan, Emre \(ADITG/SW1\)17610f22016-03-04 12:50:07 +0000154 iassert(prop->visibility == false);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900155
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000156 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900157
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900158 iassert(prop->visibility == true);
159
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000160 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900161}
162
163static void
164test_layer_opacity(struct test_context *ctx)
165{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000166 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900167 struct ivi_layout_layer *ivilayer;
168 const struct ivi_layout_layer_properties *prop;
169
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000170 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900171 iassert(ivilayer != NULL);
172
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000173 prop = lyt->get_properties_of_layer(ivilayer);
174 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 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900177 ivilayer, wl_fixed_from_double(0.5)) == IVI_SUCCEEDED);
178
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000179 iassert(prop->opacity == wl_fixed_from_double(1.0));
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900180
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000181 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900182
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900183 iassert(prop->opacity == wl_fixed_from_double(0.5));
184
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000185 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900186}
187
188static void
189test_layer_orientation(struct test_context *ctx)
190{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000191 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900192 struct ivi_layout_layer *ivilayer;
193 const struct ivi_layout_layer_properties *prop;
194
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000195 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900196 iassert(ivilayer != NULL);
197
Ucan, Emre \(ADITG/SW1\)5bb068d2016-03-04 12:50:39 +0000198 prop = lyt->get_properties_of_layer(ivilayer);
199 iassert(prop->orientation == WL_OUTPUT_TRANSFORM_NORMAL);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900200
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000201 iassert(lyt->layer_set_orientation(
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900202 ivilayer, WL_OUTPUT_TRANSFORM_90) == IVI_SUCCEEDED);
203
Ucan, Emre \(ADITG/SW1\)5bb068d2016-03-04 12:50:39 +0000204 iassert(prop->orientation == WL_OUTPUT_TRANSFORM_NORMAL);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900205
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000206 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900207
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900208 iassert(prop->orientation == WL_OUTPUT_TRANSFORM_90);
209
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000210 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900211}
212
213static void
214test_layer_dimension(struct test_context *ctx)
215{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000216 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900217 struct ivi_layout_layer *ivilayer;
218 const struct ivi_layout_layer_properties *prop;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900219
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000220 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900221 iassert(ivilayer != NULL);
222
Ucan, Emre \(ADITG/SW1\)18691f02016-03-04 12:50:32 +0000223 prop = lyt->get_properties_of_layer(ivilayer);
224 iassert(prop->dest_width == 200);
225 iassert(prop->dest_height == 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900226
Ucan, Emre \(ADITG/SW1\)16d1fa12016-03-04 12:50:52 +0000227 iassert(lyt->layer_set_destination_rectangle(ivilayer, prop->dest_x, prop->dest_y,
228 400, 600) == IVI_SUCCEEDED);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900229
Ucan, Emre \(ADITG/SW1\)18691f02016-03-04 12:50:32 +0000230 iassert(prop->dest_width == 200);
231 iassert(prop->dest_height == 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900232
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000233 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900234
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900235 iassert(prop->dest_width == 400);
236 iassert(prop->dest_height == 600);
237
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000238 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900239}
240
241static void
242test_layer_position(struct test_context *ctx)
243{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000244 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900245 struct ivi_layout_layer *ivilayer;
246 const struct ivi_layout_layer_properties *prop;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900247
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000248 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900249 iassert(ivilayer != NULL);
250
Ucan, Emre \(ADITG/SW1\)dfc2d762016-03-04 12:50:24 +0000251 prop = lyt->get_properties_of_layer(ivilayer);
252 iassert(prop->dest_x == 0);
253 iassert(prop->dest_y == 0);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900254
Ucan, Emre \(ADITG/SW1\)e62bfd82016-03-04 12:50:46 +0000255 iassert(lyt->layer_set_destination_rectangle(ivilayer, 20, 30,
256 prop->dest_width, prop->dest_height) == IVI_SUCCEEDED);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900257
Ucan, Emre \(ADITG/SW1\)dfc2d762016-03-04 12:50:24 +0000258 iassert(prop->dest_x == 0);
259 iassert(prop->dest_y == 0);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900260
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000261 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900262
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000263 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900264 iassert(prop->dest_x == 20);
265 iassert(prop->dest_y == 30);
266
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000267 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900268}
269
270static void
271test_layer_destination_rectangle(struct test_context *ctx)
272{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000273 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900274 struct ivi_layout_layer *ivilayer;
275 const struct ivi_layout_layer_properties *prop;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900276
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000277 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900278 iassert(ivilayer != NULL);
279
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000280 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900281 iassert(prop->dest_width == 200);
282 iassert(prop->dest_height == 300);
283 iassert(prop->dest_x == 0);
284 iassert(prop->dest_y == 0);
285
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000286 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900287 ivilayer, 20, 30, 400, 600) == IVI_SUCCEEDED);
288
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000289 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900290 iassert(prop->dest_width == 200);
291 iassert(prop->dest_height == 300);
292 iassert(prop->dest_x == 0);
293 iassert(prop->dest_y == 0);
294
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000295 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900296
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900297 iassert(prop->dest_width == 400);
298 iassert(prop->dest_height == 600);
299 iassert(prop->dest_x == 20);
300 iassert(prop->dest_y == 30);
301
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000302 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900303}
304
305static void
306test_layer_source_rectangle(struct test_context *ctx)
307{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000308 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900309 struct ivi_layout_layer *ivilayer;
310 const struct ivi_layout_layer_properties *prop;
311
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000312 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900313 iassert(ivilayer != NULL);
314
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000315 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900316 iassert(prop->source_width == 200);
317 iassert(prop->source_height == 300);
318 iassert(prop->source_x == 0);
319 iassert(prop->source_y == 0);
320
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000321 iassert(lyt->layer_set_source_rectangle(
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900322 ivilayer, 20, 30, 400, 600) == IVI_SUCCEEDED);
323
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000324 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900325 iassert(prop->source_width == 200);
326 iassert(prop->source_height == 300);
327 iassert(prop->source_x == 0);
328 iassert(prop->source_y == 0);
329
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000330 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900331
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000332 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900333 iassert(prop->source_width == 400);
334 iassert(prop->source_height == 600);
335 iassert(prop->source_x == 20);
336 iassert(prop->source_y == 30);
337
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000338 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900339}
340
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900341static void
342test_layer_bad_remove(struct test_context *ctx)
343{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000344 const struct ivi_layout_interface *lyt = ctx->layout_interface;
345 lyt->layer_destroy(NULL);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900346}
347
348static void
349test_layer_bad_visibility(struct test_context *ctx)
350{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000351 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900352
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000353 iassert(lyt->layer_set_visibility(NULL, true) == IVI_FAILED);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900354
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000355 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900356}
357
358static void
359test_layer_bad_opacity(struct test_context *ctx)
360{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000361 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900362 struct ivi_layout_layer *ivilayer;
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000363 const struct ivi_layout_layer_properties *prop;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900364
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000365 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900366 iassert(ivilayer != NULL);
367
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000368 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900369 NULL, wl_fixed_from_double(0.3)) == IVI_FAILED);
370
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000371 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900372 ivilayer, wl_fixed_from_double(0.3)) == IVI_SUCCEEDED);
373
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000374 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900375 ivilayer, wl_fixed_from_double(-1)) == IVI_FAILED);
376
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000377 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900378
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000379 prop = lyt->get_properties_of_layer(ivilayer);
380 iassert(prop->opacity == wl_fixed_from_double(0.3));
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900381
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000382 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900383 ivilayer, wl_fixed_from_double(1.1)) == IVI_FAILED);
384
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000385 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900386
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000387 iassert(prop->opacity == wl_fixed_from_double(0.3));
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900388
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000389 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900390 NULL, wl_fixed_from_double(0.5)) == IVI_FAILED);
391
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000392 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900393
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000394 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900395}
396
397static void
398test_layer_bad_destination_rectangle(struct test_context *ctx)
399{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000400 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900401
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000402 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900403 NULL, 20, 30, 200, 300) == IVI_FAILED);
404}
405
406static void
407test_layer_bad_orientation(struct test_context *ctx)
408{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000409 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900410
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000411 iassert(lyt->layer_set_orientation(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900412 NULL, WL_OUTPUT_TRANSFORM_90) == IVI_FAILED);
413
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000414 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900415}
416
417static void
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900418test_layer_bad_source_rectangle(struct test_context *ctx)
419{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000420 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900421
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000422 iassert(lyt->layer_set_source_rectangle(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900423 NULL, 20, 30, 200, 300) == IVI_FAILED);
424}
425
426static void
427test_layer_bad_properties(struct test_context *ctx)
428{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000429 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900430
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000431 iassert(lyt->get_properties_of_layer(NULL) == NULL);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900432}
433
434static void
435test_commit_changes_after_visibility_set_layer_destroy(struct test_context *ctx)
436{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000437 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900438 struct ivi_layout_layer *ivilayer;
439
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000440 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900441 iassert(ivilayer != NULL);
442
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000443 iassert(lyt->layer_set_visibility(ivilayer, true) == IVI_SUCCEEDED);
444 lyt->layer_destroy(ivilayer);
445 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900446}
447
448static void
449test_commit_changes_after_opacity_set_layer_destroy(struct test_context *ctx)
450{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000451 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900452 struct ivi_layout_layer *ivilayer;
453
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000454 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900455 iassert(ivilayer != NULL);
456
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000457 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900458 ivilayer, wl_fixed_from_double(0.5)) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000459 lyt->layer_destroy(ivilayer);
460 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900461}
462
463static void
464test_commit_changes_after_orientation_set_layer_destroy(struct test_context *ctx)
465{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000466 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900467 struct ivi_layout_layer *ivilayer;
468
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000469 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900470 iassert(ivilayer != NULL);
471
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000472 iassert(lyt->layer_set_orientation(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900473 ivilayer, WL_OUTPUT_TRANSFORM_90) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000474 lyt->layer_destroy(ivilayer);
475 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900476}
477
478static void
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900479test_commit_changes_after_source_rectangle_set_layer_destroy(struct test_context *ctx)
480{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000481 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900482 struct ivi_layout_layer *ivilayer;
483
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000484 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900485 iassert(ivilayer != NULL);
486
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000487 iassert(lyt->layer_set_source_rectangle(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900488 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000489 lyt->layer_destroy(ivilayer);
490 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900491}
492
493static void
494test_commit_changes_after_destination_rectangle_set_layer_destroy(struct test_context *ctx)
495{
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 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900503 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000504 lyt->layer_destroy(ivilayer);
505 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900506}
507
508static void
509test_layer_create_duplicate(struct test_context *ctx)
510{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000511 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900512 struct ivi_layout_layer *ivilayer;
513 struct ivi_layout_layer *duplicatelayer;
514
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000515 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900516 iassert(ivilayer != NULL);
517
518 if (ivilayer != NULL)
519 iassert(ivilayer->ref_count == 1);
520
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000521 duplicatelayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900522 iassert(ivilayer == duplicatelayer);
523
524 if (ivilayer != NULL)
525 iassert(ivilayer->ref_count == 2);
526
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000527 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900528
529 if (ivilayer != NULL)
530 iassert(ivilayer->ref_count == 1);
531
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000532 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900533}
534
535static void
536test_get_layer_after_destory_layer(struct test_context *ctx)
537{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000538 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900539 struct ivi_layout_layer *ivilayer;
540
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000541 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900542 iassert(ivilayer != NULL);
543
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000544 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900545
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000546 ivilayer = lyt->get_layer_from_id(IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900547 iassert(ivilayer == NULL);
548}
549
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900550static void
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900551test_screen_render_order(struct test_context *ctx)
552{
553#define LAYER_NUM (3)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000554 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000555 struct weston_output *output;
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900556 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
557 struct ivi_layout_layer **array;
558 int32_t length = 0;
559 uint32_t i;
560
Ucan, Emre (ADITG/SW1)3a8521e2016-03-17 15:30:39 +0000561 if (wl_list_empty(&ctx->compositor->output_list))
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900562 return;
563
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000564 output = wl_container_of(ctx->compositor->output_list.next, output, link);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900565
566 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000567 ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900568
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000569 iassert(lyt->screen_set_render_order(output, ivilayers, LAYER_NUM) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900570
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000571 lyt->commit_changes();
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900572
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000573 iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900574 iassert(length == LAYER_NUM);
575 for (i = 0; i < LAYER_NUM; i++)
576 iassert(array[i] == ivilayers[i]);
577
578 if (length > 0)
579 free(array);
580
581 array = NULL;
582
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000583 iassert(lyt->screen_set_render_order(output, NULL, 0) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900584
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000585 lyt->commit_changes();
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900586
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000587 iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900588 iassert(length == 0 && array == NULL);
589
590 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000591 lyt->layer_destroy(ivilayers[i]);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900592
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900593#undef LAYER_NUM
594}
595
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900596static void
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900597test_screen_bad_render_order(struct test_context *ctx)
598{
599#define LAYER_NUM (3)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000600 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000601 struct weston_output *output;
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900602 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
603 struct ivi_layout_layer **array;
604 int32_t length = 0;
605 uint32_t i;
606
Ucan, Emre (ADITG/SW1)3a8521e2016-03-17 15:30:39 +0000607 if (wl_list_empty(&ctx->compositor->output_list))
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900608 return;
609
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000610 output = wl_container_of(ctx->compositor->output_list.next, output, link);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900611
612 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000613 ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900614
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000615 iassert(lyt->screen_set_render_order(NULL, ivilayers, LAYER_NUM) == IVI_FAILED);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900616
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000617 lyt->commit_changes();
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900618
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000619 iassert(lyt->get_layers_on_screen(NULL, &length, &array) == IVI_FAILED);
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000620 iassert(lyt->get_layers_on_screen(output, NULL, &array) == IVI_FAILED);
621 iassert(lyt->get_layers_on_screen(output, &length, NULL) == IVI_FAILED);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900622
623 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000624 lyt->layer_destroy(ivilayers[i]);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900625
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900626#undef LAYER_NUM
627}
628
629static void
630test_commit_changes_after_render_order_set_layer_destroy(
631 struct test_context *ctx)
632{
633#define LAYER_NUM (3)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000634 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000635 struct weston_output *output;
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900636 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
637 uint32_t i;
638
Ucan, Emre (ADITG/SW1)3a8521e2016-03-17 15:30:39 +0000639 if (wl_list_empty(&ctx->compositor->output_list))
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900640 return;
641
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000642 output = wl_container_of(ctx->compositor->output_list.next, output, link);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900643
644 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000645 ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900646
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000647 iassert(lyt->screen_set_render_order(output, ivilayers, LAYER_NUM) == IVI_SUCCEEDED);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900648
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000649 lyt->layer_destroy(ivilayers[1]);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900650
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000651 lyt->commit_changes();
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900652
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000653 lyt->layer_destroy(ivilayers[0]);
654 lyt->layer_destroy(ivilayers[2]);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900655#undef LAYER_NUM
656}
657
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900658static void
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000659test_layer_properties_changed_notification_callback(struct wl_listener *listener, void *data)
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900660{
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000661 struct test_context *ctx =
662 container_of(listener, struct test_context,
663 layer_property_changed);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000664 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000665 struct ivi_layout_layer *ivilayer = data;
666 const struct ivi_layout_layer_properties *prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900667
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000668 iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900669 iassert(prop->source_width == 200);
670 iassert(prop->source_height == 300);
671
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000672 if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900673 prop->source_width == 200 && prop->source_height == 300)
674 ctx->user_flags = 1;
675}
676
677static void
678test_layer_properties_changed_notification(struct test_context *ctx)
679{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000680 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900681 struct ivi_layout_layer *ivilayer;
682
683 ctx->user_flags = 0;
684
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000685 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900686
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000687 ctx->layer_property_changed.notify = test_layer_properties_changed_notification_callback;
688
689 iassert(lyt->layer_add_listener(ivilayer, &ctx->layer_property_changed) == IVI_SUCCEEDED);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900690
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000691 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900692
693 iassert(ctx->user_flags == 0);
694
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000695 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900696 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
697
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000698 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900699
700 iassert(ctx->user_flags == 1);
701
702 ctx->user_flags = 0;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000703 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900704 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
705
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000706 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900707
708 iassert(ctx->user_flags == 0);
709
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000710 // remove layer property changed listener.
711 wl_list_remove(&ctx->layer_property_changed.link);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900712
713 ctx->user_flags = 0;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000714 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900715
716 iassert(ctx->user_flags == 0);
717
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000718 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900719}
720
721static void
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +0000722test_layer_create_notification_callback(struct wl_listener *listener, void *data)
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900723{
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +0000724 struct test_context *ctx =
725 container_of(listener, struct test_context,
726 layer_created);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000727 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +0000728 struct ivi_layout_layer *ivilayer = data;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000729 const struct ivi_layout_layer_properties *prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900730
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000731 iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900732 iassert(prop->source_width == 200);
733 iassert(prop->source_height == 300);
734
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000735 if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900736 prop->source_width == 200 && prop->source_height == 300)
737 ctx->user_flags = 1;
738}
739
740static void
741test_layer_create_notification(struct test_context *ctx)
742{
743#define LAYER_NUM (2)
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 static const uint32_t layers[LAYER_NUM] = {IVI_TEST_LAYER_ID(0), IVI_TEST_LAYER_ID(1)};
746 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
747
748 ctx->user_flags = 0;
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +0000749 ctx->layer_created.notify = test_layer_create_notification_callback;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900750
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +0000751 iassert(lyt->add_listener_create_layer(&ctx->layer_created) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000752 ivilayers[0] = lyt->layer_create_with_dimension(layers[0], 200, 300);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900753
754 iassert(ctx->user_flags == 1);
755
756 ctx->user_flags = 0;
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +0000757 // remove layer created listener.
758 wl_list_remove(&ctx->layer_created.link);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900759
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000760 ivilayers[1] = lyt->layer_create_with_dimension(layers[1], 400, 500);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900761
762 iassert(ctx->user_flags == 0);
763
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000764 lyt->layer_destroy(ivilayers[0]);
765 lyt->layer_destroy(ivilayers[1]);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900766#undef LAYER_NUM
767}
768
769static void
770test_layer_remove_notification_callback(struct ivi_layout_layer *ivilayer,
771 void *userdata)
772{
773 struct test_context *ctx = userdata;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000774 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900775 const struct ivi_layout_layer_properties *prop =
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000776 lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900777
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000778 iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900779 iassert(prop->source_width == 200);
780 iassert(prop->source_height == 300);
781
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000782 if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900783 prop->source_width == 200 && prop->source_height == 300)
784 ctx->user_flags = 1;
785}
786
787static void
788test_layer_remove_notification(struct test_context *ctx)
789{
790#define LAYER_NUM (2)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000791 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900792 static const uint32_t layers[LAYER_NUM] = {IVI_TEST_LAYER_ID(0), IVI_TEST_LAYER_ID(1)};
793 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
794
795 ctx->user_flags = 0;
796
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000797 ivilayers[0] = lyt->layer_create_with_dimension(layers[0], 200, 300);
798 iassert(lyt->add_notification_remove_layer(
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900799 test_layer_remove_notification_callback, ctx) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000800 lyt->layer_destroy(ivilayers[0]);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900801
802 iassert(ctx->user_flags == 1);
803
804 ctx->user_flags = 0;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000805 ivilayers[1] = lyt->layer_create_with_dimension(layers[1], 250, 350);
806 lyt->remove_notification_remove_layer(test_layer_remove_notification_callback, ctx);
807 lyt->layer_destroy(ivilayers[1]);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900808
809 iassert(ctx->user_flags == 0);
810#undef LAYER_NUM
811}
812
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900813static void
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000814test_layer_bad_properties_changed_notification_callback(struct wl_listener *listener, void *data)
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900815{
816}
817
818static void
819test_layer_bad_properties_changed_notification(struct test_context *ctx)
820{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000821 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900822 struct ivi_layout_layer *ivilayer;
823
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000824 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900825
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000826 ctx->layer_property_changed.notify = test_layer_bad_properties_changed_notification_callback;
827
828 iassert(lyt->layer_add_listener(NULL, &ctx->layer_property_changed) == IVI_FAILED);
829 iassert(lyt->layer_add_listener(ivilayer, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900830
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000831 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900832}
833
834static void
835test_surface_bad_configure_notification(struct test_context *ctx)
836{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000837 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900838
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000839 iassert(lyt->add_notification_configure_surface(NULL, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900840}
841
842static void
843test_layer_bad_create_notification(struct test_context *ctx)
844{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000845 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900846
Ucan, Emre (ADITG/SW1)c98f2cf2016-04-04 08:05:12 +0000847 iassert(lyt->add_listener_create_layer(NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900848}
849
850static void
851test_surface_bad_create_notification(struct test_context *ctx)
852{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000853 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900854
Ucan, Emre (ADITG/SW1)970f8312016-04-04 08:05:09 +0000855 iassert(lyt->add_listener_create_surface(NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900856}
857
858static void
859test_layer_bad_remove_notification(struct test_context *ctx)
860{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000861 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900862
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000863 iassert(lyt->add_notification_remove_layer(NULL, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900864}
865
866static void
867test_surface_bad_remove_notification(struct test_context *ctx)
868{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000869 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900870
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000871 iassert(lyt->add_notification_remove_surface(NULL, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900872}
873
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200874/************************ tests end ********************************/
875
876static void
877run_internal_tests(void *data)
878{
879 struct test_context *ctx = data;
880
881 test_surface_bad_visibility(ctx);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900882 test_surface_bad_destination_rectangle(ctx);
883 test_surface_bad_orientation(ctx);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900884 test_surface_bad_source_rectangle(ctx);
885 test_surface_bad_properties(ctx);
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200886
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900887 test_layer_create(ctx);
888 test_layer_visibility(ctx);
889 test_layer_opacity(ctx);
890 test_layer_orientation(ctx);
891 test_layer_dimension(ctx);
892 test_layer_position(ctx);
893 test_layer_destination_rectangle(ctx);
894 test_layer_source_rectangle(ctx);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900895 test_layer_bad_remove(ctx);
896 test_layer_bad_visibility(ctx);
897 test_layer_bad_opacity(ctx);
898 test_layer_bad_destination_rectangle(ctx);
899 test_layer_bad_orientation(ctx);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900900 test_layer_bad_source_rectangle(ctx);
901 test_layer_bad_properties(ctx);
902 test_commit_changes_after_visibility_set_layer_destroy(ctx);
903 test_commit_changes_after_opacity_set_layer_destroy(ctx);
904 test_commit_changes_after_orientation_set_layer_destroy(ctx);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900905 test_commit_changes_after_source_rectangle_set_layer_destroy(ctx);
906 test_commit_changes_after_destination_rectangle_set_layer_destroy(ctx);
907 test_layer_create_duplicate(ctx);
908 test_get_layer_after_destory_layer(ctx);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900909
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900910 test_screen_render_order(ctx);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900911 test_screen_bad_render_order(ctx);
912 test_commit_changes_after_render_order_set_layer_destroy(ctx);
913
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900914 test_layer_properties_changed_notification(ctx);
915 test_layer_create_notification(ctx);
916 test_layer_remove_notification(ctx);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900917 test_layer_bad_properties_changed_notification(ctx);
918 test_surface_bad_configure_notification(ctx);
919 test_layer_bad_create_notification(ctx);
920 test_surface_bad_create_notification(ctx);
921 test_layer_bad_remove_notification(ctx);
922 test_surface_bad_remove_notification(ctx);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900923
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200924 weston_compositor_exit_with_code(ctx->compositor, EXIT_SUCCESS);
925 free(ctx);
926}
927
928int
929controller_module_init(struct weston_compositor *compositor,
930 int *argc, char *argv[],
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000931 const struct ivi_layout_interface *iface,
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200932 size_t iface_version);
933
934WL_EXPORT int
935controller_module_init(struct weston_compositor *compositor,
936 int *argc, char *argv[],
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000937 const struct ivi_layout_interface *iface,
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200938 size_t iface_version)
939{
940 struct wl_event_loop *loop;
941 struct test_context *ctx;
942
943 /* strict check, since this is an internal test module */
944 if (iface_version != sizeof(*iface)) {
945 weston_log("fatal: controller interface mismatch\n");
946 return -1;
947 }
948
949 ctx = zalloc(sizeof(*ctx));
950 if (!ctx)
951 return -1;
952
953 ctx->compositor = compositor;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000954 ctx->layout_interface = iface;
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200955
956 loop = wl_display_get_event_loop(compositor->wl_display);
957 wl_event_loop_add_idle(loop, run_internal_tests, ctx);
958
959 return 0;
960}