blob: 40ef8ae9e05f7b3e481fa333ac13a021c81e4c4c (
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
|
#include <gtk/gtk.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/x11/gdkx.h>
#endif
static void
test_to_text_list (void)
{
#ifdef GDK_WINDOWING_X11
GdkDisplay *display;
display = gdk_display_get_default ();
if (GDK_IS_X11_DISPLAY (display))
{
const char *encoding;
int format;
const guchar *text;
int length;
char **list;
int n;
encoding = g_intern_string ("UTF8_STRING");
format = 8;
text = (const guchar*)"abcdef \304\201 \304\205\0ABCDEF \304\200 \304\204";
length = 25;
n = gdk_x11_display_text_property_to_text_list (display, encoding, format, text, length, &list);
g_assert_cmpint (n, ==, 2);
g_assert (g_str_has_prefix (list[0], "abcdef "));
g_assert (g_str_has_prefix (list[1], "ABCDEF "));
gdk_x11_free_text_list (list);
}
#endif
}
int
main (int argc, char *argv[])
{
g_test_init (&argc, &argv, NULL);
gtk_init ();
g_test_add_func ("/encoding/to-text-list", test_to_text_list);
return g_test_run ();
}
|