1 /* ADG - Automatic Drawing Generation
2 * Copyright (C) 2010,2011 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_fill_dress(void)
28 AdgDress valid_dress_1
, valid_dress_2
, incompatible_dress
;
31 hatch
= adg_hatch_new(NULL
);
32 valid_dress_1
= ADG_DRESS_FILL
;
33 valid_dress_2
= ADG_DRESS_FILL_HATCH
;
34 incompatible_dress
= ADG_DRESS_FONT_TEXT
;
36 /* Using the public APIs */
37 adg_hatch_set_fill_dress(hatch
, valid_dress_1
);
38 fill_dress
= adg_hatch_get_fill_dress(hatch
);
39 g_assert_cmpint(fill_dress
, ==, valid_dress_1
);
41 adg_hatch_set_fill_dress(hatch
, incompatible_dress
);
42 fill_dress
= adg_hatch_get_fill_dress(hatch
);
43 g_assert_cmpint(fill_dress
, ==, valid_dress_1
);
45 adg_hatch_set_fill_dress(hatch
, valid_dress_2
);
46 fill_dress
= adg_hatch_get_fill_dress(hatch
);
47 g_assert_cmpint(fill_dress
, ==, valid_dress_2
);
49 /* Using GObject property methods */
50 g_object_set(hatch
, "fill-dress", valid_dress_1
, NULL
);
51 g_object_get(hatch
, "fill-dress", &fill_dress
, NULL
);
52 g_assert_cmpint(fill_dress
, ==, valid_dress_1
);
54 g_object_set(hatch
, "fill-dress", incompatible_dress
, NULL
);
55 g_object_get(hatch
, "fill-dress", &fill_dress
, NULL
);
56 g_assert_cmpint(fill_dress
, ==, valid_dress_1
);
58 g_object_set(hatch
, "fill-dress", valid_dress_2
, NULL
);
59 g_object_get(hatch
, "fill-dress", &fill_dress
, NULL
);
60 g_assert_cmpint(fill_dress
, ==, valid_dress_2
);
62 adg_entity_destroy(ADG_ENTITY(hatch
));
67 main(int argc
, char *argv
[])
69 adg_test_init(&argc
, &argv
);
71 adg_test_add_func("/adg/hatch/fill-dress", _adg_test_fill_dress
);