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_table_dress(void)
28 AdgDress valid_dress
, incompatible_dress
;
31 table
= adg_table_new();
32 valid_dress
= ADG_DRESS_TABLE
;
33 incompatible_dress
= ADG_DRESS_LINE
;
35 /* Using the public APIs */
36 adg_table_set_table_dress(table
, valid_dress
);
37 table_dress
= adg_table_get_table_dress(table
);
38 g_assert_cmpint(table_dress
, ==, valid_dress
);
40 adg_table_set_table_dress(table
, incompatible_dress
);
41 table_dress
= adg_table_get_table_dress(table
);
42 g_assert_cmpint(table_dress
, ==, valid_dress
);
44 /* Using GObject property methods */
45 g_object_set(table
, "table-dress", valid_dress
, NULL
);
46 g_object_get(table
, "table-dress", &table_dress
, NULL
);
47 g_assert_cmpint(table_dress
, ==, valid_dress
);
49 g_object_set(table
, "table-dress", incompatible_dress
, NULL
);
50 g_object_get(table
, "table-dress", &table_dress
, NULL
);
51 g_assert_cmpint(table_dress
, ==, valid_dress
);
53 adg_entity_destroy(ADG_ENTITY(table
));
57 _adg_test_has_frame(void)
60 gboolean invalid_boolean
;
63 table
= adg_table_new();
64 invalid_boolean
= (gboolean
) 1234;
66 /* Using the public APIs */
67 adg_table_switch_frame(table
, FALSE
);
68 has_frame
= adg_table_has_frame(table
);
71 adg_table_switch_frame(table
, invalid_boolean
);
72 has_frame
= adg_table_has_frame(table
);
75 adg_table_switch_frame(table
, TRUE
);
76 has_frame
= adg_table_has_frame(table
);
79 /* Using GObject property methods */
80 g_object_set(table
, "has-frame", FALSE
, NULL
);
81 g_object_get(table
, "has-frame", &has_frame
, NULL
);
84 g_object_set(table
, "has-frame", invalid_boolean
, NULL
);
85 g_object_get(table
, "has-frame", &has_frame
, NULL
);
88 g_object_set(table
, "has-frame", TRUE
, NULL
);
89 g_object_get(table
, "has-frame", &has_frame
, NULL
);
92 adg_entity_destroy(ADG_ENTITY(table
));
97 main(int argc
, char *argv
[])
99 adg_test_init(&argc
, &argv
);
101 adg_test_add_func("/adg/table/table-dress", _adg_test_table_dress
);
102 adg_test_add_func("/adg/table/has-frame", _adg_test_has_frame
);