tests: new adg_test_cairo_num_data helper function
[adg.git] / src / tests / adg-test.h
blob351c7b0e8408eff3ffcce05b0d3c6f9e35e9103c
1 /* ADG - Automatic Drawing Generation
2 * Copyright (C) 2007-2015 Nicola Fontana <ntd at entidi.it>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
21 #ifndef __ADG_TEST_H__
22 #define __ADG_TEST_H__
24 #include <cairo.h>
25 #include <glib-object.h>
28 G_BEGIN_DECLS
30 /* Some backward compatible macros */
31 #ifndef g_assert_true
32 #define g_assert_true(expr) do { if G_LIKELY (expr) ; else \
33 g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
34 "'" #expr "' should be TRUE"); \
35 } while (0)
36 #endif
38 #ifndef g_assert_false
39 #define g_assert_false(expr) do { if G_LIKELY (!(expr)) ; else \
40 g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
41 "'" #expr "' should be FALSE"); \
42 } while (0)
43 #endif
45 #ifndef g_assert_null
46 #define g_assert_null(expr) do { if G_LIKELY ((expr) == NULL) ; else \
47 g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
48 "'" #expr "' should be NULL"); \
49 } while (0)
50 #endif
52 #ifndef g_assert_nonnull
53 #define g_assert_nonnull(expr) do { if G_LIKELY ((expr) != NULL) ; else \
54 g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
55 "'" #expr "' should not be NULL"); \
56 } while (0)
57 #endif
60 void adg_test_init (int *p_argc,
61 char **p_argv[]);
62 const gpointer adg_test_invalid_pointer (void);
63 cairo_t * adg_test_cairo_context (void);
64 int adg_test_cairo_num_data (cairo_t *cr);
65 void adg_test_add_func (const gchar *testpath,
66 GCallback test_func);
67 void adg_test_add_func_full (const char *testpath,
68 GCallback test_func,
69 gpointer user_data);
70 void adg_test_add_enum_checks (const gchar *testpath,
71 GType type);
72 void adg_test_add_boxed_checks (const gchar *testpath,
73 GType type,
74 gpointer instance);
75 void adg_test_add_object_checks (const gchar *testpath,
76 GType type);
77 void adg_test_add_entity_checks (const gchar *testpath,
78 GType type);
79 void adg_test_add_global_space_checks(const gchar *testpath,
80 gpointer entity);
81 void adg_test_add_local_space_checks (const gchar *testpath,
82 gpointer entity);
84 G_END_DECLS
87 #endif /* __ADG_TEST_H__ */