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