[gspell] tests: add test-spell-basic to test the new basic_setup() function



commit b4cd3b5b26abd2181bc74d34f57cdc63c4ee565c
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Mon Aug 8 17:10:14 2016 +0200

    tests: add test-spell-basic to test the new basic_setup() function

 tests/Makefile.am        |   17 +++++++++-----
 tests/test-spell-basic.c |   56 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+), 6 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 088955a..2df7b20 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -6,13 +6,18 @@ AM_CPPFLAGS =                         \
 
 AM_LDFLAGS = $(WARN_LDFLAGS)
 
-noinst_PROGRAMS = $(TEST_PROGS)
-
-TEST_PROGS = test-spell
-test_spell_SOURCES = test-spell.c
-test_spell_LDADD =                                                     \
-       $(top_builddir)/gspell/libgspell-@GSPELL_API_VERSION@.la        \
+LDADD =        $(top_builddir)/gspell/libgspell-@GSPELL_API_VERSION@.la        \
        $(DEP_LIBS)                                                     \
        $(GTK_MAC_LIBS)
 
+TEST_PROGS =
+
+TEST_PROGS += test-spell
+test_spell_SOURCES = test-spell.c
+
+TEST_PROGS += test-spell-basic
+test_spell_basic_SOURCES = test-spell-basic.c
+
+noinst_PROGRAMS = $(TEST_PROGS)
+
 -include $(top_srcdir)/git.mk
diff --git a/tests/test-spell-basic.c b/tests/test-spell-basic.c
new file mode 100644
index 0000000..4e2da36
--- /dev/null
+++ b/tests/test-spell-basic.c
@@ -0,0 +1,56 @@
+/*
+ * This file is part of gspell, a spell-checking library.
+ *
+ * Copyright 2016 - Sébastien Wilmet <swilmet gnome org>
+ *
+ * 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.1 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gspell/gspell.h>
+
+gint
+main (gint    argc,
+      gchar **argv)
+{
+       GtkWidget *window;
+       GtkWidget *scrolled_window;
+       GtkTextView *gtk_view;
+       GspellTextView *gspell_view;
+
+       gtk_init (&argc, &argv);
+
+       window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+       gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
+       g_signal_connect (window, "destroy", gtk_main_quit, NULL);
+
+       gtk_view = GTK_TEXT_VIEW (gtk_text_view_new ());
+       gspell_view = gspell_text_view_get_from_gtk_text_view (gtk_view);
+       gspell_text_view_basic_setup (gspell_view);
+
+       scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+       g_object_set (scrolled_window,
+                     "expand", TRUE,
+                     "margin", 6,
+                     NULL);
+
+       gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (gtk_view));
+       gtk_container_add (GTK_CONTAINER (window), scrolled_window);
+       gtk_widget_show_all (window);
+
+       gtk_main ();
+
+       return 0;
+}
+
+/* ex:set ts=8 noet: */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]