summaryrefslogtreecommitdiffstats
path: root/src/test-lookuptable.c
blob: 731f74bfd42e73ac6d0ce00ee161c501094a5319 (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
#include "ibus.h"

int main()
{
	g_type_init ();
	IBusLookupTable *table, *table1;
	IBusMessage *message;
	IBusError *error;
	gboolean retval;

	table = ibus_lookup_table_new (9, 0, TRUE, FALSE);
	ibus_lookup_table_append_candidate (table, ibus_text_new_from_static_string ("Hello"));
	ibus_lookup_table_append_candidate (table, ibus_text_new_from_static_string ("Cool"));

	message = ibus_message_new (DBUS_MESSAGE_TYPE_METHOD_CALL);

	retval = ibus_message_append_args (message,
									   IBUS_TYPE_LOOKUP_TABLE, &table,
									   IBUS_TYPE_LOOKUP_TABLE, &table,
									   G_TYPE_INVALID);
	g_assert (retval);

	g_object_unref (table);
	table = table1 = NULL;

	retval = ibus_message_get_args (message,
								    &error,
								    IBUS_TYPE_LOOKUP_TABLE, &table,
								    IBUS_TYPE_LOOKUP_TABLE, &table1,
									G_TYPE_INVALID);
	g_assert (retval);
	g_assert (table);
	g_assert (table1);

	g_object_unref (table);
	g_object_unref (table1);

	return 0;
}