Finish XML layout engine.
This commit is contained in:
@ -18,7 +18,7 @@
|
||||
|
||||
INCLUDES = -I$(top_srcdir) $(GIO2_CFLAGS) $(GTK_CFLAGS) $(XKB_CFLAGS)
|
||||
|
||||
TESTS = eek-simple-test eek-xkb-test
|
||||
TESTS = eek-simple-test eek-xkb-test eek-xml-test
|
||||
noinst_PROGRAMS = $(TESTS)
|
||||
|
||||
eek_simple_test_SOURCES = eek-simple-test.c
|
||||
@ -26,3 +26,6 @@ eek_simple_test_LDADD = $(top_builddir)/eek/libeek.la
|
||||
|
||||
eek_xkb_test_SOURCES = eek-xkb-test.c
|
||||
eek_xkb_test_LDADD = $(top_builddir)/eek/libeek.la $(top_builddir)/eek/libeek-xkb.la
|
||||
|
||||
eek_xml_test_SOURCES = eek-xml-test.c
|
||||
eek_xml_test_LDADD = $(top_builddir)/eek/libeek.la $(top_builddir)/eek/libeek-xkl.la
|
||||
|
||||
71
tests/eek-xml-test.c
Normal file
71
tests/eek-xml-test.c
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
#include "eek/eek-xml.h"
|
||||
#include "eek/eek-xkl.h"
|
||||
|
||||
/* For gdk_x11_display_get_xdisplay(). See main(). */
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
test_output_parse (void)
|
||||
{
|
||||
GString *output;
|
||||
GInputStream *input;
|
||||
EekLayout *layout;
|
||||
EekKeyboard *keyboard;
|
||||
|
||||
output = g_string_sized_new (8192);
|
||||
|
||||
layout = eek_xkl_layout_new ();
|
||||
|
||||
keyboard = eek_keyboard_new (layout, 640, 480);
|
||||
g_object_unref (layout);
|
||||
|
||||
eek_keyboard_output (keyboard, output, 0);
|
||||
g_object_unref (keyboard);
|
||||
|
||||
#if 0
|
||||
fwrite (output->str, sizeof(gchar), output->len, stdout);
|
||||
#endif
|
||||
|
||||
input = g_memory_input_stream_new_from_data (output->str,
|
||||
output->len,
|
||||
NULL);
|
||||
layout = eek_xml_layout_new (input);
|
||||
g_object_unref (input);
|
||||
|
||||
keyboard = eek_keyboard_new (layout, 640, 480);
|
||||
g_object_unref (layout);
|
||||
g_object_unref (keyboard);
|
||||
|
||||
g_string_free (output, TRUE);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
g_type_init ();
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
gtk_init (&argc, &argv); /* for gdk_x11_display_get_xdisplay() */
|
||||
|
||||
g_test_add_func ("/eek-xml-test/output-parse", test_output_parse);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
Reference in New Issue
Block a user