2 * Copyright (C) 2006 Nokia Corporation.
4 * Contact: Luc Pionchon <luc.pionchon@nokia.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License
8 * as published by the Free Software Foundation; either version 2.1 of
9 * the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
25 #include <gtk/gtkmain.h>
26 #include <gtk/gtklabel.h>
27 #include "test_suites.h"
28 #include "hildon-defines.h"
30 /* -------------------- Fixtures -------------------- */
33 fx_setup_default_defines ()
37 gtk_init(&argc, NULL);
41 fx_teardown_default_defines ()
44 /* -------------------- Test cases -------------------- */
46 /* ----- Test case for gtk_widget_set_logical_font -----*/
49 * Purpose: test setting a new logical font to a GtkWidget
51 * - Set the font name "TimesNewRoman"
53 START_TEST (test_gtk_widget_set_logical_font_regular)
55 GtkWidget *label = NULL;
56 gulong signum = G_MAXULONG;
58 label = gtk_label_new ("test label");
60 signum = hildon_gtk_widget_set_logical_font (label, "TimesNewRoman");
61 gtk_widget_destroy (GTK_WIDGET (label));
64 "hildon-defines: the returned signal id is %ul and should be > 0",
70 * Purpose: test setting a logical font with invalid parameters
72 * - Set the font name "TimesNewRoman" to a NULL Widget
73 * - Set a NULL font name to a valid Widget
75 START_TEST (test_gtk_widget_set_logical_font_invalid)
77 GtkWidget *label = NULL;
78 gulong signum = G_MAXULONG;
81 signum = hildon_gtk_widget_set_logical_font (NULL, "TimesNewRoman");
83 "hildon-defines: the returned signal id is %ul and should be 0",
87 label = gtk_label_new ("test label");
89 signum = hildon_gtk_widget_set_logical_font (label, NULL);
90 gtk_widget_destroy (GTK_WIDGET (label));
93 "hildon-defines: the returned signal id is %ul and should be 0",
99 /* ----- Test case for gtk_widget_set_logical_color -----*/
102 * Purpose: test setting a new logical color to a GtkWidget
104 * - Set the logical color "Blue"
106 START_TEST (test_gtk_widget_set_logical_color_regular)
108 GtkWidget *label = NULL;
109 gulong signum = G_MAXULONG;
111 label = gtk_label_new ("test label");
113 signum = hildon_gtk_widget_set_logical_color (label,
117 gtk_widget_destroy (GTK_WIDGET (label));
119 fail_if (signum <= 0,
120 "hildon-defines: the returned signal id is %ul and should be > 0",
126 * Purpose: test setting a logical color with invalid parameters
128 * - Set the color name "Blue" to a NULL Widget
129 * - Set a NULL color name to a valid Widget
131 START_TEST (test_gtk_widget_set_logical_color_invalid)
133 GtkWidget *label = NULL;
134 gulong signum = G_MAXULONG;
137 signum = hildon_gtk_widget_set_logical_color (NULL,
141 fail_if (signum != 0,
142 "hildon-defines: the returned signal id is %ul and should be 0",
145 /* Create the widget */
146 label = gtk_label_new ("test label");
149 signum = hildon_gtk_widget_set_logical_color (label,
153 gtk_widget_destroy (GTK_WIDGET (label));
155 fail_if (signum != 0,
156 "hildon-defines: the returned signal id is %ul and should be 0",
163 /* ---------- Suite creation ---------- */
165 Suite *create_hildon_defines_suite()
167 /* Create the suite */
168 Suite *s = suite_create("HildonDefines");
170 /* Create test cases */
171 TCase *tc1 = tcase_create("gtk_widget_set_logical_font");
172 TCase *tc2 = tcase_create("gtk_widget_set_logical_color");
174 /* Create test case for set_logical_font and add it to the suite */
175 tcase_add_checked_fixture(tc1, fx_setup_default_defines, fx_teardown_default_defines);
176 tcase_add_test(tc1, test_gtk_widget_set_logical_font_regular);
177 tcase_add_test(tc1, test_gtk_widget_set_logical_font_invalid);
178 suite_add_tcase (s, tc1);
180 /* Create test case for set_logical_color and add it to the suite */
181 tcase_add_checked_fixture(tc2, fx_setup_default_defines, fx_teardown_default_defines);
182 tcase_add_test(tc2, test_gtk_widget_set_logical_color_regular);
183 tcase_add_test(tc2, test_gtk_widget_set_logical_color_invalid);
184 suite_add_tcase (s, tc2);
186 /* Return created suite */