1 /* ADG - Automatic Drawing Generation
2 * Copyright (C) 2010 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 #include "test-internal.h"
25 _adg_test_background_dress(void)
28 AdgDress valid_dress_1
, valid_dress_2
, incompatible_dress
;
29 AdgDress background_dress
;
31 canvas
= adg_canvas_new();
32 valid_dress_1
= ADG_DRESS_COLOR_DIMENSION
;
33 valid_dress_2
= ADG_DRESS_COLOR_FILL
;
34 incompatible_dress
= ADG_DRESS_FONT_QUOTE_ANNOTATION
;
36 /* Using the public APIs */
37 adg_canvas_set_background_dress(canvas
, valid_dress_1
);
38 background_dress
= adg_canvas_get_background_dress(canvas
);
39 g_assert_cmpint(background_dress
, ==, valid_dress_1
);
41 adg_canvas_set_background_dress(canvas
, incompatible_dress
);
42 background_dress
= adg_canvas_get_background_dress(canvas
);
43 g_assert_cmpint(background_dress
, ==, valid_dress_1
);
45 adg_canvas_set_background_dress(canvas
, valid_dress_2
);
46 background_dress
= adg_canvas_get_background_dress(canvas
);
47 g_assert_cmpint(background_dress
, ==, valid_dress_2
);
49 /* Using GObject property methods */
50 g_object_set(canvas
, "background-dress", valid_dress_1
, NULL
);
51 g_object_get(canvas
, "background-dress", &background_dress
, NULL
);
52 g_assert_cmpint(background_dress
, ==, valid_dress_1
);
54 g_object_set(canvas
, "background-dress", incompatible_dress
, NULL
);
55 g_object_get(canvas
, "background-dress", &background_dress
, NULL
);
56 g_assert_cmpint(background_dress
, ==, valid_dress_1
);
58 g_object_set(canvas
, "background-dress", valid_dress_2
, NULL
);
59 g_object_get(canvas
, "background-dress", &background_dress
, NULL
);
60 g_assert_cmpint(background_dress
, ==, valid_dress_2
);
62 g_object_unref(canvas
);
67 main(int argc
, char *argv
[])
69 adg_test_init(&argc
, &argv
);
71 adg_test_add_func("/adg/canvas/background-dress", _adg_test_background_dress
);