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