1 /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
2 /* vim:set et sts=4: */
3 /* ibus - The Input Bus
4 * Copyright (C) 2011 Google, Inc.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
25 static IBusBus *bus = NULL;
28 create_finish_success (GObject *object,
32 g_assert (object == (GObject *)bus);
33 g_assert (user_data == NULL);
36 IBusInputContext *context = NULL;
37 context = ibus_bus_create_input_context_async_finish (bus, res, &error);
39 g_assert (IBUS_IS_INPUT_CONTEXT (context));
40 g_object_unref (context);
45 create_finish_failed (GObject *object,
49 g_assert (object == (GObject *)bus);
50 g_assert (user_data == NULL);
53 IBusInputContext *context = NULL;
54 context = ibus_bus_create_input_context_async_finish (bus, res, &error);
56 g_assert (context == NULL);
57 g_assert (error != NULL);
58 g_debug ("error = %s", error->message);
66 ibus_bus_create_input_context_async (bus,
70 create_finish_success,
79 ibus_bus_create_input_context_async (bus,
85 GDBusConnection *connection = ibus_bus_get_connection (bus);
86 g_dbus_connection_flush_sync (connection, NULL, NULL);
87 g_dbus_connection_close_sync (connection, NULL, NULL);
97 g_test_init (&argc, &argv, NULL);
98 bus = ibus_bus_new ();
100 g_test_add_func ("/ibus/input_context_async_create_success", test_success);
101 g_test_add_func ("/ibus/input_context_async_create_failed", test_failed);
103 result = g_test_run ();
104 g_object_unref (bus);