Skip to content

Commit

Permalink
libibus: add test case for ibus_bus_get_engines_by_names.
Browse files Browse the repository at this point in the history
  • Loading branch information
phuang committed Feb 21, 2012
1 parent 006f386 commit c5721c6
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/tests/ibus-bus.c
Expand Up @@ -530,6 +530,36 @@ test_async_apis_finish (gpointer user_data)
return FALSE;
}

static void
test_get_engines_by_names (void)
{
IBusEngineDesc **engines = NULL;
const gchar *names[] = {
"xkb:us::eng",
"xkb:ca:eng:eng",
"xkb:fr::fra",
"xkb:jp::jpn",
NULL,
};

engines = ibus_bus_get_engines_by_names (bus, names);

g_assert(engines != NULL);
IBusEngineDesc **p;

gint i = 0;
for (p = engines; *p != NULL; p++) {
g_assert (IBUS_IS_ENGINE_DESC (*p));
g_assert_cmpstr (names[i], ==, ibus_engine_desc_get_name (*p));
i++;
g_object_unref (*p);
// The ref should be zero, *p is released.
g_assert (!IBUS_IS_ENGINE_DESC (*p));
}
g_free (engines);
engines = NULL;
}

static void
test_async_apis (void)
{
Expand Down Expand Up @@ -584,6 +614,7 @@ main (gint argc,
g_test_add_func ("/ibus/list-active-engines", test_list_active_engines);
g_test_add_func ("/ibus/create-input-context-async",
test_create_input_context_async);
g_test_add_func ("/ibus/get-engines-by-names", test_get_engines_by_names);
g_test_add_func ("/ibus/async-apis", test_async_apis);

result = g_test_run ();
Expand Down

0 comments on commit c5721c6

Please sign in to comment.