Add test case for stylehint size bug
authorPhilip Chimento <philip.chimento@gmail.com>
Wed, 5 Jan 2011 18:36:30 +0000 (13:36 -0500)
committerPhilip Chimento <philip.chimento@gmail.com>
Wed, 5 Jan 2011 18:36:30 +0000 (13:36 -0500)
Setting a "size" stylehint on a style makes any text printed in that
style invisible. This is a test case for that bug.

tests/Makefile.am
tests/test-userstyle.c [new file with mode: 0644]

index 0300609191e20023fe7ba45c99594dd6fcff52bf..5a55db20e75c0a57e615c2a82b56cfaf9cd92381 100644 (file)
@@ -29,7 +29,8 @@ test_close_SOURCES = test-close.c
 test_close_CFLAGS = @TEST_CFLAGS@ $(AM_CFLAGS)
 test_close_LDADD = @TEST_LIBS@ $(top_builddir)/libchimara/libchimara.la
 
-noinst_LTLIBRARIES = first.la model.la gridtest.la splittest.la multiwin.la styletest.la
+noinst_LTLIBRARIES = first.la model.la gridtest.la splittest.la multiwin.la \
+       styletest.la test-userstyle.la
 
 first_la_SOURCES = first.c
 first_la_LDFLAGS = $(TEST_PLUGIN_LIBTOOL_FLAGS)
@@ -48,3 +49,6 @@ multiwin_la_LDFLAGS = $(TEST_PLUGIN_LIBTOOL_FLAGS)
 
 styletest_la_SOURCES = styletest.c
 styletest_la_LDFLAGS = $(TEST_PLUGIN_LIBTOOL_FLAGS)
+
+test_userstyle_la_SOURCES = test-userstyle.c
+test_userstyle_la_LDFLAGS = $(TEST_PLUGIN_LIBTOOL_FLAGS)
diff --git a/tests/test-userstyle.c b/tests/test-userstyle.c
new file mode 100644 (file)
index 0000000..c3a32c4
--- /dev/null
@@ -0,0 +1,25 @@
+#include <libchimara/glk.h>
+
+winid_t mainwin;
+
+void 
+glk_main(void)
+{
+       /* Create user style before creating windows */
+       glk_stylehint_set(wintype_AllTypes, style_User1, stylehint_Size, -1);
+       glk_stylehint_set(wintype_AllTypes, style_User2, stylehint_Size, 0);
+       
+       mainwin = glk_window_open(0, 0, 0, wintype_TextBuffer, 0);
+       if(!mainwin)
+               return;
+       glk_set_window(mainwin);
+
+       glk_set_style(style_User1);
+       glk_put_string("This text is in User1 and slightly smaller");
+       glk_set_style(style_Normal);
+       glk_put_string(".\n");
+       glk_set_style(style_User2);
+       glk_put_string("This test is in User2 at normal size");
+       glk_set_style(style_Normal);
+       glk_put_string(".\n");
+}