blob: 65c5b0d3e93a2be98457f548068b5dd9f6e51b68 [file] [log] [blame]
Pekka Paalanen0eb09412015-03-23 13:55:06 +02001/*
2 * Copyright © 2015 Collabora, Ltd.
3 *
Bryce Harrington2cc92972015-06-11 15:39:40 -07004 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
Pekka Paalanen0eb09412015-03-23 13:55:06 +020011 *
Bryce Harrington2cc92972015-06-11 15:39:40 -070012 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial
14 * portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
Pekka Paalanen0eb09412015-03-23 13:55:06 +020024 */
25
26#include "config.h"
27
28#include <stdio.h>
29#include <string.h>
30
31#include "weston-test-client-helper.h"
32#include "ivi-application-client-protocol.h"
Pekka Paalanen431ec062019-11-11 17:17:57 +020033#include "weston-test-fixture-compositor.h"
34#include "test-config.h"
35
36static enum test_result_code
37fixture_setup(struct weston_test_harness *harness)
38{
39 struct compositor_setup setup;
40
41 compositor_setup_defaults(&setup);
42 setup.shell = SHELL_IVI;
Pekka Paalanen080d85b2020-01-24 13:14:27 +020043 setup.logging_scopes = "log,test-harness-plugin,proto";
Pekka Paalanen431ec062019-11-11 17:17:57 +020044
Igor Matheus Andrade Torrented8e09af2020-09-07 11:19:01 -030045 weston_ini_setup(&setup,
46 cfgln("[core]"),
47 cfgln("shell=%s", "ivi-shell.so"),
48 cfgln("modules=", "hmi-controller.so"),
49
50 cfgln("[ivi-shell]"),
51 cfgln("ivi-shell-user-interface=%s", "weston-ivi-shell-user-interface"),
52 cfgln("cursor-theme=%s", "default"),
53 cfgln("cursor-size=%d", 32),
54 cfgln("base-layer-id=%d", 1000),
55 cfgln("base-layer-id-offset=%d", 10000),
56 cfgln("workspace-background-layer-id=%d", 2000),
57 cfgln("workspace-layer-id=%d", 3000),
58 cfgln("application-layer-id=%d", 4000),
59 cfgln("transition-duration=%d", 300),
60 cfgln("background-image=%s", WESTON_DATA_DIR "/background.png"),
61 cfgln("background-id=%d", 1001),
62 cfgln("panel-image=%s", WESTON_DATA_DIR "/panel.png"),
63 cfgln("panel-id=%d", 1002),
64 cfgln("surface-id-offset=%d", 10),
65 cfgln("tiling-image=%s", WESTON_DATA_DIR "/tiling.png"),
66 cfgln("tiling-id=%d", 1003),
67 cfgln("sidebyside-image=%s", WESTON_DATA_DIR "/sidebyside.png"),
68 cfgln("sidebyside-id=%d", 1004),
69 cfgln("fullscreen-image=%s", WESTON_DATA_DIR "/fullscreen.png"),
70 cfgln("fullscreen-id=%d", 1005),
71 cfgln("random-image=%s", WESTON_DATA_DIR "/random.png"),
72 cfgln("random-id=%d", 1006),
73 cfgln("home-image=%s", WESTON_DATA_DIR "/home.png"),
74 cfgln("home-id=%d", 1007),
75 cfgln("workspace-background-color=%s", "0x99000000"),
76 cfgln("workspace-background-id=%d", 2001),
77
78 cfgln("[ivi-launcher]"),
79 cfgln("workspace-id=%d", 0),
80 cfgln("icon-id=%d", 4001),
81 cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_flower.png"),
82 cfgln("path=%s", BINDIR "/weston-flower"),
83
84 cfgln("[ivi-launcher]"),
85 cfgln("workspace-id=%d", 0),
86 cfgln("icon-id=%d", 4002),
87 cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_clickdot.png"),
88 cfgln("path=%s", BINDIR "/weston-clickdot"),
89
90 cfgln("[ivi-launcher]"),
91 cfgln("workspace-id=%d", 1),
92 cfgln("icon-id=%d", 4003),
93 cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_simple-egl.png"),
94 cfgln("path=%s", BINDIR "/weston-simple-egl"),
95
96 cfgln("[ivi-launcher]"),
97 cfgln("workspace-id=%d", 1),
98 cfgln("icon-id=%d", 4004),
99 cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_simple-shm.png"),
100 cfgln("path=%s", BINDIR "/weston-simple-shm"),
101
102 cfgln("[ivi-launcher]"),
103 cfgln("workspace-id=%d", 2),
104 cfgln("icon-id=%d", 4005),
105 cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_smoke.png"),
106 cfgln("path=%s", BINDIR "/weston-smoke"),
107
108 cfgln("[ivi-launcher]"),
109 cfgln("workspace-id=%d", 3),
110 cfgln("icon-id=%d", 4006),
111 cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_flower.png"),
112 cfgln("path=%s", BINDIR "/weston-flower"),
113
114 cfgln("[ivi-launcher]"),
115 cfgln("workspace-id=%d", 3),
116 cfgln("icon-id=%d", 4007),
117 cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_clickdot.png"),
118 cfgln("path=%s", BINDIR "/weston-clickdot"),
119
120 cfgln("[ivi-launcher]"),
121 cfgln("workspace-id=%d", 3),
122 cfgln("icon-id=%d", 4008),
123 cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_simple-egl.png"),
124 cfgln("path=%s", BINDIR "/weston-simple-egl"),
125
126 cfgln("[ivi-launcher]"),
127 cfgln("workspace-id=%d", 3),
128 cfgln("icon-id=%d", 4009),
129 cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_simple-shm.png"),
130 cfgln("path=%s", BINDIR "/weston-simple-shm"),
131
132 cfgln("[ivi-launcher]"),
133 cfgln("workspace-id=%d", 3),
134 cfgln("icon-id=%d", 4010),
135 cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_smoke.png"),
136 cfgln("path=%s", BINDIR "/weston-smoke")
137 );
138
Pekka Paalanen431ec062019-11-11 17:17:57 +0200139 return weston_test_harness_execute_as_client(harness, &setup);
140}
141DECLARE_FIXTURE_SETUP(fixture_setup);
Pekka Paalanen0eb09412015-03-23 13:55:06 +0200142
143static struct ivi_application *
144get_ivi_application(struct client *client)
145{
146 struct global *g;
147 struct global *global_iviapp = NULL;
Pekka Paalanen9551dd72019-11-05 16:47:10 +0200148 struct ivi_application *iviapp;
Pekka Paalanen0eb09412015-03-23 13:55:06 +0200149
150 wl_list_for_each(g, &client->global_list, link) {
151 if (strcmp(g->interface, "ivi_application"))
152 continue;
153
154 if (global_iviapp)
155 assert(0 && "multiple ivi_application objects");
156
157 global_iviapp = g;
158 }
159
160 assert(global_iviapp && "no ivi_application found");
161
162 assert(global_iviapp->version == 1);
163
164 iviapp = wl_registry_bind(client->wl_registry, global_iviapp->name,
165 &ivi_application_interface, 1);
166 assert(iviapp);
167
168 return iviapp;
169}
170
171TEST(ivi_application_exists)
172{
173 struct client *client;
174 struct ivi_application *iviapp;
175
176 client = create_client();
177 iviapp = get_ivi_application(client);
178 client_roundtrip(client);
179
Pekka Paalanen12a138d2019-11-06 15:59:33 +0200180 testlog("Successful bind: %p\n", iviapp);
Pekka Paalanen080d85b2020-01-24 13:14:27 +0200181
Pekka Paalanenb64d4112021-06-15 16:20:08 +0300182 ivi_application_destroy(iviapp);
Pekka Paalanen080d85b2020-01-24 13:14:27 +0200183 client_destroy(client);
Pekka Paalanen0eb09412015-03-23 13:55:06 +0200184}