From a71b892c974c0bfb1fb4d829dde647527011e508 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 8 Jul 2011 23:21:53 -0400 Subject: [PATCH] Add a test for AtkUtil functions This test revealed the horrors commented on in the previous commit. --- tests/a11y/Makefile.am | 3 +++ tests/a11y/util.c | 52 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 tests/a11y/util.c diff --git a/tests/a11y/Makefile.am b/tests/a11y/Makefile.am index 3ec5fc2475..817c584265 100644 --- a/tests/a11y/Makefile.am +++ b/tests/a11y/Makefile.am @@ -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 index 0000000000..7128fba4ff --- /dev/null +++ b/tests/a11y/util.c @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2011 Red Hat Inc. + * + * Author: + * Matthias Clasen + * + * 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 + +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 (); +}