2 * This file is a part of hildon tests
4 * Copyright (C) 2006, 2007 Nokia Corporation, all rights reserved.
6 * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; version 2.1 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
27 #include <gtk/gtkmain.h>
28 #include <gtk/gtklabel.h>
29 #include "test_suites.h"
30 #include "hildon-helper.h"
32 /* -------------------- Fixtures -------------------- */
35 fx_setup_default_helper ()
39 gtk_init(&argc, NULL);
43 fx_teardown_default_helper ()
46 /* -------------------- Test cases -------------------- */
48 /* ----- Test case for hildon_helper_set_logical_font -----*/
51 * Purpose: test setting a new logical font to a GtkWidget
53 * - Set the font name "TimesNewRoman"
55 START_TEST (test_hildon_helper_set_logical_font_regular)
57 GtkWidget *label = NULL;
58 gulong signum = G_MAXULONG;
60 label = gtk_label_new ("test label");
62 signum = hildon_helper_set_logical_font (label, "TimesNewRoman");
63 gtk_widget_destroy (GTK_WIDGET (label));
66 "hildon-helper: the returned signal id is %ul and should be > 0",
72 * Purpose: test setting a logical font with invalid parameters
74 * - Set the font name "TimesNewRoman" to a NULL Widget
75 * - Set a NULL font name to a valid Widget
77 START_TEST (test_hildon_helper_set_logical_font_invalid)
79 GtkWidget *label = NULL;
80 gulong signum = G_MAXULONG;
83 signum = hildon_helper_set_logical_font (NULL, "TimesNewRoman");
85 "hildon-helper: the returned signal id is %ul and should be 0",
89 label = gtk_label_new ("test label");
91 signum = hildon_helper_set_logical_font (label, NULL);
92 gtk_widget_destroy (GTK_WIDGET (label));
95 "hildon-helper: the returned signal id is %ul and should be 0",
101 /* ----- Test case for hildon_helper_set_logical_color -----*/
104 * Purpose: test setting a new logical color to a GtkWidget
106 * - Set the logical color "Blue"
108 START_TEST (test_hildon_helper_set_logical_color_regular)
110 GtkWidget *label = NULL;
111 gulong signum = G_MAXULONG;
113 label = gtk_label_new ("test label");
115 signum = hildon_helper_set_logical_color (label,
119 gtk_widget_destroy (GTK_WIDGET (label));
121 fail_if (signum <= 0,
122 "hildon-helper: the returned signal id is %ul and should be > 0",
128 * Purpose: test setting a logical color with invalid parameters
130 * - Set the color name "Blue" to a NULL Widget
131 * - Set a NULL color name to a valid Widget
133 START_TEST (test_hildon_helper_set_logical_color_invalid)
135 GtkWidget *label = NULL;
136 gulong signum = G_MAXULONG;
139 signum = hildon_helper_set_logical_color (NULL,
143 fail_if (signum != 0,
144 "hildon-helper: the returned signal id is %ul and should be 0",
147 /* Create the widget */
148 label = gtk_label_new ("test label");
151 signum = hildon_helper_set_logical_color (label,
155 gtk_widget_destroy (GTK_WIDGET (label));
157 fail_if (signum != 0,
158 "hildon-helper: the returned signal id is %ul and should be 0",
165 /* ---------- Suite creation ---------- */
167 Suite *create_hildon_helper_suite()
169 /* Create the suite */
170 Suite *s = suite_create("Hildonhelper");
172 /* Create test cases */
173 TCase *tc1 = tcase_create("hildon_helper_set_logical_font");
174 TCase *tc2 = tcase_create("hildon_helper_set_logical_color");
176 /* Create test case for set_logical_font and add it to the suite */
177 tcase_add_checked_fixture(tc1, fx_setup_default_helper, fx_teardown_default_helper);
178 tcase_add_test(tc1, test_hildon_helper_set_logical_font_regular);
179 tcase_add_test(tc1, test_hildon_helper_set_logical_font_invalid);
180 suite_add_tcase (s, tc1);
182 /* Create test case for set_logical_color and add it to the suite */
183 tcase_add_checked_fixture(tc2, fx_setup_default_helper, fx_teardown_default_helper);
184 tcase_add_test(tc2, test_hildon_helper_set_logical_color_regular);
185 tcase_add_test(tc2, test_hildon_helper_set_logical_color_invalid);
186 suite_add_tcase (s, tc2);
188 /* Return created suite */