blob: db318ad2549b4a161477d3f21140fa480ca222d2 [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;
Pekka Paalanen46804ca2015-03-27 11:55:21 +020046};
47
48static void
49iassert_fail(const char *cond, const char *file, int line,
50 const char *func, struct test_context *ctx)
51{
52 weston_log("Assert failure in %s:%d, %s: '%s'\n",
53 file, line, func, cond);
54 weston_compositor_exit_with_code(ctx->compositor, EXIT_FAILURE);
55}
56
57#define iassert(cond) ({ \
58 bool b_ = (cond); \
59 if (!b_) \
60 iassert_fail(#cond, __FILE__, __LINE__, __func__, ctx); \
61 b_; \
62})
63
64/************************ tests begin ******************************/
65
66/*
67 * These are all internal ivi_layout API tests that do not require
68 * any client objects.
69 */
Pekka Paalanen46804ca2015-03-27 11:55:21 +020070static void
71test_surface_bad_visibility(struct test_context *ctx)
72{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000073 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Pekka Paalanen46804ca2015-03-27 11:55:21 +020074
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000075 iassert(lyt->surface_set_visibility(NULL, true) == IVI_FAILED);
Pekka Paalanen46804ca2015-03-27 11:55:21 +020076
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000077 lyt->commit_changes();
Pekka Paalanen46804ca2015-03-27 11:55:21 +020078}
79
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090080static void
81test_surface_bad_destination_rectangle(struct test_context *ctx)
82{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000083 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090084
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000085 iassert(lyt->surface_set_destination_rectangle(NULL, 20, 30, 200, 300) == IVI_FAILED);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090086}
87
88static void
89test_surface_bad_orientation(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;
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090092
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000093 iassert(lyt->surface_set_orientation(NULL, WL_OUTPUT_TRANSFORM_90) == IVI_FAILED);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090094}
95
96static void
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +090097test_surface_bad_source_rectangle(struct test_context *ctx)
98{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +000099 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900100
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000101 iassert(lyt->surface_set_source_rectangle(NULL, 20, 30, 200, 300) == IVI_FAILED);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900102}
103
104static void
105test_surface_bad_properties(struct test_context *ctx)
106{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000107 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900108
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000109 iassert(lyt->get_properties_of_surface(NULL) == NULL);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900110}
111
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900112static void
113test_layer_create(struct test_context *ctx)
114{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000115 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900116 uint32_t id1;
117 uint32_t id2;
118 struct ivi_layout_layer *ivilayer;
119 struct ivi_layout_layer *new_ivilayer;
120
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000121 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900122 iassert(ivilayer != NULL);
123
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000124 iassert(IVI_TEST_LAYER_ID(0) == lyt->get_id_of_layer(ivilayer));
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900125
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000126 new_ivilayer = lyt->get_layer_from_id(IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900127 iassert(ivilayer == new_ivilayer);
128
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000129 id1 = lyt->get_id_of_layer(ivilayer);
130 id2 = lyt->get_id_of_layer(new_ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900131 iassert(id1 == id2);
132
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000133 lyt->layer_destroy(ivilayer);
134 iassert(lyt->get_layer_from_id(IVI_TEST_LAYER_ID(0)) == NULL);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900135}
136
137static void
138test_layer_visibility(struct test_context *ctx)
139{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000140 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900141 struct ivi_layout_layer *ivilayer;
142 const struct ivi_layout_layer_properties *prop;
143
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000144 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900145 iassert(ivilayer != NULL);
146
Ucan, Emre \(ADITG/SW1\)17610f22016-03-04 12:50:07 +0000147 prop = lyt->get_properties_of_layer(ivilayer);
148
149 iassert(prop->visibility == false);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900150
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000151 iassert(lyt->layer_set_visibility(ivilayer, true) == IVI_SUCCEEDED);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900152
Ucan, Emre \(ADITG/SW1\)17610f22016-03-04 12:50:07 +0000153 iassert(prop->visibility == false);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900154
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000155 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900156
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900157 iassert(prop->visibility == true);
158
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000159 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900160}
161
162static void
163test_layer_opacity(struct test_context *ctx)
164{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000165 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900166 struct ivi_layout_layer *ivilayer;
167 const struct ivi_layout_layer_properties *prop;
168
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000169 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900170 iassert(ivilayer != NULL);
171
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000172 prop = lyt->get_properties_of_layer(ivilayer);
173 iassert(prop->opacity == wl_fixed_from_double(1.0));
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900174
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000175 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900176 ivilayer, wl_fixed_from_double(0.5)) == IVI_SUCCEEDED);
177
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000178 iassert(prop->opacity == wl_fixed_from_double(1.0));
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900179
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000180 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900181
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900182 iassert(prop->opacity == wl_fixed_from_double(0.5));
183
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000184 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900185}
186
187static void
188test_layer_orientation(struct test_context *ctx)
189{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000190 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900191 struct ivi_layout_layer *ivilayer;
192 const struct ivi_layout_layer_properties *prop;
193
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000194 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900195 iassert(ivilayer != NULL);
196
Ucan, Emre \(ADITG/SW1\)5bb068d2016-03-04 12:50:39 +0000197 prop = lyt->get_properties_of_layer(ivilayer);
198 iassert(prop->orientation == WL_OUTPUT_TRANSFORM_NORMAL);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900199
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000200 iassert(lyt->layer_set_orientation(
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900201 ivilayer, WL_OUTPUT_TRANSFORM_90) == IVI_SUCCEEDED);
202
Ucan, Emre \(ADITG/SW1\)5bb068d2016-03-04 12:50:39 +0000203 iassert(prop->orientation == WL_OUTPUT_TRANSFORM_NORMAL);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900204
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000205 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900206
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900207 iassert(prop->orientation == WL_OUTPUT_TRANSFORM_90);
208
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000209 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900210}
211
212static void
213test_layer_dimension(struct test_context *ctx)
214{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000215 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900216 struct ivi_layout_layer *ivilayer;
217 const struct ivi_layout_layer_properties *prop;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900218
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000219 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900220 iassert(ivilayer != NULL);
221
Ucan, Emre \(ADITG/SW1\)18691f02016-03-04 12:50:32 +0000222 prop = lyt->get_properties_of_layer(ivilayer);
223 iassert(prop->dest_width == 200);
224 iassert(prop->dest_height == 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900225
Ucan, Emre \(ADITG/SW1\)16d1fa12016-03-04 12:50:52 +0000226 iassert(lyt->layer_set_destination_rectangle(ivilayer, prop->dest_x, prop->dest_y,
227 400, 600) == IVI_SUCCEEDED);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900228
Ucan, Emre \(ADITG/SW1\)18691f02016-03-04 12:50:32 +0000229 iassert(prop->dest_width == 200);
230 iassert(prop->dest_height == 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900231
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000232 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900233
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900234 iassert(prop->dest_width == 400);
235 iassert(prop->dest_height == 600);
236
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000237 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900238}
239
240static void
241test_layer_position(struct test_context *ctx)
242{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000243 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900244 struct ivi_layout_layer *ivilayer;
245 const struct ivi_layout_layer_properties *prop;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900246
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000247 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900248 iassert(ivilayer != NULL);
249
Ucan, Emre \(ADITG/SW1\)dfc2d762016-03-04 12:50:24 +0000250 prop = lyt->get_properties_of_layer(ivilayer);
251 iassert(prop->dest_x == 0);
252 iassert(prop->dest_y == 0);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900253
Ucan, Emre \(ADITG/SW1\)e62bfd82016-03-04 12:50:46 +0000254 iassert(lyt->layer_set_destination_rectangle(ivilayer, 20, 30,
255 prop->dest_width, prop->dest_height) == IVI_SUCCEEDED);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900256
Ucan, Emre \(ADITG/SW1\)dfc2d762016-03-04 12:50:24 +0000257 iassert(prop->dest_x == 0);
258 iassert(prop->dest_y == 0);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900259
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000260 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900261
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000262 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900263 iassert(prop->dest_x == 20);
264 iassert(prop->dest_y == 30);
265
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000266 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900267}
268
269static void
270test_layer_destination_rectangle(struct test_context *ctx)
271{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000272 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900273 struct ivi_layout_layer *ivilayer;
274 const struct ivi_layout_layer_properties *prop;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900275
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000276 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900277 iassert(ivilayer != NULL);
278
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000279 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900280 iassert(prop->dest_width == 200);
281 iassert(prop->dest_height == 300);
282 iassert(prop->dest_x == 0);
283 iassert(prop->dest_y == 0);
284
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000285 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900286 ivilayer, 20, 30, 400, 600) == IVI_SUCCEEDED);
287
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000288 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900289 iassert(prop->dest_width == 200);
290 iassert(prop->dest_height == 300);
291 iassert(prop->dest_x == 0);
292 iassert(prop->dest_y == 0);
293
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000294 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900295
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900296 iassert(prop->dest_width == 400);
297 iassert(prop->dest_height == 600);
298 iassert(prop->dest_x == 20);
299 iassert(prop->dest_y == 30);
300
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000301 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900302}
303
304static void
305test_layer_source_rectangle(struct test_context *ctx)
306{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000307 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900308 struct ivi_layout_layer *ivilayer;
309 const struct ivi_layout_layer_properties *prop;
310
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000311 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900312 iassert(ivilayer != NULL);
313
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000314 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900315 iassert(prop->source_width == 200);
316 iassert(prop->source_height == 300);
317 iassert(prop->source_x == 0);
318 iassert(prop->source_y == 0);
319
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000320 iassert(lyt->layer_set_source_rectangle(
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900321 ivilayer, 20, 30, 400, 600) == IVI_SUCCEEDED);
322
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000323 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900324 iassert(prop->source_width == 200);
325 iassert(prop->source_height == 300);
326 iassert(prop->source_x == 0);
327 iassert(prop->source_y == 0);
328
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000329 lyt->commit_changes();
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900330
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000331 prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900332 iassert(prop->source_width == 400);
333 iassert(prop->source_height == 600);
334 iassert(prop->source_x == 20);
335 iassert(prop->source_y == 30);
336
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000337 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900338}
339
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900340static void
341test_layer_bad_remove(struct test_context *ctx)
342{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000343 const struct ivi_layout_interface *lyt = ctx->layout_interface;
344 lyt->layer_destroy(NULL);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900345}
346
347static void
348test_layer_bad_visibility(struct test_context *ctx)
349{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000350 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900351
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000352 iassert(lyt->layer_set_visibility(NULL, true) == IVI_FAILED);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900353
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000354 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900355}
356
357static void
358test_layer_bad_opacity(struct test_context *ctx)
359{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000360 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900361 struct ivi_layout_layer *ivilayer;
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000362 const struct ivi_layout_layer_properties *prop;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900363
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000364 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900365 iassert(ivilayer != NULL);
366
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000367 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900368 NULL, wl_fixed_from_double(0.3)) == IVI_FAILED);
369
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000370 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900371 ivilayer, wl_fixed_from_double(0.3)) == IVI_SUCCEEDED);
372
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000373 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900374 ivilayer, wl_fixed_from_double(-1)) == 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\)c3aee1f2016-03-04 12:50:16 +0000378 prop = lyt->get_properties_of_layer(ivilayer);
379 iassert(prop->opacity == wl_fixed_from_double(0.3));
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900380
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000381 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900382 ivilayer, wl_fixed_from_double(1.1)) == IVI_FAILED);
383
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000384 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900385
Ucan, Emre \(ADITG/SW1\)c3aee1f2016-03-04 12:50:16 +0000386 iassert(prop->opacity == wl_fixed_from_double(0.3));
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900387
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000388 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900389 NULL, wl_fixed_from_double(0.5)) == IVI_FAILED);
390
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000391 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900392
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000393 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900394}
395
396static void
397test_layer_bad_destination_rectangle(struct test_context *ctx)
398{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000399 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900400
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000401 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900402 NULL, 20, 30, 200, 300) == IVI_FAILED);
403}
404
405static void
406test_layer_bad_orientation(struct test_context *ctx)
407{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000408 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900409
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000410 iassert(lyt->layer_set_orientation(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900411 NULL, WL_OUTPUT_TRANSFORM_90) == IVI_FAILED);
412
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000413 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900414}
415
416static void
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900417test_layer_bad_source_rectangle(struct test_context *ctx)
418{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000419 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900420
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000421 iassert(lyt->layer_set_source_rectangle(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900422 NULL, 20, 30, 200, 300) == IVI_FAILED);
423}
424
425static void
426test_layer_bad_properties(struct test_context *ctx)
427{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000428 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900429
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000430 iassert(lyt->get_properties_of_layer(NULL) == NULL);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900431}
432
433static void
434test_commit_changes_after_visibility_set_layer_destroy(struct test_context *ctx)
435{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000436 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900437 struct ivi_layout_layer *ivilayer;
438
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000439 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900440 iassert(ivilayer != NULL);
441
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000442 iassert(lyt->layer_set_visibility(ivilayer, true) == IVI_SUCCEEDED);
443 lyt->layer_destroy(ivilayer);
444 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900445}
446
447static void
448test_commit_changes_after_opacity_set_layer_destroy(struct test_context *ctx)
449{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000450 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900451 struct ivi_layout_layer *ivilayer;
452
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000453 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900454 iassert(ivilayer != NULL);
455
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000456 iassert(lyt->layer_set_opacity(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900457 ivilayer, wl_fixed_from_double(0.5)) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000458 lyt->layer_destroy(ivilayer);
459 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900460}
461
462static void
463test_commit_changes_after_orientation_set_layer_destroy(struct test_context *ctx)
464{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000465 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900466 struct ivi_layout_layer *ivilayer;
467
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000468 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900469 iassert(ivilayer != NULL);
470
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000471 iassert(lyt->layer_set_orientation(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900472 ivilayer, WL_OUTPUT_TRANSFORM_90) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000473 lyt->layer_destroy(ivilayer);
474 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900475}
476
477static void
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900478test_commit_changes_after_source_rectangle_set_layer_destroy(struct test_context *ctx)
479{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000480 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900481 struct ivi_layout_layer *ivilayer;
482
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000483 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900484 iassert(ivilayer != NULL);
485
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000486 iassert(lyt->layer_set_source_rectangle(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900487 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000488 lyt->layer_destroy(ivilayer);
489 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900490}
491
492static void
493test_commit_changes_after_destination_rectangle_set_layer_destroy(struct test_context *ctx)
494{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000495 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900496 struct ivi_layout_layer *ivilayer;
497
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000498 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900499 iassert(ivilayer != NULL);
500
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000501 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900502 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000503 lyt->layer_destroy(ivilayer);
504 lyt->commit_changes();
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900505}
506
507static void
508test_layer_create_duplicate(struct test_context *ctx)
509{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000510 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900511 struct ivi_layout_layer *ivilayer;
512 struct ivi_layout_layer *duplicatelayer;
513
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000514 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900515 iassert(ivilayer != NULL);
516
517 if (ivilayer != NULL)
518 iassert(ivilayer->ref_count == 1);
519
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000520 duplicatelayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900521 iassert(ivilayer == duplicatelayer);
522
523 if (ivilayer != NULL)
524 iassert(ivilayer->ref_count == 2);
525
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000526 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900527
528 if (ivilayer != NULL)
529 iassert(ivilayer->ref_count == 1);
530
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000531 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900532}
533
534static void
535test_get_layer_after_destory_layer(struct test_context *ctx)
536{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000537 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900538 struct ivi_layout_layer *ivilayer;
539
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000540 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900541 iassert(ivilayer != NULL);
542
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000543 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900544
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000545 ivilayer = lyt->get_layer_from_id(IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900546 iassert(ivilayer == NULL);
547}
548
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900549static void
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900550test_screen_render_order(struct test_context *ctx)
551{
552#define LAYER_NUM (3)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000553 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000554 struct weston_output *output;
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900555 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
556 struct ivi_layout_layer **array;
557 int32_t length = 0;
558 uint32_t i;
559
Ucan, Emre (ADITG/SW1)3a8521e2016-03-17 15:30:39 +0000560 if (wl_list_empty(&ctx->compositor->output_list))
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900561 return;
562
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000563 output = wl_container_of(ctx->compositor->output_list.next, output, link);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900564
565 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000566 ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900567
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000568 iassert(lyt->screen_set_render_order(output, ivilayers, LAYER_NUM) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900569
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000570 lyt->commit_changes();
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900571
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000572 iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900573 iassert(length == LAYER_NUM);
574 for (i = 0; i < LAYER_NUM; i++)
575 iassert(array[i] == ivilayers[i]);
576
577 if (length > 0)
578 free(array);
579
580 array = NULL;
581
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000582 iassert(lyt->screen_set_render_order(output, NULL, 0) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900583
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000584 lyt->commit_changes();
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900585
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000586 iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900587 iassert(length == 0 && array == NULL);
588
589 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000590 lyt->layer_destroy(ivilayers[i]);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900591
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900592#undef LAYER_NUM
593}
594
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900595static void
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900596test_screen_bad_render_order(struct test_context *ctx)
597{
598#define LAYER_NUM (3)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000599 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000600 struct weston_output *output;
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900601 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
602 struct ivi_layout_layer **array;
603 int32_t length = 0;
604 uint32_t i;
605
Ucan, Emre (ADITG/SW1)3a8521e2016-03-17 15:30:39 +0000606 if (wl_list_empty(&ctx->compositor->output_list))
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900607 return;
608
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000609 output = wl_container_of(ctx->compositor->output_list.next, output, link);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900610
611 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000612 ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900613
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000614 iassert(lyt->screen_set_render_order(NULL, ivilayers, LAYER_NUM) == IVI_FAILED);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900615
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000616 lyt->commit_changes();
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900617
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000618 iassert(lyt->get_layers_on_screen(NULL, &length, &array) == IVI_FAILED);
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000619 iassert(lyt->get_layers_on_screen(output, NULL, &array) == IVI_FAILED);
620 iassert(lyt->get_layers_on_screen(output, &length, NULL) == IVI_FAILED);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900621
622 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000623 lyt->layer_destroy(ivilayers[i]);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900624
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900625#undef LAYER_NUM
626}
627
628static void
629test_commit_changes_after_render_order_set_layer_destroy(
630 struct test_context *ctx)
631{
632#define LAYER_NUM (3)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000633 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000634 struct weston_output *output;
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900635 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
636 uint32_t i;
637
Ucan, Emre (ADITG/SW1)3a8521e2016-03-17 15:30:39 +0000638 if (wl_list_empty(&ctx->compositor->output_list))
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900639 return;
640
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000641 output = wl_container_of(ctx->compositor->output_list.next, output, link);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900642
643 for (i = 0; i < LAYER_NUM; i++)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000644 ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900645
Ucan, Emre (ADITG/SW1)273874e2016-03-17 15:30:42 +0000646 iassert(lyt->screen_set_render_order(output, ivilayers, LAYER_NUM) == IVI_SUCCEEDED);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900647
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000648 lyt->layer_destroy(ivilayers[1]);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900649
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000650 lyt->commit_changes();
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900651
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000652 lyt->layer_destroy(ivilayers[0]);
653 lyt->layer_destroy(ivilayers[2]);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900654#undef LAYER_NUM
655}
656
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900657static void
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000658test_layer_properties_changed_notification_callback(struct wl_listener *listener, void *data)
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900659{
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000660 struct test_context *ctx =
661 container_of(listener, struct test_context,
662 layer_property_changed);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000663 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000664 struct ivi_layout_layer *ivilayer = data;
665 const struct ivi_layout_layer_properties *prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900666
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000667 iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900668 iassert(prop->source_width == 200);
669 iassert(prop->source_height == 300);
670
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000671 if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900672 prop->source_width == 200 && prop->source_height == 300)
673 ctx->user_flags = 1;
674}
675
676static void
677test_layer_properties_changed_notification(struct test_context *ctx)
678{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000679 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900680 struct ivi_layout_layer *ivilayer;
681
682 ctx->user_flags = 0;
683
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000684 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900685
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000686 ctx->layer_property_changed.notify = test_layer_properties_changed_notification_callback;
687
688 iassert(lyt->layer_add_listener(ivilayer, &ctx->layer_property_changed) == IVI_SUCCEEDED);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900689
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000690 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900691
692 iassert(ctx->user_flags == 0);
693
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000694 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900695 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
696
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000697 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900698
699 iassert(ctx->user_flags == 1);
700
701 ctx->user_flags = 0;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000702 iassert(lyt->layer_set_destination_rectangle(
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900703 ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
704
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000705 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900706
707 iassert(ctx->user_flags == 0);
708
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000709 // remove layer property changed listener.
710 wl_list_remove(&ctx->layer_property_changed.link);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900711
712 ctx->user_flags = 0;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000713 lyt->commit_changes();
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900714
715 iassert(ctx->user_flags == 0);
716
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000717 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900718}
719
720static void
721test_layer_create_notification_callback(struct ivi_layout_layer *ivilayer,
722 void *userdata)
723{
724 struct test_context *ctx = userdata;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000725 const struct ivi_layout_interface *lyt = ctx->layout_interface;
726 const struct ivi_layout_layer_properties *prop = lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900727
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000728 iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900729 iassert(prop->source_width == 200);
730 iassert(prop->source_height == 300);
731
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000732 if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900733 prop->source_width == 200 && prop->source_height == 300)
734 ctx->user_flags = 1;
735}
736
737static void
738test_layer_create_notification(struct test_context *ctx)
739{
740#define LAYER_NUM (2)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000741 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900742 static const uint32_t layers[LAYER_NUM] = {IVI_TEST_LAYER_ID(0), IVI_TEST_LAYER_ID(1)};
743 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
744
745 ctx->user_flags = 0;
746
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000747 iassert(lyt->add_notification_create_layer(
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900748 test_layer_create_notification_callback, ctx) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000749 ivilayers[0] = lyt->layer_create_with_dimension(layers[0], 200, 300);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900750
751 iassert(ctx->user_flags == 1);
752
753 ctx->user_flags = 0;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000754 lyt->remove_notification_create_layer(test_layer_create_notification_callback, ctx);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900755
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000756 ivilayers[1] = lyt->layer_create_with_dimension(layers[1], 400, 500);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900757
758 iassert(ctx->user_flags == 0);
759
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000760 lyt->layer_destroy(ivilayers[0]);
761 lyt->layer_destroy(ivilayers[1]);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900762#undef LAYER_NUM
763}
764
765static void
766test_layer_remove_notification_callback(struct ivi_layout_layer *ivilayer,
767 void *userdata)
768{
769 struct test_context *ctx = userdata;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000770 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900771 const struct ivi_layout_layer_properties *prop =
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000772 lyt->get_properties_of_layer(ivilayer);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900773
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000774 iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900775 iassert(prop->source_width == 200);
776 iassert(prop->source_height == 300);
777
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000778 if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900779 prop->source_width == 200 && prop->source_height == 300)
780 ctx->user_flags = 1;
781}
782
783static void
784test_layer_remove_notification(struct test_context *ctx)
785{
786#define LAYER_NUM (2)
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000787 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900788 static const uint32_t layers[LAYER_NUM] = {IVI_TEST_LAYER_ID(0), IVI_TEST_LAYER_ID(1)};
789 struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
790
791 ctx->user_flags = 0;
792
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000793 ivilayers[0] = lyt->layer_create_with_dimension(layers[0], 200, 300);
794 iassert(lyt->add_notification_remove_layer(
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900795 test_layer_remove_notification_callback, ctx) == IVI_SUCCEEDED);
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000796 lyt->layer_destroy(ivilayers[0]);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900797
798 iassert(ctx->user_flags == 1);
799
800 ctx->user_flags = 0;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000801 ivilayers[1] = lyt->layer_create_with_dimension(layers[1], 250, 350);
802 lyt->remove_notification_remove_layer(test_layer_remove_notification_callback, ctx);
803 lyt->layer_destroy(ivilayers[1]);
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900804
805 iassert(ctx->user_flags == 0);
806#undef LAYER_NUM
807}
808
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900809static void
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000810test_layer_bad_properties_changed_notification_callback(struct wl_listener *listener, void *data)
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900811{
812}
813
814static void
815test_layer_bad_properties_changed_notification(struct test_context *ctx)
816{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000817 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900818 struct ivi_layout_layer *ivilayer;
819
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000820 ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900821
Ucan, Emre (ADITG/SW1)3750d1b2016-04-04 08:05:05 +0000822 ctx->layer_property_changed.notify = test_layer_bad_properties_changed_notification_callback;
823
824 iassert(lyt->layer_add_listener(NULL, &ctx->layer_property_changed) == IVI_FAILED);
825 iassert(lyt->layer_add_listener(ivilayer, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900826
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000827 lyt->layer_destroy(ivilayer);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900828}
829
830static void
831test_surface_bad_configure_notification(struct test_context *ctx)
832{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000833 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900834
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000835 iassert(lyt->add_notification_configure_surface(NULL, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900836}
837
838static void
839test_layer_bad_create_notification(struct test_context *ctx)
840{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000841 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900842
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000843 iassert(lyt->add_notification_create_layer(NULL, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900844}
845
846static void
847test_surface_bad_create_notification(struct test_context *ctx)
848{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000849 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900850
Ucan, Emre (ADITG/SW1)970f8312016-04-04 08:05:09 +0000851 iassert(lyt->add_listener_create_surface(NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900852}
853
854static void
855test_layer_bad_remove_notification(struct test_context *ctx)
856{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000857 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900858
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000859 iassert(lyt->add_notification_remove_layer(NULL, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900860}
861
862static void
863test_surface_bad_remove_notification(struct test_context *ctx)
864{
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000865 const struct ivi_layout_interface *lyt = ctx->layout_interface;
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900866
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000867 iassert(lyt->add_notification_remove_surface(NULL, NULL) == IVI_FAILED);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900868}
869
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200870/************************ tests end ********************************/
871
872static void
873run_internal_tests(void *data)
874{
875 struct test_context *ctx = data;
876
877 test_surface_bad_visibility(ctx);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900878 test_surface_bad_destination_rectangle(ctx);
879 test_surface_bad_orientation(ctx);
Nobuhiko Tanibata16ed5432015-06-22 15:33:59 +0900880 test_surface_bad_source_rectangle(ctx);
881 test_surface_bad_properties(ctx);
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200882
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900883 test_layer_create(ctx);
884 test_layer_visibility(ctx);
885 test_layer_opacity(ctx);
886 test_layer_orientation(ctx);
887 test_layer_dimension(ctx);
888 test_layer_position(ctx);
889 test_layer_destination_rectangle(ctx);
890 test_layer_source_rectangle(ctx);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900891 test_layer_bad_remove(ctx);
892 test_layer_bad_visibility(ctx);
893 test_layer_bad_opacity(ctx);
894 test_layer_bad_destination_rectangle(ctx);
895 test_layer_bad_orientation(ctx);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900896 test_layer_bad_source_rectangle(ctx);
897 test_layer_bad_properties(ctx);
898 test_commit_changes_after_visibility_set_layer_destroy(ctx);
899 test_commit_changes_after_opacity_set_layer_destroy(ctx);
900 test_commit_changes_after_orientation_set_layer_destroy(ctx);
Nobuhiko Tanibata17d44942015-06-22 15:35:12 +0900901 test_commit_changes_after_source_rectangle_set_layer_destroy(ctx);
902 test_commit_changes_after_destination_rectangle_set_layer_destroy(ctx);
903 test_layer_create_duplicate(ctx);
904 test_get_layer_after_destory_layer(ctx);
Nobuhiko Tanibata9e992d92015-06-22 15:34:18 +0900905
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900906 test_screen_render_order(ctx);
Nobuhiko Tanibata83c20bc2015-06-22 15:35:39 +0900907 test_screen_bad_render_order(ctx);
908 test_commit_changes_after_render_order_set_layer_destroy(ctx);
909
Nobuhiko Tanibata495c6ef2015-06-22 15:36:11 +0900910 test_layer_properties_changed_notification(ctx);
911 test_layer_create_notification(ctx);
912 test_layer_remove_notification(ctx);
Nobuhiko Tanibataffcc4522015-06-22 15:37:41 +0900913 test_layer_bad_properties_changed_notification(ctx);
914 test_surface_bad_configure_notification(ctx);
915 test_layer_bad_create_notification(ctx);
916 test_surface_bad_create_notification(ctx);
917 test_layer_bad_remove_notification(ctx);
918 test_surface_bad_remove_notification(ctx);
Nobuhiko Tanibatae78a7af2015-06-22 15:35:25 +0900919
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200920 weston_compositor_exit_with_code(ctx->compositor, EXIT_SUCCESS);
921 free(ctx);
922}
923
924int
925controller_module_init(struct weston_compositor *compositor,
926 int *argc, char *argv[],
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000927 const struct ivi_layout_interface *iface,
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200928 size_t iface_version);
929
930WL_EXPORT int
931controller_module_init(struct weston_compositor *compositor,
932 int *argc, char *argv[],
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000933 const struct ivi_layout_interface *iface,
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200934 size_t iface_version)
935{
936 struct wl_event_loop *loop;
937 struct test_context *ctx;
938
939 /* strict check, since this is an internal test module */
940 if (iface_version != sizeof(*iface)) {
941 weston_log("fatal: controller interface mismatch\n");
942 return -1;
943 }
944
945 ctx = zalloc(sizeof(*ctx));
946 if (!ctx)
947 return -1;
948
949 ctx->compositor = compositor;
Ucan, Emre \(ADITG/SW1\)0c0e51e2015-10-15 14:51:41 +0000950 ctx->layout_interface = iface;
Pekka Paalanen46804ca2015-03-27 11:55:21 +0200951
952 loop = wl_display_get_event_loop(compositor->wl_display);
953 wl_event_loop_add_idle(loop, run_internal_tests, ctx);
954
955 return 0;
956}