1#include <gtk/gtk.h>
2#include <locale.h>
3
4static void
5test_init (void)
6{
7 gboolean ret;
8
9 g_assert_false (gtk_is_initialized ());
10 ret = gtk_init_check ();
11 g_assert_true (ret);
12 g_assert_true (gtk_is_initialized ());
13}
14
15static void
16test_version (void)
17{
18 g_assert_cmpuint (gtk_get_major_version (), ==, GTK_MAJOR_VERSION);
19 g_assert_cmpuint (gtk_get_minor_version (), ==, GTK_MINOR_VERSION);
20 g_assert_cmpuint (gtk_get_micro_version (), ==, GTK_MICRO_VERSION);
21 g_assert_cmpuint (gtk_get_binary_age (), ==, GTK_BINARY_AGE);
22 g_assert_cmpuint (gtk_get_interface_age (), ==, GTK_INTERFACE_AGE);
23
24 g_assert_null (gtk_check_version (GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION));
25 g_assert_nonnull (gtk_check_version (5, 0, 0));
26 g_assert_nonnull (gtk_check_version (1, 0, 0));
27 g_assert_nonnull (gtk_check_version (3, 1000, 10));
28}
29
30int
31main (int argc, char *argv[])
32{
33 /* Don't use gtk_test_init here because it implicitly initializes GTK. */
34 (g_test_init) (argc: &argc, argv: &argv, NULL);
35 gtk_disable_setlocale();
36 setlocale (LC_ALL, locale: "C");
37
38 g_test_add_func (testpath: "/main/init", test_func: test_init);
39 g_test_add_func (testpath: "/main/version", test_func: test_version);
40
41 return g_test_run ();
42}
43

source code of gtk/testsuite/gtk/main.c