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