From 077b2a3c760d3c7c2fcab34d54eb74ee8744ed77 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Wed, 5 Jan 2011 13:36:30 -0500 Subject: [PATCH] Add test case for stylehint size bug 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 | 6 +++++- tests/test-userstyle.c | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 tests/test-userstyle.c diff --git a/tests/Makefile.am b/tests/Makefile.am index 0300609..5a55db2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 index 0000000..c3a32c4 --- /dev/null +++ b/tests/test-userstyle.c @@ -0,0 +1,25 @@ +#include + +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"); +} -- 2.30.2