ivi-shell-app-test.c 5.92 KB
Newer Older
1
2
3
/*
 * Copyright © 2015 Collabora, Ltd.
 *
4
5
6
7
8
9
10
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
11
 *
12
13
14
15
16
17
18
19
20
21
22
23
 * The above copyright notice and this permission notice (including the
 * next paragraph) shall be included in all copies or substantial
 * portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
24
25
26
27
28
29
30
31
32
 */

#include "config.h"

#include <stdio.h>
#include <string.h>

#include "weston-test-client-helper.h"
#include "ivi-application-client-protocol.h"
Pekka Paalanen's avatar
Pekka Paalanen committed
33
34
35
36
37
38
39
40
41
42
#include "weston-test-fixture-compositor.h"
#include "test-config.h"

static enum test_result_code
fixture_setup(struct weston_test_harness *harness)
{
	struct compositor_setup setup;

	compositor_setup_defaults(&setup);
	setup.shell = SHELL_IVI;
43
	setup.logging_scopes = "log,test-harness-plugin,proto";
Pekka Paalanen's avatar
Pekka Paalanen committed
44

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
	weston_ini_setup(&setup,
			 cfgln("[core]"),
			 cfgln("shell=%s", "ivi-shell.so"),
			 cfgln("modules=", "hmi-controller.so"),

			 cfgln("[ivi-shell]"),
			 cfgln("ivi-shell-user-interface=%s", "weston-ivi-shell-user-interface"),
			 cfgln("cursor-theme=%s", "default"),
			 cfgln("cursor-size=%d", 32),
			 cfgln("base-layer-id=%d", 1000),
			 cfgln("base-layer-id-offset=%d", 10000),
			 cfgln("workspace-background-layer-id=%d", 2000),
			 cfgln("workspace-layer-id=%d", 3000),
			 cfgln("application-layer-id=%d", 4000),
			 cfgln("transition-duration=%d", 300),
			 cfgln("background-image=%s", WESTON_DATA_DIR "/background.png"),
			 cfgln("background-id=%d", 1001),
			 cfgln("panel-image=%s", WESTON_DATA_DIR "/panel.png"),
			 cfgln("panel-id=%d", 1002),
			 cfgln("surface-id-offset=%d", 10),
			 cfgln("tiling-image=%s", WESTON_DATA_DIR "/tiling.png"),
			 cfgln("tiling-id=%d", 1003),
			 cfgln("sidebyside-image=%s", WESTON_DATA_DIR "/sidebyside.png"),
			 cfgln("sidebyside-id=%d", 1004),
			 cfgln("fullscreen-image=%s", WESTON_DATA_DIR "/fullscreen.png"),
			 cfgln("fullscreen-id=%d", 1005),
			 cfgln("random-image=%s", WESTON_DATA_DIR "/random.png"),
			 cfgln("random-id=%d", 1006),
			 cfgln("home-image=%s", WESTON_DATA_DIR "/home.png"),
			 cfgln("home-id=%d", 1007),
			 cfgln("workspace-background-color=%s", "0x99000000"),
			 cfgln("workspace-background-id=%d", 2001),

			 cfgln("[ivi-launcher]"),
			 cfgln("workspace-id=%d", 0),
			 cfgln("icon-id=%d", 4001),
			 cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_flower.png"),
			 cfgln("path=%s", BINDIR "/weston-flower"),

			 cfgln("[ivi-launcher]"),
			 cfgln("workspace-id=%d", 0),
			 cfgln("icon-id=%d", 4002),
			 cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_clickdot.png"),
			 cfgln("path=%s", BINDIR "/weston-clickdot"),

			 cfgln("[ivi-launcher]"),
			 cfgln("workspace-id=%d", 1),
			 cfgln("icon-id=%d", 4003),
			 cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_simple-egl.png"),
			 cfgln("path=%s", BINDIR "/weston-simple-egl"),

			 cfgln("[ivi-launcher]"),
			 cfgln("workspace-id=%d", 1),
			 cfgln("icon-id=%d", 4004),
			 cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_simple-shm.png"),
			 cfgln("path=%s", BINDIR "/weston-simple-shm"),

			 cfgln("[ivi-launcher]"),
			 cfgln("workspace-id=%d", 2),
			 cfgln("icon-id=%d", 4005),
			 cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_smoke.png"),
			 cfgln("path=%s", BINDIR "/weston-smoke"),

			 cfgln("[ivi-launcher]"),
			 cfgln("workspace-id=%d", 3),
			 cfgln("icon-id=%d", 4006),
			 cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_flower.png"),
			 cfgln("path=%s", BINDIR "/weston-flower"),

			 cfgln("[ivi-launcher]"),
			 cfgln("workspace-id=%d", 3),
			 cfgln("icon-id=%d", 4007),
			 cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_clickdot.png"),
			 cfgln("path=%s", BINDIR "/weston-clickdot"),

			 cfgln("[ivi-launcher]"),
			 cfgln("workspace-id=%d", 3),
			 cfgln("icon-id=%d", 4008),
			 cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_simple-egl.png"),
			 cfgln("path=%s", BINDIR "/weston-simple-egl"),

			 cfgln("[ivi-launcher]"),
			 cfgln("workspace-id=%d", 3),
			 cfgln("icon-id=%d", 4009),
			 cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_simple-shm.png"),
			 cfgln("path=%s", BINDIR "/weston-simple-shm"),

			 cfgln("[ivi-launcher]"),
			 cfgln("workspace-id=%d", 3),
			 cfgln("icon-id=%d", 4010),
			 cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_smoke.png"),
			 cfgln("path=%s", BINDIR "/weston-smoke")
			);

Pekka Paalanen's avatar
Pekka Paalanen committed
139
140
141
	return weston_test_harness_execute_as_client(harness, &setup);
}
DECLARE_FIXTURE_SETUP(fixture_setup);
142
143
144
145
146
147

static struct ivi_application *
get_ivi_application(struct client *client)
{
	struct global *g;
	struct global *global_iviapp = NULL;
148
	struct ivi_application *iviapp;
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179

	wl_list_for_each(g, &client->global_list, link) {
		if (strcmp(g->interface, "ivi_application"))
			continue;

		if (global_iviapp)
			assert(0 && "multiple ivi_application objects");

		global_iviapp = g;
	}

	assert(global_iviapp && "no ivi_application found");

	assert(global_iviapp->version == 1);

	iviapp = wl_registry_bind(client->wl_registry, global_iviapp->name,
				  &ivi_application_interface, 1);
	assert(iviapp);

	return iviapp;
}

TEST(ivi_application_exists)
{
	struct client *client;
	struct ivi_application *iviapp;

	client = create_client();
	iviapp = get_ivi_application(client);
	client_roundtrip(client);

180
	testlog("Successful bind: %p\n", iviapp);
181
182

	client_destroy(client);
183
}