2016-12-28 13:53:22 +00:00
|
|
|
#include <gtk/gtk.h>
|
2010-12-24 21:27:31 +00:00
|
|
|
#ifdef GDK_WINDOWING_X11
|
2011-01-04 23:20:53 +00:00
|
|
|
#include <gdk/x11/gdkx.h>
|
2010-12-24 21:27:31 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
static void
|
|
|
|
test_to_text_list (void)
|
|
|
|
{
|
2014-08-13 15:51:43 +00:00
|
|
|
#ifdef GDK_WINDOWING_X11
|
2010-12-24 21:27:31 +00:00
|
|
|
GdkDisplay *display;
|
|
|
|
|
|
|
|
display = gdk_display_get_default ();
|
|
|
|
|
|
|
|
if (GDK_IS_X11_DISPLAY (display))
|
|
|
|
{
|
2020-02-23 00:54:38 +00:00
|
|
|
const char *encoding;
|
2010-12-24 21:27:31 +00:00
|
|
|
gint format;
|
|
|
|
const guchar *text;
|
|
|
|
gint length;
|
|
|
|
gchar **list;
|
|
|
|
gint n;
|
|
|
|
|
2017-12-14 04:39:03 +00:00
|
|
|
encoding = g_intern_string ("UTF8_STRING");
|
2010-12-24 21:27:31 +00:00
|
|
|
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);
|
2016-12-28 13:53:22 +00:00
|
|
|
gtk_init ();
|
2010-12-24 21:27:31 +00:00
|
|
|
|
|
|
|
g_test_add_func ("/encoding/to-text-list", test_to_text_list);
|
|
|
|
|
|
|
|
return g_test_run ();
|
|
|
|
}
|