Pekka Paalanen | 46804ca | 2015-03-27 11:55:21 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2013 DENSO CORPORATION |
| 3 | * Copyright © 2015 Collabora, Ltd. |
| 4 | * |
Bryce Harrington | 2cc9297 | 2015-06-11 15:39:40 -0700 | [diff] [blame] | 5 | * 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 Paalanen | 46804ca | 2015-03-27 11:55:21 +0200 | [diff] [blame] | 12 | * |
Bryce Harrington | 2cc9297 | 2015-06-11 15:39:40 -0700 | [diff] [blame] | 13 | * 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 Paalanen | 46804ca | 2015-03-27 11:55:21 +0200 | [diff] [blame] | 25 | */ |
| 26 | |
| 27 | #include "config.h" |
| 28 | |
| 29 | #include <unistd.h> |
| 30 | #include <signal.h> |
| 31 | #include <string.h> |
| 32 | #include <stdbool.h> |
Jussi Kukkonen | 649bbce | 2016-07-19 14:16:27 +0300 | [diff] [blame] | 33 | #include <stdint.h> |
Pekka Paalanen | 46804ca | 2015-03-27 11:55:21 +0200 | [diff] [blame] | 34 | |
Pekka Paalanen | 3d5d947 | 2019-03-28 16:28:47 +0200 | [diff] [blame^] | 35 | #include <libweston/libweston.h> |
Emre Ucan | 0707b0e | 2018-01-25 14:36:13 +0100 | [diff] [blame] | 36 | #include "compositor/weston.h" |
Jon Cruz | 4678bab | 2015-06-15 15:37:07 -0700 | [diff] [blame] | 37 | #include "ivi-shell/ivi-layout-export.h" |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 38 | #include "ivi-shell/ivi-layout-private.h" |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 39 | #include "ivi-test.h" |
Ucan, Emre (ADITG/SW1) | 3750d1b | 2016-04-04 08:05:05 +0000 | [diff] [blame] | 40 | #include "shared/helpers.h" |
Pekka Paalanen | 46804ca | 2015-03-27 11:55:21 +0200 | [diff] [blame] | 41 | |
| 42 | struct test_context { |
| 43 | struct weston_compositor *compositor; |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 44 | const struct ivi_layout_interface *layout_interface; |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 45 | uint32_t user_flags; |
Ucan, Emre (ADITG/SW1) | 3750d1b | 2016-04-04 08:05:05 +0000 | [diff] [blame] | 46 | |
| 47 | struct wl_listener layer_property_changed; |
Ucan, Emre (ADITG/SW1) | c98f2cf | 2016-04-04 08:05:12 +0000 | [diff] [blame] | 48 | struct wl_listener layer_created; |
Ucan, Emre (ADITG/SW1) | 562f2ec | 2016-04-04 08:05:15 +0000 | [diff] [blame] | 49 | struct wl_listener layer_removed; |
Pekka Paalanen | 46804ca | 2015-03-27 11:55:21 +0200 | [diff] [blame] | 50 | }; |
| 51 | |
| 52 | static void |
| 53 | iassert_fail(const char *cond, const char *file, int line, |
| 54 | const char *func, struct test_context *ctx) |
| 55 | { |
| 56 | weston_log("Assert failure in %s:%d, %s: '%s'\n", |
| 57 | file, line, func, cond); |
| 58 | weston_compositor_exit_with_code(ctx->compositor, EXIT_FAILURE); |
| 59 | } |
| 60 | |
| 61 | #define iassert(cond) ({ \ |
| 62 | bool b_ = (cond); \ |
| 63 | if (!b_) \ |
| 64 | iassert_fail(#cond, __FILE__, __LINE__, __func__, ctx); \ |
| 65 | b_; \ |
| 66 | }) |
| 67 | |
| 68 | /************************ tests begin ******************************/ |
| 69 | |
| 70 | /* |
| 71 | * These are all internal ivi_layout API tests that do not require |
| 72 | * any client objects. |
| 73 | */ |
Pekka Paalanen | 46804ca | 2015-03-27 11:55:21 +0200 | [diff] [blame] | 74 | static void |
| 75 | test_surface_bad_visibility(struct test_context *ctx) |
| 76 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 77 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Pekka Paalanen | 46804ca | 2015-03-27 11:55:21 +0200 | [diff] [blame] | 78 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 79 | iassert(lyt->surface_set_visibility(NULL, true) == IVI_FAILED); |
Pekka Paalanen | 46804ca | 2015-03-27 11:55:21 +0200 | [diff] [blame] | 80 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 81 | lyt->commit_changes(); |
Pekka Paalanen | 46804ca | 2015-03-27 11:55:21 +0200 | [diff] [blame] | 82 | } |
| 83 | |
Nobuhiko Tanibata | 16ed543 | 2015-06-22 15:33:59 +0900 | [diff] [blame] | 84 | static void |
| 85 | test_surface_bad_destination_rectangle(struct test_context *ctx) |
| 86 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 87 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 16ed543 | 2015-06-22 15:33:59 +0900 | [diff] [blame] | 88 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 89 | iassert(lyt->surface_set_destination_rectangle(NULL, 20, 30, 200, 300) == IVI_FAILED); |
Nobuhiko Tanibata | 16ed543 | 2015-06-22 15:33:59 +0900 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | static void |
Nobuhiko Tanibata | 16ed543 | 2015-06-22 15:33:59 +0900 | [diff] [blame] | 93 | test_surface_bad_source_rectangle(struct test_context *ctx) |
| 94 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 95 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 16ed543 | 2015-06-22 15:33:59 +0900 | [diff] [blame] | 96 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 97 | iassert(lyt->surface_set_source_rectangle(NULL, 20, 30, 200, 300) == IVI_FAILED); |
Nobuhiko Tanibata | 16ed543 | 2015-06-22 15:33:59 +0900 | [diff] [blame] | 98 | } |
| 99 | |
| 100 | static void |
| 101 | test_surface_bad_properties(struct test_context *ctx) |
| 102 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 103 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 16ed543 | 2015-06-22 15:33:59 +0900 | [diff] [blame] | 104 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 105 | iassert(lyt->get_properties_of_surface(NULL) == NULL); |
Nobuhiko Tanibata | 16ed543 | 2015-06-22 15:33:59 +0900 | [diff] [blame] | 106 | } |
| 107 | |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 108 | static void |
| 109 | test_layer_create(struct test_context *ctx) |
| 110 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 111 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 112 | uint32_t id1; |
| 113 | uint32_t id2; |
| 114 | struct ivi_layout_layer *ivilayer; |
| 115 | struct ivi_layout_layer *new_ivilayer; |
| 116 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 117 | ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 118 | iassert(ivilayer != NULL); |
| 119 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 120 | iassert(IVI_TEST_LAYER_ID(0) == lyt->get_id_of_layer(ivilayer)); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 121 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 122 | new_ivilayer = lyt->get_layer_from_id(IVI_TEST_LAYER_ID(0)); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 123 | iassert(ivilayer == new_ivilayer); |
| 124 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 125 | id1 = lyt->get_id_of_layer(ivilayer); |
| 126 | id2 = lyt->get_id_of_layer(new_ivilayer); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 127 | iassert(id1 == id2); |
| 128 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 129 | lyt->layer_destroy(ivilayer); |
| 130 | iassert(lyt->get_layer_from_id(IVI_TEST_LAYER_ID(0)) == NULL); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | static void |
| 134 | test_layer_visibility(struct test_context *ctx) |
| 135 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 136 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 137 | struct ivi_layout_layer *ivilayer; |
| 138 | const struct ivi_layout_layer_properties *prop; |
| 139 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 140 | ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 141 | iassert(ivilayer != NULL); |
| 142 | |
Ucan, Emre \(ADITG/SW1\) | 17610f2 | 2016-03-04 12:50:07 +0000 | [diff] [blame] | 143 | prop = lyt->get_properties_of_layer(ivilayer); |
| 144 | |
| 145 | iassert(prop->visibility == false); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 146 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 147 | iassert(lyt->layer_set_visibility(ivilayer, true) == IVI_SUCCEEDED); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 148 | |
Ucan, Emre \(ADITG/SW1\) | 17610f2 | 2016-03-04 12:50:07 +0000 | [diff] [blame] | 149 | iassert(prop->visibility == false); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 150 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 151 | lyt->commit_changes(); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 152 | |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 153 | iassert(prop->visibility == true); |
| 154 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 155 | lyt->layer_destroy(ivilayer); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 156 | } |
| 157 | |
| 158 | static void |
| 159 | test_layer_opacity(struct test_context *ctx) |
| 160 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 161 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 162 | struct ivi_layout_layer *ivilayer; |
| 163 | const struct ivi_layout_layer_properties *prop; |
| 164 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 165 | ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 166 | iassert(ivilayer != NULL); |
| 167 | |
Ucan, Emre \(ADITG/SW1\) | c3aee1f | 2016-03-04 12:50:16 +0000 | [diff] [blame] | 168 | prop = lyt->get_properties_of_layer(ivilayer); |
| 169 | iassert(prop->opacity == wl_fixed_from_double(1.0)); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 170 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 171 | iassert(lyt->layer_set_opacity( |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 172 | ivilayer, wl_fixed_from_double(0.5)) == IVI_SUCCEEDED); |
| 173 | |
Ucan, Emre \(ADITG/SW1\) | c3aee1f | 2016-03-04 12:50:16 +0000 | [diff] [blame] | 174 | iassert(prop->opacity == wl_fixed_from_double(1.0)); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 175 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 176 | lyt->commit_changes(); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 177 | |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 178 | iassert(prop->opacity == wl_fixed_from_double(0.5)); |
| 179 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 180 | lyt->layer_destroy(ivilayer); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 181 | } |
| 182 | |
| 183 | static void |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 184 | test_layer_dimension(struct test_context *ctx) |
| 185 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 186 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 187 | struct ivi_layout_layer *ivilayer; |
| 188 | const struct ivi_layout_layer_properties *prop; |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 189 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 190 | ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 191 | iassert(ivilayer != NULL); |
| 192 | |
Ucan, Emre \(ADITG/SW1\) | 18691f0 | 2016-03-04 12:50:32 +0000 | [diff] [blame] | 193 | prop = lyt->get_properties_of_layer(ivilayer); |
| 194 | iassert(prop->dest_width == 200); |
| 195 | iassert(prop->dest_height == 300); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 196 | |
Ucan, Emre \(ADITG/SW1\) | 16d1fa1 | 2016-03-04 12:50:52 +0000 | [diff] [blame] | 197 | iassert(lyt->layer_set_destination_rectangle(ivilayer, prop->dest_x, prop->dest_y, |
| 198 | 400, 600) == IVI_SUCCEEDED); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 199 | |
Ucan, Emre \(ADITG/SW1\) | 18691f0 | 2016-03-04 12:50:32 +0000 | [diff] [blame] | 200 | iassert(prop->dest_width == 200); |
| 201 | iassert(prop->dest_height == 300); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 202 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 203 | lyt->commit_changes(); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 204 | |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 205 | iassert(prop->dest_width == 400); |
| 206 | iassert(prop->dest_height == 600); |
| 207 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 208 | lyt->layer_destroy(ivilayer); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 209 | } |
| 210 | |
| 211 | static void |
| 212 | test_layer_position(struct test_context *ctx) |
| 213 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 214 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 215 | struct ivi_layout_layer *ivilayer; |
| 216 | const struct ivi_layout_layer_properties *prop; |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 217 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 218 | ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 219 | iassert(ivilayer != NULL); |
| 220 | |
Ucan, Emre \(ADITG/SW1\) | dfc2d76 | 2016-03-04 12:50:24 +0000 | [diff] [blame] | 221 | prop = lyt->get_properties_of_layer(ivilayer); |
| 222 | iassert(prop->dest_x == 0); |
| 223 | iassert(prop->dest_y == 0); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 224 | |
Ucan, Emre \(ADITG/SW1\) | e62bfd8 | 2016-03-04 12:50:46 +0000 | [diff] [blame] | 225 | iassert(lyt->layer_set_destination_rectangle(ivilayer, 20, 30, |
| 226 | prop->dest_width, prop->dest_height) == IVI_SUCCEEDED); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 227 | |
Ucan, Emre \(ADITG/SW1\) | dfc2d76 | 2016-03-04 12:50:24 +0000 | [diff] [blame] | 228 | iassert(prop->dest_x == 0); |
| 229 | iassert(prop->dest_y == 0); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 230 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 231 | lyt->commit_changes(); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 232 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 233 | prop = lyt->get_properties_of_layer(ivilayer); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 234 | iassert(prop->dest_x == 20); |
| 235 | iassert(prop->dest_y == 30); |
| 236 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 237 | lyt->layer_destroy(ivilayer); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 238 | } |
| 239 | |
| 240 | static void |
| 241 | test_layer_destination_rectangle(struct test_context *ctx) |
| 242 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 243 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 244 | struct ivi_layout_layer *ivilayer; |
| 245 | const struct ivi_layout_layer_properties *prop; |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 246 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 247 | ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 248 | iassert(ivilayer != NULL); |
| 249 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 250 | prop = lyt->get_properties_of_layer(ivilayer); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 251 | iassert(prop->dest_width == 200); |
| 252 | iassert(prop->dest_height == 300); |
| 253 | iassert(prop->dest_x == 0); |
| 254 | iassert(prop->dest_y == 0); |
| 255 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 256 | iassert(lyt->layer_set_destination_rectangle( |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 257 | ivilayer, 20, 30, 400, 600) == IVI_SUCCEEDED); |
| 258 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 259 | prop = lyt->get_properties_of_layer(ivilayer); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 260 | iassert(prop->dest_width == 200); |
| 261 | iassert(prop->dest_height == 300); |
| 262 | iassert(prop->dest_x == 0); |
| 263 | iassert(prop->dest_y == 0); |
| 264 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 265 | lyt->commit_changes(); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 266 | |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 267 | iassert(prop->dest_width == 400); |
| 268 | iassert(prop->dest_height == 600); |
| 269 | iassert(prop->dest_x == 20); |
| 270 | iassert(prop->dest_y == 30); |
| 271 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 272 | lyt->layer_destroy(ivilayer); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 273 | } |
| 274 | |
| 275 | static void |
| 276 | test_layer_source_rectangle(struct test_context *ctx) |
| 277 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 278 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 279 | struct ivi_layout_layer *ivilayer; |
| 280 | const struct ivi_layout_layer_properties *prop; |
| 281 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 282 | ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 283 | iassert(ivilayer != NULL); |
| 284 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 285 | prop = lyt->get_properties_of_layer(ivilayer); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 286 | iassert(prop->source_width == 200); |
| 287 | iassert(prop->source_height == 300); |
| 288 | iassert(prop->source_x == 0); |
| 289 | iassert(prop->source_y == 0); |
| 290 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 291 | iassert(lyt->layer_set_source_rectangle( |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 292 | ivilayer, 20, 30, 400, 600) == IVI_SUCCEEDED); |
| 293 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 294 | prop = lyt->get_properties_of_layer(ivilayer); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 295 | iassert(prop->source_width == 200); |
| 296 | iassert(prop->source_height == 300); |
| 297 | iassert(prop->source_x == 0); |
| 298 | iassert(prop->source_y == 0); |
| 299 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 300 | lyt->commit_changes(); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 301 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 302 | prop = lyt->get_properties_of_layer(ivilayer); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 303 | iassert(prop->source_width == 400); |
| 304 | iassert(prop->source_height == 600); |
| 305 | iassert(prop->source_x == 20); |
| 306 | iassert(prop->source_y == 30); |
| 307 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 308 | lyt->layer_destroy(ivilayer); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 309 | } |
| 310 | |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 311 | static void |
| 312 | test_layer_bad_remove(struct test_context *ctx) |
| 313 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 314 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
| 315 | lyt->layer_destroy(NULL); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 316 | } |
| 317 | |
| 318 | static void |
| 319 | test_layer_bad_visibility(struct test_context *ctx) |
| 320 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 321 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 322 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 323 | iassert(lyt->layer_set_visibility(NULL, true) == IVI_FAILED); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 324 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 325 | lyt->commit_changes(); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 326 | } |
| 327 | |
| 328 | static void |
| 329 | test_layer_bad_opacity(struct test_context *ctx) |
| 330 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 331 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 332 | struct ivi_layout_layer *ivilayer; |
Ucan, Emre \(ADITG/SW1\) | c3aee1f | 2016-03-04 12:50:16 +0000 | [diff] [blame] | 333 | const struct ivi_layout_layer_properties *prop; |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 334 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 335 | ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 336 | iassert(ivilayer != NULL); |
| 337 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 338 | iassert(lyt->layer_set_opacity( |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 339 | NULL, wl_fixed_from_double(0.3)) == IVI_FAILED); |
| 340 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 341 | iassert(lyt->layer_set_opacity( |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 342 | ivilayer, wl_fixed_from_double(0.3)) == IVI_SUCCEEDED); |
| 343 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 344 | iassert(lyt->layer_set_opacity( |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 345 | ivilayer, wl_fixed_from_double(-1)) == IVI_FAILED); |
| 346 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 347 | lyt->commit_changes(); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 348 | |
Ucan, Emre \(ADITG/SW1\) | c3aee1f | 2016-03-04 12:50:16 +0000 | [diff] [blame] | 349 | prop = lyt->get_properties_of_layer(ivilayer); |
| 350 | iassert(prop->opacity == wl_fixed_from_double(0.3)); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 351 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 352 | iassert(lyt->layer_set_opacity( |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 353 | ivilayer, wl_fixed_from_double(1.1)) == IVI_FAILED); |
| 354 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 355 | lyt->commit_changes(); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 356 | |
Ucan, Emre \(ADITG/SW1\) | c3aee1f | 2016-03-04 12:50:16 +0000 | [diff] [blame] | 357 | iassert(prop->opacity == wl_fixed_from_double(0.3)); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 358 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 359 | iassert(lyt->layer_set_opacity( |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 360 | NULL, wl_fixed_from_double(0.5)) == IVI_FAILED); |
| 361 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 362 | lyt->commit_changes(); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 363 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 364 | lyt->layer_destroy(ivilayer); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 365 | } |
| 366 | |
| 367 | static void |
| 368 | test_layer_bad_destination_rectangle(struct test_context *ctx) |
| 369 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 370 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 371 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 372 | iassert(lyt->layer_set_destination_rectangle( |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 373 | NULL, 20, 30, 200, 300) == IVI_FAILED); |
| 374 | } |
| 375 | |
| 376 | static void |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 377 | test_layer_bad_source_rectangle(struct test_context *ctx) |
| 378 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 379 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 380 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 381 | iassert(lyt->layer_set_source_rectangle( |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 382 | NULL, 20, 30, 200, 300) == IVI_FAILED); |
| 383 | } |
| 384 | |
| 385 | static void |
| 386 | test_layer_bad_properties(struct test_context *ctx) |
| 387 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 388 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 389 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 390 | iassert(lyt->get_properties_of_layer(NULL) == NULL); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 391 | } |
| 392 | |
| 393 | static void |
| 394 | test_commit_changes_after_visibility_set_layer_destroy(struct test_context *ctx) |
| 395 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 396 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 397 | struct ivi_layout_layer *ivilayer; |
| 398 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 399 | ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 400 | iassert(ivilayer != NULL); |
| 401 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 402 | iassert(lyt->layer_set_visibility(ivilayer, true) == IVI_SUCCEEDED); |
| 403 | lyt->layer_destroy(ivilayer); |
| 404 | lyt->commit_changes(); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 405 | } |
| 406 | |
| 407 | static void |
| 408 | test_commit_changes_after_opacity_set_layer_destroy(struct test_context *ctx) |
| 409 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 410 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 411 | struct ivi_layout_layer *ivilayer; |
| 412 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 413 | ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 414 | iassert(ivilayer != NULL); |
| 415 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 416 | iassert(lyt->layer_set_opacity( |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 417 | ivilayer, wl_fixed_from_double(0.5)) == IVI_SUCCEEDED); |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 418 | lyt->layer_destroy(ivilayer); |
| 419 | lyt->commit_changes(); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 420 | } |
| 421 | |
| 422 | static void |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 423 | test_commit_changes_after_source_rectangle_set_layer_destroy(struct test_context *ctx) |
| 424 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 425 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 426 | struct ivi_layout_layer *ivilayer; |
| 427 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 428 | ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 429 | iassert(ivilayer != NULL); |
| 430 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 431 | iassert(lyt->layer_set_source_rectangle( |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 432 | ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED); |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 433 | lyt->layer_destroy(ivilayer); |
| 434 | lyt->commit_changes(); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 435 | } |
| 436 | |
| 437 | static void |
| 438 | test_commit_changes_after_destination_rectangle_set_layer_destroy(struct test_context *ctx) |
| 439 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 440 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 441 | struct ivi_layout_layer *ivilayer; |
| 442 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 443 | ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 444 | iassert(ivilayer != NULL); |
| 445 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 446 | iassert(lyt->layer_set_destination_rectangle( |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 447 | ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED); |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 448 | lyt->layer_destroy(ivilayer); |
| 449 | lyt->commit_changes(); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 450 | } |
| 451 | |
| 452 | static void |
| 453 | test_layer_create_duplicate(struct test_context *ctx) |
| 454 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 455 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 456 | struct ivi_layout_layer *ivilayer; |
| 457 | struct ivi_layout_layer *duplicatelayer; |
| 458 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 459 | ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 460 | iassert(ivilayer != NULL); |
| 461 | |
| 462 | if (ivilayer != NULL) |
| 463 | iassert(ivilayer->ref_count == 1); |
| 464 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 465 | duplicatelayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 466 | iassert(ivilayer == duplicatelayer); |
| 467 | |
| 468 | if (ivilayer != NULL) |
| 469 | iassert(ivilayer->ref_count == 2); |
| 470 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 471 | lyt->layer_destroy(ivilayer); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 472 | |
| 473 | if (ivilayer != NULL) |
| 474 | iassert(ivilayer->ref_count == 1); |
| 475 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 476 | lyt->layer_destroy(ivilayer); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 477 | } |
| 478 | |
| 479 | static void |
| 480 | test_get_layer_after_destory_layer(struct test_context *ctx) |
| 481 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 482 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 483 | struct ivi_layout_layer *ivilayer; |
| 484 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 485 | ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 486 | iassert(ivilayer != NULL); |
| 487 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 488 | lyt->layer_destroy(ivilayer); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 489 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 490 | ivilayer = lyt->get_layer_from_id(IVI_TEST_LAYER_ID(0)); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 491 | iassert(ivilayer == NULL); |
| 492 | } |
| 493 | |
Nobuhiko Tanibata | e78a7af | 2015-06-22 15:35:25 +0900 | [diff] [blame] | 494 | static void |
Nobuhiko Tanibata | e78a7af | 2015-06-22 15:35:25 +0900 | [diff] [blame] | 495 | test_screen_render_order(struct test_context *ctx) |
| 496 | { |
| 497 | #define LAYER_NUM (3) |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 498 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Ucan, Emre (ADITG/SW1) | 273874e | 2016-03-17 15:30:42 +0000 | [diff] [blame] | 499 | struct weston_output *output; |
Nobuhiko Tanibata | e78a7af | 2015-06-22 15:35:25 +0900 | [diff] [blame] | 500 | struct ivi_layout_layer *ivilayers[LAYER_NUM] = {}; |
| 501 | struct ivi_layout_layer **array; |
| 502 | int32_t length = 0; |
| 503 | uint32_t i; |
| 504 | |
Pekka Paalanen | d05a819 | 2017-08-17 13:30:11 +0300 | [diff] [blame] | 505 | if (!iassert(!wl_list_empty(&ctx->compositor->output_list))) |
Nobuhiko Tanibata | e78a7af | 2015-06-22 15:35:25 +0900 | [diff] [blame] | 506 | return; |
| 507 | |
Ucan, Emre (ADITG/SW1) | 273874e | 2016-03-17 15:30:42 +0000 | [diff] [blame] | 508 | output = wl_container_of(ctx->compositor->output_list.next, output, link); |
Nobuhiko Tanibata | e78a7af | 2015-06-22 15:35:25 +0900 | [diff] [blame] | 509 | |
| 510 | for (i = 0; i < LAYER_NUM; i++) |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 511 | ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300); |
Nobuhiko Tanibata | e78a7af | 2015-06-22 15:35:25 +0900 | [diff] [blame] | 512 | |
Ucan, Emre (ADITG/SW1) | 273874e | 2016-03-17 15:30:42 +0000 | [diff] [blame] | 513 | iassert(lyt->screen_set_render_order(output, ivilayers, LAYER_NUM) == IVI_SUCCEEDED); |
Nobuhiko Tanibata | e78a7af | 2015-06-22 15:35:25 +0900 | [diff] [blame] | 514 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 515 | lyt->commit_changes(); |
Nobuhiko Tanibata | e78a7af | 2015-06-22 15:35:25 +0900 | [diff] [blame] | 516 | |
Ucan, Emre (ADITG/SW1) | 273874e | 2016-03-17 15:30:42 +0000 | [diff] [blame] | 517 | iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED); |
Nobuhiko Tanibata | e78a7af | 2015-06-22 15:35:25 +0900 | [diff] [blame] | 518 | iassert(length == LAYER_NUM); |
| 519 | for (i = 0; i < LAYER_NUM; i++) |
| 520 | iassert(array[i] == ivilayers[i]); |
| 521 | |
| 522 | if (length > 0) |
| 523 | free(array); |
| 524 | |
| 525 | array = NULL; |
| 526 | |
Ucan, Emre (ADITG/SW1) | 273874e | 2016-03-17 15:30:42 +0000 | [diff] [blame] | 527 | iassert(lyt->screen_set_render_order(output, NULL, 0) == IVI_SUCCEEDED); |
Nobuhiko Tanibata | e78a7af | 2015-06-22 15:35:25 +0900 | [diff] [blame] | 528 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 529 | lyt->commit_changes(); |
Nobuhiko Tanibata | e78a7af | 2015-06-22 15:35:25 +0900 | [diff] [blame] | 530 | |
Ucan, Emre (ADITG/SW1) | 273874e | 2016-03-17 15:30:42 +0000 | [diff] [blame] | 531 | iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED); |
Nobuhiko Tanibata | e78a7af | 2015-06-22 15:35:25 +0900 | [diff] [blame] | 532 | iassert(length == 0 && array == NULL); |
| 533 | |
| 534 | for (i = 0; i < LAYER_NUM; i++) |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 535 | lyt->layer_destroy(ivilayers[i]); |
Nobuhiko Tanibata | e78a7af | 2015-06-22 15:35:25 +0900 | [diff] [blame] | 536 | |
Nobuhiko Tanibata | e78a7af | 2015-06-22 15:35:25 +0900 | [diff] [blame] | 537 | #undef LAYER_NUM |
| 538 | } |
| 539 | |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 540 | static void |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 541 | test_screen_bad_render_order(struct test_context *ctx) |
| 542 | { |
| 543 | #define LAYER_NUM (3) |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 544 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Ucan, Emre (ADITG/SW1) | 273874e | 2016-03-17 15:30:42 +0000 | [diff] [blame] | 545 | struct weston_output *output; |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 546 | struct ivi_layout_layer *ivilayers[LAYER_NUM] = {}; |
| 547 | struct ivi_layout_layer **array; |
| 548 | int32_t length = 0; |
| 549 | uint32_t i; |
| 550 | |
Pekka Paalanen | d05a819 | 2017-08-17 13:30:11 +0300 | [diff] [blame] | 551 | if (!iassert(!wl_list_empty(&ctx->compositor->output_list))) |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 552 | return; |
| 553 | |
Ucan, Emre (ADITG/SW1) | 273874e | 2016-03-17 15:30:42 +0000 | [diff] [blame] | 554 | output = wl_container_of(ctx->compositor->output_list.next, output, link); |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 555 | |
| 556 | for (i = 0; i < LAYER_NUM; i++) |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 557 | ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300); |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 558 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 559 | iassert(lyt->screen_set_render_order(NULL, ivilayers, LAYER_NUM) == IVI_FAILED); |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 560 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 561 | lyt->commit_changes(); |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 562 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 563 | iassert(lyt->get_layers_on_screen(NULL, &length, &array) == IVI_FAILED); |
Ucan, Emre (ADITG/SW1) | 273874e | 2016-03-17 15:30:42 +0000 | [diff] [blame] | 564 | iassert(lyt->get_layers_on_screen(output, NULL, &array) == IVI_FAILED); |
| 565 | iassert(lyt->get_layers_on_screen(output, &length, NULL) == IVI_FAILED); |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 566 | |
| 567 | for (i = 0; i < LAYER_NUM; i++) |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 568 | lyt->layer_destroy(ivilayers[i]); |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 569 | |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 570 | #undef LAYER_NUM |
| 571 | } |
| 572 | |
| 573 | static void |
Ucan, Emre (ADITG/SW1) | fbce2f5 | 2017-01-18 15:25:36 +0000 | [diff] [blame] | 574 | test_screen_add_layers(struct test_context *ctx) |
| 575 | { |
| 576 | #define LAYER_NUM (3) |
| 577 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
| 578 | struct weston_output *output; |
| 579 | struct ivi_layout_layer *ivilayers[LAYER_NUM] = {}; |
| 580 | struct ivi_layout_layer **array; |
| 581 | int32_t length = 0; |
| 582 | uint32_t i; |
| 583 | |
Pekka Paalanen | d05a819 | 2017-08-17 13:30:11 +0300 | [diff] [blame] | 584 | if (!iassert(!wl_list_empty(&ctx->compositor->output_list))) |
Ucan, Emre (ADITG/SW1) | fbce2f5 | 2017-01-18 15:25:36 +0000 | [diff] [blame] | 585 | return; |
| 586 | |
| 587 | output = wl_container_of(ctx->compositor->output_list.next, output, link); |
| 588 | |
| 589 | for (i = 0; i < LAYER_NUM; i++) { |
| 590 | ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300); |
| 591 | iassert(lyt->screen_add_layer(output, ivilayers[i]) == IVI_SUCCEEDED); |
| 592 | } |
| 593 | |
| 594 | lyt->commit_changes(); |
| 595 | |
| 596 | iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED); |
| 597 | iassert(length == LAYER_NUM); |
| 598 | for (i = 0; i < (uint32_t)length; i++) |
| 599 | iassert(array[i] == ivilayers[i]); |
| 600 | |
| 601 | if (length > 0) |
| 602 | free(array); |
| 603 | |
| 604 | array = NULL; |
| 605 | |
| 606 | iassert(lyt->screen_set_render_order(output, NULL, 0) == IVI_SUCCEEDED); |
| 607 | for (i = LAYER_NUM; i-- > 0;) |
| 608 | iassert(lyt->screen_add_layer(output, ivilayers[i]) == IVI_SUCCEEDED); |
| 609 | |
| 610 | lyt->commit_changes(); |
| 611 | |
| 612 | iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED); |
| 613 | iassert(length == LAYER_NUM); |
| 614 | for (i = 0; i < (uint32_t)length; i++) |
| 615 | iassert(array[i] == ivilayers[LAYER_NUM - (i + 1)]); |
| 616 | |
| 617 | if (length > 0) |
| 618 | free(array); |
| 619 | |
| 620 | for (i = 0; i < LAYER_NUM; i++) |
| 621 | lyt->layer_destroy(ivilayers[i]); |
| 622 | |
| 623 | #undef LAYER_NUM |
| 624 | } |
| 625 | |
| 626 | static void |
Michael Teyfel | 156bd06 | 2017-07-26 14:22:49 +0200 | [diff] [blame] | 627 | test_screen_remove_layer(struct test_context *ctx) |
| 628 | { |
| 629 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
| 630 | struct ivi_layout_layer *ivilayer; |
| 631 | struct weston_output *output; |
| 632 | struct ivi_layout_layer **array; |
| 633 | int32_t length = 0; |
| 634 | |
| 635 | if (wl_list_empty(&ctx->compositor->output_list)) |
| 636 | return; |
| 637 | |
| 638 | ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); |
| 639 | iassert(ivilayer != NULL); |
| 640 | |
| 641 | output = wl_container_of(ctx->compositor->output_list.next, output, link); |
| 642 | |
| 643 | iassert(lyt->screen_add_layer(output, ivilayer) == IVI_SUCCEEDED); |
| 644 | lyt->commit_changes(); |
| 645 | |
| 646 | iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED); |
| 647 | iassert(length == 1); |
| 648 | iassert(array[0] == ivilayer); |
| 649 | |
| 650 | iassert(lyt->screen_remove_layer(output, ivilayer) == IVI_SUCCEEDED); |
| 651 | lyt->commit_changes(); |
| 652 | |
| 653 | if (length > 0) |
| 654 | free(array); |
| 655 | |
| 656 | array = NULL; |
| 657 | |
| 658 | iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED); |
| 659 | iassert(length == 0); |
| 660 | iassert(array == NULL); |
| 661 | |
| 662 | lyt->layer_destroy(ivilayer); |
| 663 | } |
| 664 | |
| 665 | static void |
| 666 | test_screen_bad_remove_layer(struct test_context *ctx) |
| 667 | { |
| 668 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
| 669 | struct ivi_layout_layer *ivilayer; |
| 670 | struct weston_output *output; |
| 671 | |
| 672 | if (wl_list_empty(&ctx->compositor->output_list)) |
| 673 | return; |
| 674 | |
| 675 | ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); |
| 676 | iassert(ivilayer != NULL); |
| 677 | |
| 678 | output = wl_container_of(ctx->compositor->output_list.next, output, link); |
| 679 | |
| 680 | iassert(lyt->screen_remove_layer(NULL, ivilayer) == IVI_FAILED); |
| 681 | lyt->commit_changes(); |
| 682 | |
| 683 | iassert(lyt->screen_remove_layer(output, NULL) == IVI_FAILED); |
| 684 | lyt->commit_changes(); |
| 685 | |
| 686 | iassert(lyt->screen_remove_layer(NULL, NULL) == IVI_FAILED); |
| 687 | lyt->commit_changes(); |
| 688 | |
| 689 | lyt->layer_destroy(ivilayer); |
| 690 | } |
| 691 | |
| 692 | |
| 693 | static void |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 694 | test_commit_changes_after_render_order_set_layer_destroy( |
| 695 | struct test_context *ctx) |
| 696 | { |
| 697 | #define LAYER_NUM (3) |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 698 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Ucan, Emre (ADITG/SW1) | 273874e | 2016-03-17 15:30:42 +0000 | [diff] [blame] | 699 | struct weston_output *output; |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 700 | struct ivi_layout_layer *ivilayers[LAYER_NUM] = {}; |
| 701 | uint32_t i; |
| 702 | |
Pekka Paalanen | d05a819 | 2017-08-17 13:30:11 +0300 | [diff] [blame] | 703 | if (!iassert(!wl_list_empty(&ctx->compositor->output_list))) |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 704 | return; |
| 705 | |
Ucan, Emre (ADITG/SW1) | 273874e | 2016-03-17 15:30:42 +0000 | [diff] [blame] | 706 | output = wl_container_of(ctx->compositor->output_list.next, output, link); |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 707 | |
| 708 | for (i = 0; i < LAYER_NUM; i++) |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 709 | ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300); |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 710 | |
Ucan, Emre (ADITG/SW1) | 273874e | 2016-03-17 15:30:42 +0000 | [diff] [blame] | 711 | iassert(lyt->screen_set_render_order(output, ivilayers, LAYER_NUM) == IVI_SUCCEEDED); |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 712 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 713 | lyt->layer_destroy(ivilayers[1]); |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 714 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 715 | lyt->commit_changes(); |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 716 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 717 | lyt->layer_destroy(ivilayers[0]); |
| 718 | lyt->layer_destroy(ivilayers[2]); |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 719 | #undef LAYER_NUM |
| 720 | } |
| 721 | |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 722 | static void |
Ucan, Emre (ADITG/SW1) | 3750d1b | 2016-04-04 08:05:05 +0000 | [diff] [blame] | 723 | test_layer_properties_changed_notification_callback(struct wl_listener *listener, void *data) |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 724 | { |
Ucan, Emre (ADITG/SW1) | 3750d1b | 2016-04-04 08:05:05 +0000 | [diff] [blame] | 725 | struct test_context *ctx = |
| 726 | container_of(listener, struct test_context, |
| 727 | layer_property_changed); |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 728 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Ucan, Emre (ADITG/SW1) | 3750d1b | 2016-04-04 08:05:05 +0000 | [diff] [blame] | 729 | struct ivi_layout_layer *ivilayer = data; |
| 730 | const struct ivi_layout_layer_properties *prop = lyt->get_properties_of_layer(ivilayer); |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 731 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 732 | iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0)); |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 733 | iassert(prop->source_width == 200); |
| 734 | iassert(prop->source_height == 300); |
| 735 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 736 | if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) && |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 737 | prop->source_width == 200 && prop->source_height == 300) |
| 738 | ctx->user_flags = 1; |
| 739 | } |
| 740 | |
| 741 | static void |
| 742 | test_layer_properties_changed_notification(struct test_context *ctx) |
| 743 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 744 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 745 | struct ivi_layout_layer *ivilayer; |
| 746 | |
| 747 | ctx->user_flags = 0; |
| 748 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 749 | ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 750 | |
Ucan, Emre (ADITG/SW1) | 3750d1b | 2016-04-04 08:05:05 +0000 | [diff] [blame] | 751 | ctx->layer_property_changed.notify = test_layer_properties_changed_notification_callback; |
| 752 | |
| 753 | iassert(lyt->layer_add_listener(ivilayer, &ctx->layer_property_changed) == IVI_SUCCEEDED); |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 754 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 755 | lyt->commit_changes(); |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 756 | |
| 757 | iassert(ctx->user_flags == 0); |
| 758 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 759 | iassert(lyt->layer_set_destination_rectangle( |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 760 | ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED); |
| 761 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 762 | lyt->commit_changes(); |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 763 | |
| 764 | iassert(ctx->user_flags == 1); |
| 765 | |
| 766 | ctx->user_flags = 0; |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 767 | iassert(lyt->layer_set_destination_rectangle( |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 768 | ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED); |
| 769 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 770 | lyt->commit_changes(); |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 771 | |
| 772 | iassert(ctx->user_flags == 0); |
| 773 | |
Ucan, Emre (ADITG/SW1) | 3750d1b | 2016-04-04 08:05:05 +0000 | [diff] [blame] | 774 | // remove layer property changed listener. |
| 775 | wl_list_remove(&ctx->layer_property_changed.link); |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 776 | |
| 777 | ctx->user_flags = 0; |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 778 | lyt->commit_changes(); |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 779 | |
| 780 | iassert(ctx->user_flags == 0); |
| 781 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 782 | lyt->layer_destroy(ivilayer); |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 783 | } |
| 784 | |
| 785 | static void |
Ucan, Emre (ADITG/SW1) | c98f2cf | 2016-04-04 08:05:12 +0000 | [diff] [blame] | 786 | test_layer_create_notification_callback(struct wl_listener *listener, void *data) |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 787 | { |
Ucan, Emre (ADITG/SW1) | c98f2cf | 2016-04-04 08:05:12 +0000 | [diff] [blame] | 788 | struct test_context *ctx = |
| 789 | container_of(listener, struct test_context, |
| 790 | layer_created); |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 791 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Ucan, Emre (ADITG/SW1) | c98f2cf | 2016-04-04 08:05:12 +0000 | [diff] [blame] | 792 | struct ivi_layout_layer *ivilayer = data; |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 793 | const struct ivi_layout_layer_properties *prop = lyt->get_properties_of_layer(ivilayer); |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 794 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 795 | iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0)); |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 796 | iassert(prop->source_width == 200); |
| 797 | iassert(prop->source_height == 300); |
| 798 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 799 | if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) && |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 800 | prop->source_width == 200 && prop->source_height == 300) |
| 801 | ctx->user_flags = 1; |
| 802 | } |
| 803 | |
| 804 | static void |
| 805 | test_layer_create_notification(struct test_context *ctx) |
| 806 | { |
| 807 | #define LAYER_NUM (2) |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 808 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 809 | static const uint32_t layers[LAYER_NUM] = {IVI_TEST_LAYER_ID(0), IVI_TEST_LAYER_ID(1)}; |
| 810 | struct ivi_layout_layer *ivilayers[LAYER_NUM] = {}; |
| 811 | |
| 812 | ctx->user_flags = 0; |
Ucan, Emre (ADITG/SW1) | c98f2cf | 2016-04-04 08:05:12 +0000 | [diff] [blame] | 813 | ctx->layer_created.notify = test_layer_create_notification_callback; |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 814 | |
Ucan, Emre (ADITG/SW1) | c98f2cf | 2016-04-04 08:05:12 +0000 | [diff] [blame] | 815 | iassert(lyt->add_listener_create_layer(&ctx->layer_created) == IVI_SUCCEEDED); |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 816 | ivilayers[0] = lyt->layer_create_with_dimension(layers[0], 200, 300); |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 817 | |
| 818 | iassert(ctx->user_flags == 1); |
| 819 | |
| 820 | ctx->user_flags = 0; |
Ucan, Emre (ADITG/SW1) | c98f2cf | 2016-04-04 08:05:12 +0000 | [diff] [blame] | 821 | // remove layer created listener. |
| 822 | wl_list_remove(&ctx->layer_created.link); |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 823 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 824 | ivilayers[1] = lyt->layer_create_with_dimension(layers[1], 400, 500); |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 825 | |
| 826 | iassert(ctx->user_flags == 0); |
| 827 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 828 | lyt->layer_destroy(ivilayers[0]); |
| 829 | lyt->layer_destroy(ivilayers[1]); |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 830 | #undef LAYER_NUM |
| 831 | } |
| 832 | |
| 833 | static void |
Ucan, Emre (ADITG/SW1) | 562f2ec | 2016-04-04 08:05:15 +0000 | [diff] [blame] | 834 | test_layer_remove_notification_callback(struct wl_listener *listener, void *data) |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 835 | { |
Ucan, Emre (ADITG/SW1) | 562f2ec | 2016-04-04 08:05:15 +0000 | [diff] [blame] | 836 | struct test_context *ctx = |
| 837 | container_of(listener, struct test_context, |
| 838 | layer_removed); |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 839 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Ucan, Emre (ADITG/SW1) | 562f2ec | 2016-04-04 08:05:15 +0000 | [diff] [blame] | 840 | struct ivi_layout_layer *ivilayer = data; |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 841 | const struct ivi_layout_layer_properties *prop = |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 842 | lyt->get_properties_of_layer(ivilayer); |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 843 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 844 | iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0)); |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 845 | iassert(prop->source_width == 200); |
| 846 | iassert(prop->source_height == 300); |
| 847 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 848 | if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) && |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 849 | prop->source_width == 200 && prop->source_height == 300) |
| 850 | ctx->user_flags = 1; |
| 851 | } |
| 852 | |
| 853 | static void |
| 854 | test_layer_remove_notification(struct test_context *ctx) |
| 855 | { |
| 856 | #define LAYER_NUM (2) |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 857 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 858 | static const uint32_t layers[LAYER_NUM] = {IVI_TEST_LAYER_ID(0), IVI_TEST_LAYER_ID(1)}; |
| 859 | struct ivi_layout_layer *ivilayers[LAYER_NUM] = {}; |
| 860 | |
| 861 | ctx->user_flags = 0; |
Ucan, Emre (ADITG/SW1) | 562f2ec | 2016-04-04 08:05:15 +0000 | [diff] [blame] | 862 | ctx->layer_removed.notify = test_layer_remove_notification_callback; |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 863 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 864 | ivilayers[0] = lyt->layer_create_with_dimension(layers[0], 200, 300); |
Ucan, Emre (ADITG/SW1) | 562f2ec | 2016-04-04 08:05:15 +0000 | [diff] [blame] | 865 | iassert(lyt->add_listener_remove_layer(&ctx->layer_removed) == IVI_SUCCEEDED); |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 866 | lyt->layer_destroy(ivilayers[0]); |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 867 | |
| 868 | iassert(ctx->user_flags == 1); |
| 869 | |
| 870 | ctx->user_flags = 0; |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 871 | ivilayers[1] = lyt->layer_create_with_dimension(layers[1], 250, 350); |
Ucan, Emre (ADITG/SW1) | 562f2ec | 2016-04-04 08:05:15 +0000 | [diff] [blame] | 872 | |
| 873 | // remove layer property changed listener. |
| 874 | wl_list_remove(&ctx->layer_removed.link); |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 875 | lyt->layer_destroy(ivilayers[1]); |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 876 | |
| 877 | iassert(ctx->user_flags == 0); |
| 878 | #undef LAYER_NUM |
| 879 | } |
| 880 | |
Nobuhiko Tanibata | ffcc452 | 2015-06-22 15:37:41 +0900 | [diff] [blame] | 881 | static void |
Ucan, Emre (ADITG/SW1) | 3750d1b | 2016-04-04 08:05:05 +0000 | [diff] [blame] | 882 | test_layer_bad_properties_changed_notification_callback(struct wl_listener *listener, void *data) |
Nobuhiko Tanibata | ffcc452 | 2015-06-22 15:37:41 +0900 | [diff] [blame] | 883 | { |
| 884 | } |
| 885 | |
| 886 | static void |
| 887 | test_layer_bad_properties_changed_notification(struct test_context *ctx) |
| 888 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 889 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | ffcc452 | 2015-06-22 15:37:41 +0900 | [diff] [blame] | 890 | struct ivi_layout_layer *ivilayer; |
| 891 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 892 | ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300); |
Nobuhiko Tanibata | ffcc452 | 2015-06-22 15:37:41 +0900 | [diff] [blame] | 893 | |
Ucan, Emre (ADITG/SW1) | 3750d1b | 2016-04-04 08:05:05 +0000 | [diff] [blame] | 894 | ctx->layer_property_changed.notify = test_layer_bad_properties_changed_notification_callback; |
| 895 | |
| 896 | iassert(lyt->layer_add_listener(NULL, &ctx->layer_property_changed) == IVI_FAILED); |
| 897 | iassert(lyt->layer_add_listener(ivilayer, NULL) == IVI_FAILED); |
Nobuhiko Tanibata | ffcc452 | 2015-06-22 15:37:41 +0900 | [diff] [blame] | 898 | |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 899 | lyt->layer_destroy(ivilayer); |
Nobuhiko Tanibata | ffcc452 | 2015-06-22 15:37:41 +0900 | [diff] [blame] | 900 | } |
| 901 | |
| 902 | static void |
| 903 | test_surface_bad_configure_notification(struct test_context *ctx) |
| 904 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 905 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | ffcc452 | 2015-06-22 15:37:41 +0900 | [diff] [blame] | 906 | |
Ucan, Emre (ADITG/SW1) | c49aa5a | 2016-04-04 08:05:20 +0000 | [diff] [blame] | 907 | iassert(lyt->add_listener_configure_surface(NULL) == IVI_FAILED); |
Nobuhiko Tanibata | ffcc452 | 2015-06-22 15:37:41 +0900 | [diff] [blame] | 908 | } |
| 909 | |
| 910 | static void |
| 911 | test_layer_bad_create_notification(struct test_context *ctx) |
| 912 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 913 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | ffcc452 | 2015-06-22 15:37:41 +0900 | [diff] [blame] | 914 | |
Ucan, Emre (ADITG/SW1) | c98f2cf | 2016-04-04 08:05:12 +0000 | [diff] [blame] | 915 | iassert(lyt->add_listener_create_layer(NULL) == IVI_FAILED); |
Nobuhiko Tanibata | ffcc452 | 2015-06-22 15:37:41 +0900 | [diff] [blame] | 916 | } |
| 917 | |
| 918 | static void |
| 919 | test_surface_bad_create_notification(struct test_context *ctx) |
| 920 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 921 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | ffcc452 | 2015-06-22 15:37:41 +0900 | [diff] [blame] | 922 | |
Ucan, Emre (ADITG/SW1) | 970f831 | 2016-04-04 08:05:09 +0000 | [diff] [blame] | 923 | iassert(lyt->add_listener_create_surface(NULL) == IVI_FAILED); |
Nobuhiko Tanibata | ffcc452 | 2015-06-22 15:37:41 +0900 | [diff] [blame] | 924 | } |
| 925 | |
| 926 | static void |
| 927 | test_layer_bad_remove_notification(struct test_context *ctx) |
| 928 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 929 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | ffcc452 | 2015-06-22 15:37:41 +0900 | [diff] [blame] | 930 | |
Ucan, Emre (ADITG/SW1) | 562f2ec | 2016-04-04 08:05:15 +0000 | [diff] [blame] | 931 | iassert(lyt->add_listener_remove_layer(NULL) == IVI_FAILED); |
Nobuhiko Tanibata | ffcc452 | 2015-06-22 15:37:41 +0900 | [diff] [blame] | 932 | } |
| 933 | |
| 934 | static void |
| 935 | test_surface_bad_remove_notification(struct test_context *ctx) |
| 936 | { |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 937 | const struct ivi_layout_interface *lyt = ctx->layout_interface; |
Nobuhiko Tanibata | ffcc452 | 2015-06-22 15:37:41 +0900 | [diff] [blame] | 938 | |
Ucan, Emre (ADITG/SW1) | 67f0aa8 | 2016-04-04 08:05:18 +0000 | [diff] [blame] | 939 | iassert(lyt->add_listener_remove_surface(NULL) == IVI_FAILED); |
Nobuhiko Tanibata | ffcc452 | 2015-06-22 15:37:41 +0900 | [diff] [blame] | 940 | } |
| 941 | |
Pekka Paalanen | 46804ca | 2015-03-27 11:55:21 +0200 | [diff] [blame] | 942 | /************************ tests end ********************************/ |
| 943 | |
| 944 | static void |
| 945 | run_internal_tests(void *data) |
| 946 | { |
| 947 | struct test_context *ctx = data; |
| 948 | |
| 949 | test_surface_bad_visibility(ctx); |
Nobuhiko Tanibata | 16ed543 | 2015-06-22 15:33:59 +0900 | [diff] [blame] | 950 | test_surface_bad_destination_rectangle(ctx); |
Nobuhiko Tanibata | 16ed543 | 2015-06-22 15:33:59 +0900 | [diff] [blame] | 951 | test_surface_bad_source_rectangle(ctx); |
| 952 | test_surface_bad_properties(ctx); |
Pekka Paalanen | 46804ca | 2015-03-27 11:55:21 +0200 | [diff] [blame] | 953 | |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 954 | test_layer_create(ctx); |
| 955 | test_layer_visibility(ctx); |
| 956 | test_layer_opacity(ctx); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 957 | test_layer_dimension(ctx); |
| 958 | test_layer_position(ctx); |
| 959 | test_layer_destination_rectangle(ctx); |
| 960 | test_layer_source_rectangle(ctx); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 961 | test_layer_bad_remove(ctx); |
| 962 | test_layer_bad_visibility(ctx); |
| 963 | test_layer_bad_opacity(ctx); |
| 964 | test_layer_bad_destination_rectangle(ctx); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 965 | test_layer_bad_source_rectangle(ctx); |
| 966 | test_layer_bad_properties(ctx); |
| 967 | test_commit_changes_after_visibility_set_layer_destroy(ctx); |
| 968 | test_commit_changes_after_opacity_set_layer_destroy(ctx); |
Nobuhiko Tanibata | 17d4494 | 2015-06-22 15:35:12 +0900 | [diff] [blame] | 969 | test_commit_changes_after_source_rectangle_set_layer_destroy(ctx); |
| 970 | test_commit_changes_after_destination_rectangle_set_layer_destroy(ctx); |
| 971 | test_layer_create_duplicate(ctx); |
| 972 | test_get_layer_after_destory_layer(ctx); |
Nobuhiko Tanibata | 9e992d9 | 2015-06-22 15:34:18 +0900 | [diff] [blame] | 973 | |
Nobuhiko Tanibata | e78a7af | 2015-06-22 15:35:25 +0900 | [diff] [blame] | 974 | test_screen_render_order(ctx); |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 975 | test_screen_bad_render_order(ctx); |
Ucan, Emre (ADITG/SW1) | fbce2f5 | 2017-01-18 15:25:36 +0000 | [diff] [blame] | 976 | test_screen_add_layers(ctx); |
Michael Teyfel | 156bd06 | 2017-07-26 14:22:49 +0200 | [diff] [blame] | 977 | test_screen_remove_layer(ctx); |
| 978 | test_screen_bad_remove_layer(ctx); |
Nobuhiko Tanibata | 83c20bc | 2015-06-22 15:35:39 +0900 | [diff] [blame] | 979 | test_commit_changes_after_render_order_set_layer_destroy(ctx); |
| 980 | |
Nobuhiko Tanibata | 495c6ef | 2015-06-22 15:36:11 +0900 | [diff] [blame] | 981 | test_layer_properties_changed_notification(ctx); |
| 982 | test_layer_create_notification(ctx); |
| 983 | test_layer_remove_notification(ctx); |
Nobuhiko Tanibata | ffcc452 | 2015-06-22 15:37:41 +0900 | [diff] [blame] | 984 | test_layer_bad_properties_changed_notification(ctx); |
| 985 | test_surface_bad_configure_notification(ctx); |
| 986 | test_layer_bad_create_notification(ctx); |
| 987 | test_surface_bad_create_notification(ctx); |
| 988 | test_layer_bad_remove_notification(ctx); |
| 989 | test_surface_bad_remove_notification(ctx); |
Nobuhiko Tanibata | e78a7af | 2015-06-22 15:35:25 +0900 | [diff] [blame] | 990 | |
Pekka Paalanen | 46804ca | 2015-03-27 11:55:21 +0200 | [diff] [blame] | 991 | weston_compositor_exit_with_code(ctx->compositor, EXIT_SUCCESS); |
| 992 | free(ctx); |
| 993 | } |
| 994 | |
Pekka Paalanen | 46804ca | 2015-03-27 11:55:21 +0200 | [diff] [blame] | 995 | WL_EXPORT int |
Emre Ucan | 0707b0e | 2018-01-25 14:36:13 +0100 | [diff] [blame] | 996 | wet_module_init(struct weston_compositor *compositor, |
| 997 | int *argc, char *argv[]) |
Pekka Paalanen | 46804ca | 2015-03-27 11:55:21 +0200 | [diff] [blame] | 998 | { |
| 999 | struct wl_event_loop *loop; |
| 1000 | struct test_context *ctx; |
Emre Ucan | 0707b0e | 2018-01-25 14:36:13 +0100 | [diff] [blame] | 1001 | const struct ivi_layout_interface *iface; |
Pekka Paalanen | 46804ca | 2015-03-27 11:55:21 +0200 | [diff] [blame] | 1002 | |
Emre Ucan | 0707b0e | 2018-01-25 14:36:13 +0100 | [diff] [blame] | 1003 | iface = ivi_layout_get_api(compositor); |
| 1004 | |
| 1005 | if (!iface) { |
| 1006 | weston_log("fatal: cannot use ivi_layout_interface.\n"); |
Pekka Paalanen | 46804ca | 2015-03-27 11:55:21 +0200 | [diff] [blame] | 1007 | return -1; |
| 1008 | } |
| 1009 | |
| 1010 | ctx = zalloc(sizeof(*ctx)); |
| 1011 | if (!ctx) |
| 1012 | return -1; |
| 1013 | |
| 1014 | ctx->compositor = compositor; |
Ucan, Emre \(ADITG/SW1\) | 0c0e51e | 2015-10-15 14:51:41 +0000 | [diff] [blame] | 1015 | ctx->layout_interface = iface; |
Pekka Paalanen | 46804ca | 2015-03-27 11:55:21 +0200 | [diff] [blame] | 1016 | |
| 1017 | loop = wl_display_get_event_loop(compositor->wl_display); |
| 1018 | wl_event_loop_add_idle(loop, run_internal_tests, ctx); |
| 1019 | |
| 1020 | return 0; |
| 1021 | } |