summaryrefslogtreecommitdiff
path: root/tests/test-bluetooth-device.c
blob: a9f0ed0b695c814444391bf78ae5c52da0e4b109 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 * Copyright (C) 2021 Bastien Nocera <hadess@hadess.net>
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

#include <gio/gio.h>
#include <glib/gi18n.h>

#include "bluetooth-device.h"

static void
test_device (void)
{
	BluetoothDevice *device;
	GDBusProxy *proxy;
	const char *uuids[] = {
		"OBEXFileTransfer",
		NULL
	};
	const char *new_uuids[] = {
		"AudioSource",
		NULL
	};

	proxy = g_object_new (G_TYPE_DBUS_PROXY, NULL);
	g_assert_nonnull (proxy);
	device = g_object_new (BLUETOOTH_TYPE_DEVICE,
			       "proxy", proxy,
			       "name", "Fake Name",
			       "alias", "Changed Fake Name",
			       "address", "00:11:22:33:44",
			       "type", BLUETOOTH_TYPE_KEYBOARD,
			       "icon", "phone",
			       "paired", TRUE,
			       "trusted", TRUE,
			       "connected", FALSE,
			       "legacy-pairing", FALSE,
			       "uuids", uuids,
			       NULL);
	g_object_set (G_OBJECT (device),
		      "uuids", new_uuids,
		      NULL);
	g_object_unref (device);
}

int main (int argc, char **argv)
{
	g_test_init (&argc, &argv, NULL);
	g_test_add_func ("/bluetooth/device", test_device);

	return g_test_run ();
}