]> Pileus Git - ~andy/gtk/commitdiff
Add a test for AtkUtil functions
authorMatthias Clasen <mclasen@redhat.com>
Sat, 9 Jul 2011 03:21:53 +0000 (23:21 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 9 Jul 2011 03:21:53 +0000 (23:21 -0400)
This test revealed the horrors commented on in the previous
commit.

tests/a11y/Makefile.am
tests/a11y/util.c [new file with mode: 0644]

index 3ec5fc2475b7a69ff6763a5630de5aa2eaeb0816..817c5842651a111b37ee66aa85eb04b0aaad7576 100644 (file)
@@ -8,6 +8,7 @@ AM_CPPFLAGS =                           \
        -I$(top_srcdir)/gdk             \
        -DGDK_DISABLE_DEPRECATED        \
        -DGTK_DISABLE_DEPRECATED        \
+       -DGTK_VERSION=\"$(GTK_VERSION)\"\
        $(GTK_DEBUG_FLAGS)              \
        $(GTK_DEP_CFLAGS)
 
@@ -26,6 +27,8 @@ TEST_PROGS += children
 
 TEST_PROGS += focus
 
+TEST_PROGS += util
+
 EXTRA_DIST += \
        hello-world.ui hello-world.txt \
        mnemonic.ui mnemonic.txt \
diff --git a/tests/a11y/util.c b/tests/a11y/util.c
new file mode 100644 (file)
index 0000000..7128fba
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2011 Red Hat Inc.
+ *
+ * Author:
+ *      Matthias Clasen <mclasen@redhat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <gtk/gtk.h>
+
+static void
+test_toolkit_name (void)
+{
+  const gchar *s;
+
+  s = atk_get_toolkit_name ();
+  g_assert_cmpstr (s, ==, "gtk");
+}
+
+static void
+test_toolkit_version (void)
+{
+  const gchar *s;
+
+  s = atk_get_toolkit_version ();
+  g_assert_cmpstr (s, ==, GTK_VERSION);
+}
+
+int
+main (int argc, char *argv[])
+{
+  gtk_test_init (&argc, &argv, NULL);
+
+  g_test_add_func ("/util/toolkit-name", test_toolkit_name);
+  g_test_add_func ("/util/toolkit-version", test_toolkit_version);
+
+  return g_test_run ();
+}