1 #include <gtk/gtk.h>
2 #include <locale.h>
3 
4 static void
test_init(void)5 test_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 
15 static void
test_version(void)16 test_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 
30 int
main(int argc,char * argv[])31 main (int argc, char *argv[])
32 {
33   /* Don't use gtk_test_init here because it implicitly initializes GTK. */
34   (g_test_init) (&argc, &argv, NULL);
35   gtk_disable_setlocale();
36   setlocale (LC_ALL, "C");
37 
38   g_test_add_func ("/main/init", test_init);
39   g_test_add_func ("/main/version", test_version);
40 
41   return g_test_run ();
42 }
43