Line | Branch | Exec | Source |
---|---|---|---|
1 | /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- | ||
2 | * | ||
3 | * Copyright © 2017 Endless Mobile, Inc. | ||
4 | * | ||
5 | * SPDX-License-Identifier: LGPL-2.1-or-later | ||
6 | * | ||
7 | * This library is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU Lesser General Public | ||
9 | * License as published by the Free Software Foundation; either | ||
10 | * version 2.1 of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * This library is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * Lesser General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU Lesser General Public | ||
18 | * License along with this library; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | * | ||
21 | * Authors: | ||
22 | * - Philip Withnall <withnall@endlessm.com> | ||
23 | */ | ||
24 | |||
25 | #include "config.h" | ||
26 | |||
27 | #include <glib.h> | ||
28 | #include <gio/gio.h> | ||
29 | #include <libgsystemservice/service.h> | ||
30 | #include <locale.h> | ||
31 | |||
32 | |||
33 | /* Test subclass of #GssService. */ | ||
34 | #define TEST_TYPE_SERVICE test_service_get_type () | ||
35 | G_DECLARE_FINAL_TYPE (TestService, test_service, TEST, SERVICE, GssService) | ||
36 | |||
37 | struct _TestService | ||
38 | { | ||
39 | GssService parent; | ||
40 | }; | ||
41 | |||
42 |
4/7✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
|
6 | G_DEFINE_TYPE (TestService, test_service, GSS_TYPE_SERVICE) |
43 | |||
44 | static void | ||
45 | 1 | test_service_class_init (TestServiceClass *klass) | |
46 | { | ||
47 | 1 | } | |
48 | |||
49 | static void | ||
50 | 1 | test_service_init (TestService *self) | |
51 | { | ||
52 | 1 | } | |
53 | |||
54 | /* Test constructing an #GssService object. Print its address to stop the | ||
55 | * compiler complaining about an unused variable. */ | ||
56 | static void | ||
57 | 1 | test_service_construction (void) | |
58 | { | ||
59 | 1 | g_autoptr(GssService) service = NULL; | |
60 | 1 | service = g_object_new (TEST_TYPE_SERVICE, | |
61 | "service-id", "org.gnome.libgsystemservice.tests.Service", | ||
62 | "translation-domain", "domain", | ||
63 | "parameter-string", "Blah", | ||
64 | NULL); | ||
65 | 1 | g_test_message ("Service constructed as %p", (void *)service); | |
66 | 1 | } | |
67 | |||
68 | int | ||
69 | 1 | main (int argc, | |
70 | char **argv) | ||
71 | { | ||
72 | 1 | setlocale (LC_ALL, ""); | |
73 | 1 | g_test_init (&argc, &argv, NULL); | |
74 | |||
75 | 1 | g_test_add_func ("/service/construction", test_service_construction); | |
76 | |||
77 | 1 | return g_test_run (); | |
78 | } | ||
79 |