blob: 638f8746a9d44fb7b2d56bb1b92b2d7d66cd77c9 [file] [log] [blame]
Pekka Paalanen0eb09412015-03-23 13:55:06 +02001/*
2 * Copyright © 2015 Collabora, Ltd.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and
5 * its documentation for any purpose is hereby granted without fee, provided
6 * that the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of the copyright holders not be used in
9 * advertising or publicity pertaining to distribution of the software
10 * without specific, written prior permission. The copyright holders make
11 * no representations about the suitability of this software for any
12 * purpose. It is provided "as is" without express or implied warranty.
13 *
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
15 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
17 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
18 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
19 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
20 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 */
22
23#include "config.h"
24
25#include <stdio.h>
26#include <string.h>
27
28#include "weston-test-client-helper.h"
29#include "ivi-application-client-protocol.h"
30
31static struct ivi_application *
32get_ivi_application(struct client *client)
33{
34 struct global *g;
35 struct global *global_iviapp = NULL;
36 static struct ivi_application *iviapp;
37
38 if (iviapp)
39 return iviapp;
40
41 wl_list_for_each(g, &client->global_list, link) {
42 if (strcmp(g->interface, "ivi_application"))
43 continue;
44
45 if (global_iviapp)
46 assert(0 && "multiple ivi_application objects");
47
48 global_iviapp = g;
49 }
50
51 assert(global_iviapp && "no ivi_application found");
52
53 assert(global_iviapp->version == 1);
54
55 iviapp = wl_registry_bind(client->wl_registry, global_iviapp->name,
56 &ivi_application_interface, 1);
57 assert(iviapp);
58
59 return iviapp;
60}
61
62TEST(ivi_application_exists)
63{
64 struct client *client;
65 struct ivi_application *iviapp;
66
67 client = create_client();
68 iviapp = get_ivi_application(client);
69 client_roundtrip(client);
70
71 printf("Successful bind: %p\n", iviapp);
72}