Introducing the hildon-helper and moving some -defines functions there.
authorMichael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
Thu, 18 Jan 2007 15:32:03 +0000 (15:32 +0000)
committerMichael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
Thu, 18 Jan 2007 15:32:03 +0000 (15:32 +0000)
12 files changed:
ChangeLog.2
src/Makefile.am
src/hildon-defines.c
src/hildon-helper.c [new file with mode: 0644]
src/hildon-helper.h [new file with mode: 0644]
src/hildon.h
tests/Makefile.am
tests/Makefile.in
tests/TEST-CASES.txt
tests/check-hildon-defines.c [deleted file]
tests/check-hildon-helper.c [new file with mode: 0644]
tests/check_test.c

index b16128a..d2942b2 100644 (file)
@@ -1,5 +1,20 @@
 2007-01-18  Michael Dominic Kostrzewa  <michael.kostrzewa@nokia.com> 
 
+       * src/hildon.h:
+       * src/Makefile.am:
+       * src/hildon-defines.c:
+       * src/hildon-helper.c:
+       * src/hildon-helper.h: Introducing the hildon-helper and moving some
+       -defines functions there.
+
+       * tests/Makefile.am:
+       * tests/Makefile.in:
+       * tests/TEST-CASES.txt:
+       * tests/check-hildon-defines.c:
+       * tests/check_test.c: Modyfying tests for hildon helper.
+
+2007-01-18  Michael Dominic Kostrzewa  <michael.kostrzewa@nokia.com> 
+
        * src/hildon-input-mode-hint.h: Cleaning up the
        hildon-input-mode-hint.
 
index cc7e55e..f1a5778 100644 (file)
@@ -34,6 +34,7 @@ libhildon_@PACKAGE_VERSION_MAJOR@_la_SOURCES          = hildon-private.c                              \
                                                          hildon-date-editor.c                          \
                                                          hildon-time-editor.c                          \
                                                          hildon-time-picker.c                          \
+                                                         hildon-helper.c                               \
                                                          hildon-weekday-picker.c                       \
                                                          hildon-number-editor.c                        \
                                                          hildon-range-editor.c                         \
@@ -70,6 +71,7 @@ libhildon_@PACKAGE_VERSION_MAJOR@_include_HEADERS     = hildon-banner.h                               \
                                                          hildon-defines.h                              \
                                                          hildon-enum-types.h                           \
                                                          hildon-find-toolbar.h                         \
+                                                         hildon-helper.h                               \
                                                          hildon-font-selection-dialog.h                \
                                                          hildon-get-password-dialog.h                  \
                                                          hildon-hvolumebar.h                           \
index a8f1307..0de5c04 100644 (file)
@@ -39,8 +39,6 @@ const HildonIconSizes*                          hildoniconsizes = NULL;
 
 static HildonIconSizes                          iis; /* hildon internal icon sizes */
 
-typedef struct                                  _HildonLogicalData HildonLogicalData;
-
 void 
 hildon_icon_sizes_init                          (void)
 {
@@ -76,208 +74,3 @@ hildon_icon_sizes_init                          (void)
     iis.image_size_indi_nokia_hands          = gtk_icon_size_register ("image_size_indi_nokia_hands",          64, 64);
 }
 
-struct                                          _HildonLogicalData
-{
-    GtkRcFlags rcflags;
-    GtkStateType state;
-    gchar *logicalcolorstring;
-    gchar *logicalfontstring;
-};
-
-static void 
-hildon_change_style_recursive_from_ld           (GtkWidget *widget, 
-                                                 GtkStyle *prev_style, 
-                                                 HildonLogicalData *ld)
-{
-    g_assert (GTK_IS_WIDGET (widget));
-
-    /* Change the style for child widgets */
-    if (GTK_IS_CONTAINER (widget)) {
-        GList *iterator = gtk_container_get_children (GTK_CONTAINER (widget));
-        for (iterator = iterator; iterator != NULL; iterator = g_list_next (iterator))
-            hildon_change_style_recursive_from_ld (GTK_WIDGET (iterator->data), prev_style, ld);
-    }
-
-    /* gtk_widget_modify_*() emit "style_set" signals, so if we got here from
-       "style_set" signal, we need to block this function from being called
-       again or we get into inifinite loop.
-
-    FIXME: Compiling with gcc > 3.3 and -pedantic won't allow
-    conversion between function and object pointers. GLib API however
-    requires an object pointer for a function, so we have to work
-    around this.
-    See http://bugzilla.gnome.org/show_bug.cgi?id=310175
-    */
-
-    G_GNUC_EXTENSION
-        g_signal_handlers_block_matched (G_OBJECT (widget), G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC,
-                g_signal_lookup ("style_set", G_TYPE_FROM_INSTANCE (widget)),
-                0, NULL,
-                (gpointer) hildon_change_style_recursive_from_ld,
-                NULL);
-
-    if (ld->logicalcolorstring != NULL)
-    {
-        /* Changing logical color */
-        GdkColor color;
-        gtk_widget_ensure_style (widget);
-        if (gtk_style_lookup_color (widget->style, ld->logicalcolorstring, &color) == TRUE)
-            switch (ld->rcflags)
-            {
-                case GTK_RC_FG:
-                    gtk_widget_modify_fg (widget, ld->state, &color);
-                    break;
-
-                case GTK_RC_BG:
-                    gtk_widget_modify_bg (widget, ld->state, &color);
-                    break;
-
-                case GTK_RC_TEXT:
-                    gtk_widget_modify_text (widget, ld->state, &color);
-                    break;
-
-                case GTK_RC_BASE:
-                    gtk_widget_modify_base (widget, ld->state, &color);
-                    break;
-
-            } else {
-                g_warning ("Failed to lookup '%s' color!", ld->logicalcolorstring);
-            }
-    }
-
-    if (ld->logicalfontstring != NULL)
-    {
-        /* Changing logical font */
-        GtkStyle *fontstyle = gtk_rc_get_style_by_paths (gtk_settings_get_default (), ld->logicalfontstring, NULL, G_TYPE_NONE);
-        if (fontstyle != NULL)
-        {
-            PangoFontDescription *fontdesc = fontstyle->font_desc;
-
-            if (fontdesc != NULL)
-                gtk_widget_modify_font (widget, fontdesc);
-        }
-    }
-
-    /* FIXME: Compilation workaround for gcc > 3.3 + -pedantic again */
-
-    G_GNUC_EXTENSION
-        g_signal_handlers_unblock_matched (G_OBJECT (widget), G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC,
-                g_signal_lookup ("style_set", G_TYPE_FROM_INSTANCE (widget)),
-                0, NULL,
-                (gpointer) hildon_change_style_recursive_from_ld,
-                NULL);
-}
-
-static void 
-hildon_logical_data_free                        (HildonLogicalData *ld)
-{
-    g_return_if_fail (ld != NULL);
-
-    if (ld->logicalcolorstring)
-        g_free (ld->logicalcolorstring);
-
-    if (ld->logicalfontstring)
-        g_free (ld->logicalfontstring);
-
-    g_free (ld);
-}
-
-/**
- * hildon_gtk_widget_set_logical_font:
- * @widget : A @GtkWidget to assign this logical font for.
- * @logicalfontname : A gchar* with the logical font name to assign to the widget.
- * 
- * This function assigns a defined logical font to the @widget and all its child widgets.
- * It also connects to the "style_set" signal which will retrieve & assign the new font for the given logical name each time the theme is changed.
- * The returned signal id can be used to disconnect the signal. 
- * The previous signal (obtained by calling this function) is disconnected automatically and should not be used. 
- * 
- * Return value : The signal id that is triggered every time theme is changed. 0 if font set failed.
- **/
-gulong
-hildon_gtk_widget_set_logical_font              (GtkWidget *widget, 
-                                                 const gchar *logicalfontname)
-{
-    HildonLogicalData *ld;
-    gulong signum = 0;
-
-    g_return_val_if_fail (GTK_IS_WIDGET (widget), 0);
-    g_return_val_if_fail (logicalfontname != NULL, 0);
-
-    ld = g_malloc (sizeof (HildonLogicalData));
-
-    ld->rcflags = 0;
-    ld->state = 0;
-    ld->logicalcolorstring = NULL;
-    ld->logicalfontstring = g_strdup(logicalfontname);
-
-    /* Disconnects the previously connected signals. That calls the closure notify
-     * and effectively disposes the allocated data (hildon_logical_data_free) */
-    g_signal_handlers_disconnect_matched (G_OBJECT (widget), G_SIGNAL_MATCH_FUNC, 
-            0, 0, NULL, 
-            G_CALLBACK (hildon_change_style_recursive_from_ld), NULL);
-
-    /* Change the font now */
-    hildon_change_style_recursive_from_ld (widget, NULL, ld);
-
-    /* Connect to "style_set" so that the font gets changed whenever theme changes. */
-    signum = g_signal_connect_data (G_OBJECT (widget), "style_set",
-            G_CALLBACK (hildon_change_style_recursive_from_ld),
-            ld, (GClosureNotify) hildon_logical_data_free, 0);
-
-    return signum;
-}
-
-/**
- * hildon_gtk_widget_set_logical_color:
- * @widget : A @GtkWidget to assign this logical font for.
- * @rcflags : @GtkRcFlags enumeration defining whether to assign to FG, BG, TEXT or BASE style.
- * @state : @GtkStateType indicating to which state to assign the logical color
- * @logicalcolorname : A gchar* with the logical font name to assign to the widget.
- * 
- * This function assigns a defined logical color to the @widget and all it's child widgets.
- * It also connects to the "style_set" signal which will retrieve & assign the new color for the given logical name each time the theme is changed.
- * The returned signal id can be used to disconnect the signal.
- * The previous signal (obtained by calling this function) is disconnected automatically and should not be used. 
- * 
- * Example : If the style you want to modify is bg[NORMAL] then set rcflags to GTK_RC_BG and state to GTK_STATE_NORMAL.
- * 
- * Return value : The signal id that is triggered every time theme is changed. 0 if color set failed.
- **/
-gulong 
-hildon_gtk_widget_set_logical_color             (GtkWidget *widget, 
-                                                 GtkRcFlags rcflags,
-                                                 GtkStateType state, 
-                                                 const gchar *logicalcolorname)
-{
-    HildonLogicalData *ld;
-    gulong signum = 0;
-
-    g_return_val_if_fail (GTK_IS_WIDGET (widget), 0);
-    g_return_val_if_fail (logicalcolorname != NULL, 0);
-
-    ld = g_malloc (sizeof (HildonLogicalData));
-
-    ld->rcflags = rcflags;
-    ld->state = state;
-    ld->logicalcolorstring = g_strdup (logicalcolorname);
-    ld->logicalfontstring = NULL;
-
-    /* Disconnects the previously connected signals. That calls the closure notify
-     * and effectively disposes the allocated data (hildon_logical_data_free) */
-    g_signal_handlers_disconnect_matched (G_OBJECT (widget), G_SIGNAL_MATCH_FUNC, 
-            0, 0, NULL, 
-            G_CALLBACK (hildon_change_style_recursive_from_ld), NULL);
-
-    /* Change the colors now */
-    hildon_change_style_recursive_from_ld (widget, NULL, ld);
-
-    /* Connect to "style_set" so that the colors gets changed whenever theme */
-    signum = g_signal_connect_data (G_OBJECT (widget), "style_set",
-            G_CALLBACK (hildon_change_style_recursive_from_ld),
-            ld, (GClosureNotify) hildon_logical_data_free, 0);
-
-    return signum;
-}
-
-
diff --git a/src/hildon-helper.c b/src/hildon-helper.c
new file mode 100644 (file)
index 0000000..fe7e922
--- /dev/null
@@ -0,0 +1,246 @@
+/*
+ * This file is a part of hildon
+ *
+ * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
+ *
+ * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; version 2.1 of
+ * the License.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+/**
+ * SECTION:hildon-helpers
+ * @short_description: A collection of usefull utilities and functions.
+ *
+ */
+
+#ifdef                                          HAVE_CONFIG_H
+#include                                        <config.h>
+#endif
+
+#include                                        <gtk/gtk.h>
+#include                                        "hildon-helper.h"
+
+struct                                          _HildonLogicalData
+{
+    GtkRcFlags rcflags;
+    GtkStateType state;
+    gchar *logicalcolorstring;
+    gchar *logicalfontstring;
+} typedef                                       HildonLogicalData;
+
+static void 
+hildon_change_style_recursive_from_ld           (GtkWidget *widget, 
+                                                 GtkStyle *prev_style, 
+                                                 HildonLogicalData *ld)
+{
+    g_assert (GTK_IS_WIDGET (widget));
+
+    /* Change the style for child widgets */
+    if (GTK_IS_CONTAINER (widget)) {
+        GList *iterator = gtk_container_get_children (GTK_CONTAINER (widget));
+        for (iterator = iterator; iterator != NULL; iterator = g_list_next (iterator))
+            hildon_change_style_recursive_from_ld (GTK_WIDGET (iterator->data), prev_style, ld);
+    }
+
+    /* gtk_widget_modify_*() emit "style_set" signals, so if we got here from
+       "style_set" signal, we need to block this function from being called
+       again or we get into inifinite loop.
+
+    FIXME: Compiling with gcc > 3.3 and -pedantic won't allow
+    conversion between function and object pointers. GLib API however
+    requires an object pointer for a function, so we have to work
+    around this.
+    See http://bugzilla.gnome.org/show_bug.cgi?id=310175
+    */
+
+    G_GNUC_EXTENSION
+        g_signal_handlers_block_matched (G_OBJECT (widget), G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC,
+                g_signal_lookup ("style_set", G_TYPE_FROM_INSTANCE (widget)),
+                0, NULL,
+                (gpointer) hildon_change_style_recursive_from_ld,
+                NULL);
+
+    if (ld->logicalcolorstring != NULL)
+    {
+        /* Changing logical color */
+        GdkColor color;
+        gtk_widget_ensure_style (widget);
+        if (gtk_style_lookup_color (widget->style, ld->logicalcolorstring, &color) == TRUE)
+            switch (ld->rcflags)
+            {
+                case GTK_RC_FG:
+                    gtk_widget_modify_fg (widget, ld->state, &color);
+                    break;
+
+                case GTK_RC_BG:
+                    gtk_widget_modify_bg (widget, ld->state, &color);
+                    break;
+
+                case GTK_RC_TEXT:
+                    gtk_widget_modify_text (widget, ld->state, &color);
+                    break;
+
+                case GTK_RC_BASE:
+                    gtk_widget_modify_base (widget, ld->state, &color);
+                    break;
+
+            } else {
+                g_warning ("Failed to lookup '%s' color!", ld->logicalcolorstring);
+            }
+    }
+
+    if (ld->logicalfontstring != NULL)
+    {
+        /* Changing logical font */
+        GtkStyle *fontstyle = gtk_rc_get_style_by_paths (gtk_settings_get_default (), ld->logicalfontstring, NULL, G_TYPE_NONE);
+        if (fontstyle != NULL)
+        {
+            PangoFontDescription *fontdesc = fontstyle->font_desc;
+
+            if (fontdesc != NULL)
+                gtk_widget_modify_font (widget, fontdesc);
+        }
+    }
+
+    /* FIXME: Compilation workaround for gcc > 3.3 + -pedantic again */
+
+    G_GNUC_EXTENSION
+        g_signal_handlers_unblock_matched (G_OBJECT (widget), G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC,
+                g_signal_lookup ("style_set", G_TYPE_FROM_INSTANCE (widget)),
+                0, NULL,
+                (gpointer) hildon_change_style_recursive_from_ld,
+                NULL);
+}
+
+static void 
+hildon_logical_data_free                        (HildonLogicalData *ld)
+{
+    g_return_if_fail (ld != NULL);
+
+    if (ld->logicalcolorstring)
+        g_free (ld->logicalcolorstring);
+
+    if (ld->logicalfontstring)
+        g_free (ld->logicalfontstring);
+
+    g_free (ld);
+}
+
+/**
+ * hildon_helper_set_logical_font:
+ * @widget : A @GtkWidget to assign this logical font for.
+ * @logicalfontname : A gchar* with the logical font name to assign to the widget.
+ * 
+ * This function assigns a defined logical font to the @widget and all its child widgets.
+ * It also connects to the "style_set" signal which will retrieve & assign the new font 
+ * for the given logical name each time the theme is changed.
+ * The returned signal id can be used to disconnect the signal. 
+ * The previous signal (obtained by calling this function) is disconnected 
+ * automatically and should not be used. 
+ * 
+ * Return value : The signal id that is triggered every time theme is changed. 0 if font set failed.
+ **/
+gulong
+hildon_helper_set_logical_font                  (GtkWidget *widget, 
+                                                 const gchar *logicalfontname)
+{
+    HildonLogicalData *ld;
+    gulong signum = 0;
+
+    g_return_val_if_fail (GTK_IS_WIDGET (widget), 0);
+    g_return_val_if_fail (logicalfontname != NULL, 0);
+
+    ld = g_malloc (sizeof (HildonLogicalData));
+
+    ld->rcflags = 0;
+    ld->state = 0;
+    ld->logicalcolorstring = NULL;
+    ld->logicalfontstring = g_strdup(logicalfontname);
+
+    /* Disconnects the previously connected signals. That calls the closure notify
+     * and effectively disposes the allocated data (hildon_logical_data_free) */
+    g_signal_handlers_disconnect_matched (G_OBJECT (widget), G_SIGNAL_MATCH_FUNC, 
+            0, 0, NULL, 
+            G_CALLBACK (hildon_change_style_recursive_from_ld), NULL);
+
+    /* Change the font now */
+    hildon_change_style_recursive_from_ld (widget, NULL, ld);
+
+    /* Connect to "style_set" so that the font gets changed whenever theme changes. */
+    signum = g_signal_connect_data (G_OBJECT (widget), "style_set",
+            G_CALLBACK (hildon_change_style_recursive_from_ld),
+            ld, (GClosureNotify) hildon_logical_data_free, 0);
+
+    return signum;
+}
+
+/**
+ * hildon_helper_set_logical_color:
+ * @widget : A @GtkWidget to assign this logical font for.
+ * @rcflags : @GtkRcFlags enumeration defining whether to assign to FG, BG, TEXT or BASE style.
+ * @state : @GtkStateType indicating to which state to assign the logical color
+ * @logicalcolorname : A gchar* with the logical font name to assign to the widget.
+ * 
+ * This function assigns a defined logical color to the @widget and all it's child widgets.
+ * It also connects to the "style_set" signal which will retrieve & assign the new color 
+ * for the given logical name each time the theme is changed.
+ * The returned signal id can be used to disconnect the signal.
+ * The previous signal (obtained by calling this function) is disconnected 
+ * automatically and should not be used. 
+ * 
+ * Example : If the style you want to modify is bg[NORMAL] then set rcflags to GTK_RC_BG and state to GTK_STATE_NORMAL.
+ * 
+ * Return value : The signal id that is triggered every time theme is changed. 0 if color set failed.
+ **/
+gulong 
+hildon_helper_set_logical_color                 (GtkWidget *widget, 
+                                                 GtkRcFlags rcflags,
+                                                 GtkStateType state, 
+                                                 const gchar *logicalcolorname)
+{
+    HildonLogicalData *ld;
+    gulong signum = 0;
+
+    g_return_val_if_fail (GTK_IS_WIDGET (widget), 0);
+    g_return_val_if_fail (logicalcolorname != NULL, 0);
+
+    ld = g_malloc (sizeof (HildonLogicalData));
+
+    ld->rcflags = rcflags;
+    ld->state = state;
+    ld->logicalcolorstring = g_strdup (logicalcolorname);
+    ld->logicalfontstring = NULL;
+
+    /* Disconnects the previously connected signals. That calls the closure notify
+     * and effectively disposes the allocated data (hildon_logical_data_free) */
+    g_signal_handlers_disconnect_matched (G_OBJECT (widget), G_SIGNAL_MATCH_FUNC, 
+            0, 0, NULL, 
+            G_CALLBACK (hildon_change_style_recursive_from_ld), NULL);
+
+    /* Change the colors now */
+    hildon_change_style_recursive_from_ld (widget, NULL, ld);
+
+    /* Connect to "style_set" so that the colors gets changed whenever theme */
+    signum = g_signal_connect_data (G_OBJECT (widget), "style_set",
+            G_CALLBACK (hildon_change_style_recursive_from_ld),
+            ld, (GClosureNotify) hildon_logical_data_free, 0);
+
+    return signum;
+}
+
+
diff --git a/src/hildon-helper.h b/src/hildon-helper.h
new file mode 100644 (file)
index 0000000..a666755
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * This file is a part of hildon
+ *
+ * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
+ *
+ * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; version 2.1 of
+ * the License.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef                                         __HILDON_HELPER_H__
+#define                                         __HILDON_HELPER_H__
+
+#include                                        <gtk/gtkwindow.h>
+#include                                        <gdk/gdkkeysyms.h>
+
+G_BEGIN_DECLS
+
+gulong
+hildon_helper_set_logical_font                  (GtkWidget *widget, 
+                                                 const gchar *logicalfontname);
+
+gulong
+hildon_helper_set_logical_color                 (GtkWidget *widget, 
+                                                 GtkRcFlags rcflags,
+                                                 GtkStateType state, 
+                                                 const gchar *logicalcolorname);
+
+G_END_DECLS
+
+#endif                                          /* HILDON_HELPER_H */
index 42bf827..e6c6144 100644 (file)
@@ -35,6 +35,7 @@
 #include                                        "hildon-controlbar.h"
 #include                                        "hildon-date-editor.h"
 #include                                        "hildon-defines.h"
+#include                                        "hildon-helper.h"
 #include                                        "hildon-enum-types.h"
 #include                                        "hildon-find-toolbar.h"
 #include                                        "hildon-font-selection-dialog.h"
index 3af5ef6..3e69843 100644 (file)
@@ -14,7 +14,7 @@ check_test_SOURCES                    = check_test.c                          \
                                          check-hildon-number-editor.c          \
                                          check-hildon-calendar-popup.c         \
                                          check-hildon-caption.c                \
-                                         check-hildon-defines.c                \
+                                         check-hildon-helper.c                 \
                                          check-hildon-code-dialog.c            \
                                          check-hildon-find-toolbar.c           \
                                          check-hildon-sort-dialog.c            \
index 74e191a..6e5e0bc 100644 (file)
@@ -57,7 +57,7 @@ am__check_test_SOURCES_DIST = check_test.c check_utils.c \
        check-hildon-controlbar.c check-hildon-seekbar.c \
        check-hildon-time-picker.c check-hildon-number-editor.c \
        check-hildon-calendar-popup.c check-hildon-caption.c \
-       check-hildon-defines.c check-hildon-code-dialog.c \
+       check-hildon-helper.c check-hildon-code-dialog.c \
        check-hildon-find-toolbar.c check-hildon-sort-dialog.c \
        check-hildon-note.c check-hildon-volumebar.c \
        check-hildon-volumebar-range.c check-hildon-banner.c \
@@ -78,7 +78,7 @@ am__check_test_SOURCES_DIST = check_test.c check_utils.c \
 @BUILD_TESTS_TRUE@     check_test-check-hildon-number-editor.$(OBJEXT) \
 @BUILD_TESTS_TRUE@     check_test-check-hildon-calendar-popup.$(OBJEXT) \
 @BUILD_TESTS_TRUE@     check_test-check-hildon-caption.$(OBJEXT) \
-@BUILD_TESTS_TRUE@     check_test-check-hildon-defines.$(OBJEXT) \
+@BUILD_TESTS_TRUE@     check_test-check-hildon-helper.$(OBJEXT) \
 @BUILD_TESTS_TRUE@     check_test-check-hildon-code-dialog.$(OBJEXT) \
 @BUILD_TESTS_TRUE@     check_test-check-hildon-find-toolbar.$(OBJEXT) \
 @BUILD_TESTS_TRUE@     check_test-check-hildon-sort-dialog.$(OBJEXT) \
@@ -106,9 +106,9 @@ am__depfiles_maybe = depfiles
 @AMDEP_TRUE@   ./$(DEPDIR)/check_test-check-hildon-color-chooser.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/check_test-check-hildon-controlbar.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/check_test-check-hildon-date-editor.Po \
-@AMDEP_TRUE@   ./$(DEPDIR)/check_test-check-hildon-defines.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/check_test-check-hildon-find-toolbar.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/check_test-check-hildon-font-selection-dialog.Po \
+@AMDEP_TRUE@   ./$(DEPDIR)/check_test-check-hildon-helper.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/check_test-check-hildon-note.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/check_test-check-hildon-number-editor.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/check_test-check-hildon-program.Po \
@@ -293,7 +293,7 @@ target_vendor = @target_vendor@
 @BUILD_TESTS_TRUE@                                       check-hildon-number-editor.c          \
 @BUILD_TESTS_TRUE@                                       check-hildon-calendar-popup.c         \
 @BUILD_TESTS_TRUE@                                       check-hildon-caption.c                \
-@BUILD_TESTS_TRUE@                                       check-hildon-defines.c                \
+@BUILD_TESTS_TRUE@                                       check-hildon-helper.c                 \
 @BUILD_TESTS_TRUE@                                       check-hildon-code-dialog.c            \
 @BUILD_TESTS_TRUE@                                       check-hildon-find-toolbar.c           \
 @BUILD_TESTS_TRUE@                                       check-hildon-sort-dialog.c            \
@@ -369,9 +369,9 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_test-check-hildon-color-chooser.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_test-check-hildon-controlbar.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_test-check-hildon-date-editor.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_test-check-hildon-defines.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_test-check-hildon-find-toolbar.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_test-check-hildon-font-selection-dialog.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_test-check-hildon-helper.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_test-check-hildon-note.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_test-check-hildon-number-editor.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_test-check-hildon-program.Po@am__quote@
@@ -700,29 +700,29 @@ check_test-check-hildon-caption.lo: check-hildon-caption.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -c -o check_test-check-hildon-caption.lo `test -f 'check-hildon-caption.c' || echo '$(srcdir)/'`check-hildon-caption.c
 
-check_test-check-hildon-defines.o: check-hildon-defines.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -MT check_test-check-hildon-defines.o -MD -MP -MF "$(DEPDIR)/check_test-check-hildon-defines.Tpo" -c -o check_test-check-hildon-defines.o `test -f 'check-hildon-defines.c' || echo '$(srcdir)/'`check-hildon-defines.c; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/check_test-check-hildon-defines.Tpo" "$(DEPDIR)/check_test-check-hildon-defines.Po"; else rm -f "$(DEPDIR)/check_test-check-hildon-defines.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='check-hildon-defines.c' object='check_test-check-hildon-defines.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      depfile='$(DEPDIR)/check_test-check-hildon-defines.Po' tmpdepfile='$(DEPDIR)/check_test-check-hildon-defines.TPo' @AMDEPBACKSLASH@
+check_test-check-hildon-helper.o: check-hildon-helper.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -MT check_test-check-hildon-helper.o -MD -MP -MF "$(DEPDIR)/check_test-check-hildon-helper.Tpo" -c -o check_test-check-hildon-helper.o `test -f 'check-hildon-helper.c' || echo '$(srcdir)/'`check-hildon-helper.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/check_test-check-hildon-helper.Tpo" "$(DEPDIR)/check_test-check-hildon-helper.Po"; else rm -f "$(DEPDIR)/check_test-check-hildon-helper.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='check-hildon-helper.c' object='check_test-check-hildon-helper.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      depfile='$(DEPDIR)/check_test-check-hildon-helper.Po' tmpdepfile='$(DEPDIR)/check_test-check-hildon-helper.TPo' @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -c -o check_test-check-hildon-defines.o `test -f 'check-hildon-defines.c' || echo '$(srcdir)/'`check-hildon-defines.c
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -c -o check_test-check-hildon-helper.o `test -f 'check-hildon-helper.c' || echo '$(srcdir)/'`check-hildon-helper.c
 
-check_test-check-hildon-defines.obj: check-hildon-defines.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -MT check_test-check-hildon-defines.obj -MD -MP -MF "$(DEPDIR)/check_test-check-hildon-defines.Tpo" -c -o check_test-check-hildon-defines.obj `if test -f 'check-hildon-defines.c'; then $(CYGPATH_W) 'check-hildon-defines.c'; else $(CYGPATH_W) '$(srcdir)/check-hildon-defines.c'; fi`; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/check_test-check-hildon-defines.Tpo" "$(DEPDIR)/check_test-check-hildon-defines.Po"; else rm -f "$(DEPDIR)/check_test-check-hildon-defines.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='check-hildon-defines.c' object='check_test-check-hildon-defines.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      depfile='$(DEPDIR)/check_test-check-hildon-defines.Po' tmpdepfile='$(DEPDIR)/check_test-check-hildon-defines.TPo' @AMDEPBACKSLASH@
+check_test-check-hildon-helper.obj: check-hildon-helper.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -MT check_test-check-hildon-helper.obj -MD -MP -MF "$(DEPDIR)/check_test-check-hildon-helper.Tpo" -c -o check_test-check-hildon-helper.obj `if test -f 'check-hildon-helper.c'; then $(CYGPATH_W) 'check-hildon-helper.c'; else $(CYGPATH_W) '$(srcdir)/check-hildon-helper.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/check_test-check-hildon-helper.Tpo" "$(DEPDIR)/check_test-check-hildon-helper.Po"; else rm -f "$(DEPDIR)/check_test-check-hildon-helper.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='check-hildon-helper.c' object='check_test-check-hildon-helper.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      depfile='$(DEPDIR)/check_test-check-hildon-helper.Po' tmpdepfile='$(DEPDIR)/check_test-check-hildon-helper.TPo' @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -c -o check_test-check-hildon-defines.obj `if test -f 'check-hildon-defines.c'; then $(CYGPATH_W) 'check-hildon-defines.c'; else $(CYGPATH_W) '$(srcdir)/check-hildon-defines.c'; fi`
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -c -o check_test-check-hildon-helper.obj `if test -f 'check-hildon-helper.c'; then $(CYGPATH_W) 'check-hildon-helper.c'; else $(CYGPATH_W) '$(srcdir)/check-hildon-helper.c'; fi`
 
-check_test-check-hildon-defines.lo: check-hildon-defines.c
-@am__fastdepCC_TRUE@   if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -MT check_test-check-hildon-defines.lo -MD -MP -MF "$(DEPDIR)/check_test-check-hildon-defines.Tpo" -c -o check_test-check-hildon-defines.lo `test -f 'check-hildon-defines.c' || echo '$(srcdir)/'`check-hildon-defines.c; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/check_test-check-hildon-defines.Tpo" "$(DEPDIR)/check_test-check-hildon-defines.Plo"; else rm -f "$(DEPDIR)/check_test-check-hildon-defines.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='check-hildon-defines.c' object='check_test-check-hildon-defines.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      depfile='$(DEPDIR)/check_test-check-hildon-defines.Plo' tmpdepfile='$(DEPDIR)/check_test-check-hildon-defines.TPlo' @AMDEPBACKSLASH@
+check_test-check-hildon-helper.lo: check-hildon-helper.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -MT check_test-check-hildon-helper.lo -MD -MP -MF "$(DEPDIR)/check_test-check-hildon-helper.Tpo" -c -o check_test-check-hildon-helper.lo `test -f 'check-hildon-helper.c' || echo '$(srcdir)/'`check-hildon-helper.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/check_test-check-hildon-helper.Tpo" "$(DEPDIR)/check_test-check-hildon-helper.Plo"; else rm -f "$(DEPDIR)/check_test-check-hildon-helper.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='check-hildon-helper.c' object='check_test-check-hildon-helper.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      depfile='$(DEPDIR)/check_test-check-hildon-helper.Plo' tmpdepfile='$(DEPDIR)/check_test-check-hildon-helper.TPlo' @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -c -o check_test-check-hildon-defines.lo `test -f 'check-hildon-defines.c' || echo '$(srcdir)/'`check-hildon-defines.c
+@am__fastdepCC_FALSE@  $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -c -o check_test-check-hildon-helper.lo `test -f 'check-hildon-helper.c' || echo '$(srcdir)/'`check-hildon-helper.c
 
 check_test-check-hildon-code-dialog.o: check-hildon-code-dialog.c
 @am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -MT check_test-check-hildon-code-dialog.o -MD -MP -MF "$(DEPDIR)/check_test-check-hildon-code-dialog.Tpo" -c -o check_test-check-hildon-code-dialog.o `test -f 'check-hildon-code-dialog.c' || echo '$(srcdir)/'`check-hildon-code-dialog.c; \
index 1a86350..fba1225 100644 (file)
@@ -1554,13 +1554,12 @@ the list of tests (Section 2). Use the following example as a template:
 
 ------------------------------------------------------------------------------
 
-- hildon-defines: This file is not a widget, is a library with two
-  utility functions and a lot of defines, as its name says. These two
-  functions should be tested with functional tests because the unit
-  tests that we can implement do not check its more important
+- hildon-helper: This file is not a widget, is a library with two
+  utility functions. These two functions should be tested with functional tests 
+  because the unit tests that we can implement do not check its more important
   behavior, a signal emission.
 
-   - hildon_gtk_widget_set_logical_font: changes the logical font of a
+   - hildon_helper_set_logical_font: changes the logical font of a
      given widget and all its children
 
          - Errors detected: none.
@@ -1572,7 +1571,7 @@ the list of tests (Section 2). Use the following example as a template:
             a) set the font "TimesNewRoman" to a NULL widget
             b) set a NULL font to a GtkLabel
 
-   - hildon_gtk_widget_set_logical_color: changes the logical color of a
+   - hildon_helepr_set_logical_color: changes the logical color of a
      given widget and all its children
 
          - Errors detected: none.
diff --git a/tests/check-hildon-defines.c b/tests/check-hildon-defines.c
deleted file mode 100644 (file)
index 9de7474..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright (C) 2006 Nokia Corporation.
- *
- * Contact: Luc Pionchon <luc.pionchon@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#include <stdlib.h>
-#include <check.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtklabel.h>
-#include "test_suites.h"
-#include "hildon-defines.h"
-
-/* -------------------- Fixtures -------------------- */
-
-static void 
-fx_setup_default_defines ()
-{
-  int argc = 0;
-
-  gtk_init(&argc, NULL);
-}
-
-static void 
-fx_teardown_default_defines ()
-{
-}
-/* -------------------- Test cases -------------------- */
-
-/* ----- Test case for gtk_widget_set_logical_font -----*/
-
-/**
- * Purpose: test setting a new logical font to a GtkWidget
- * Cases considered:
- *    - Set the font name "TimesNewRoman"
- */
-START_TEST (test_gtk_widget_set_logical_font_regular)
-{
-  GtkWidget *label = NULL;
-  gulong signum = G_MAXULONG;
-
-  label = gtk_label_new ("test label");
-
-  signum = hildon_gtk_widget_set_logical_font (label, "TimesNewRoman");
-  gtk_widget_destroy (GTK_WIDGET (label));
-
-  fail_if (signum <= 0,
-          "hildon-defines: the returned signal id is %ul and should be > 0",
-          signum);
-}
-END_TEST
-
-/**
- * Purpose: test setting a logical font with invalid parameters
- * Cases considered:
- *    - Set the font name "TimesNewRoman" to a NULL Widget
- *    - Set a NULL font name to a valid Widget
- */
-START_TEST (test_gtk_widget_set_logical_font_invalid)
-{
-  GtkWidget *label = NULL;
-  gulong signum = G_MAXULONG;
-
-  /* Test 1 */
-  signum = hildon_gtk_widget_set_logical_font (NULL, "TimesNewRoman");
-  fail_if (signum != 0,
-          "hildon-defines: the returned signal id is %ul and should be 0",
-          signum);
-
-  /* Test 2 */
-  label = gtk_label_new ("test label");
-
-  signum = hildon_gtk_widget_set_logical_font (label, NULL);
-  gtk_widget_destroy (GTK_WIDGET (label));
-
-  fail_if (signum != 0,
-          "hildon-defines: the returned signal id is %ul and should be 0",
-          signum);
-}
-END_TEST
-
-
-/* ----- Test case for gtk_widget_set_logical_color -----*/
-
-/**
- * Purpose: test setting a new logical color to a GtkWidget
- * Cases considered:
- *    - Set the logical color "Blue"
- */
-START_TEST (test_gtk_widget_set_logical_color_regular)
-{
-  GtkWidget *label = NULL;
-  gulong signum = G_MAXULONG;
-
-  label = gtk_label_new ("test label");
-
-  signum = hildon_gtk_widget_set_logical_color (label, 
-                                               GTK_RC_BG, 
-                                               GTK_STATE_NORMAL, 
-                                               "Blue");
-  gtk_widget_destroy (GTK_WIDGET (label));
-
-  fail_if (signum <= 0,
-          "hildon-defines: the returned signal id is %ul and should be > 0",
-          signum);
-}
-END_TEST
-
-/**
- * Purpose: test setting a logical color with invalid parameters
- * Cases considered:
- *    - Set the color name "Blue" to a NULL Widget
- *    - Set a NULL color name to a valid Widget
- */
-START_TEST (test_gtk_widget_set_logical_color_invalid)
-{
-  GtkWidget *label = NULL;
-  gulong signum = G_MAXULONG;
-
-  /* Test 1 */
-  signum = hildon_gtk_widget_set_logical_color (NULL,
-                                               GTK_RC_BG, 
-                                               GTK_STATE_NORMAL, 
-                                               "Blue");
-  fail_if (signum != 0,
-          "hildon-defines: the returned signal id is %ul and should be 0",
-          signum);
-
-  /* Create the widget */
-  label = gtk_label_new ("test label");
-
-  /* Test 2 */
-  signum = hildon_gtk_widget_set_logical_color (label,
-                                               GTK_RC_BG, 
-                                               GTK_STATE_NORMAL, 
-                                               NULL);
-  gtk_widget_destroy (GTK_WIDGET (label));
-
-  fail_if (signum != 0,
-          "hildon-defines: the returned signal id is %ul and should be 0",
-          signum);
-}
-END_TEST
-
-
-
-/* ---------- Suite creation ---------- */
-
-Suite *create_hildon_defines_suite()
-{
-  /* Create the suite */
-  Suite *s = suite_create("HildonDefines");
-
-  /* Create test cases */
-  TCase *tc1 = tcase_create("gtk_widget_set_logical_font");
-  TCase *tc2 = tcase_create("gtk_widget_set_logical_color");
-
-  /* Create test case for set_logical_font and add it to the suite */
-  tcase_add_checked_fixture(tc1, fx_setup_default_defines, fx_teardown_default_defines);
-  tcase_add_test(tc1, test_gtk_widget_set_logical_font_regular);
-  tcase_add_test(tc1, test_gtk_widget_set_logical_font_invalid);
-  suite_add_tcase (s, tc1);
-
-  /* Create test case for set_logical_color and add it to the suite */
-  tcase_add_checked_fixture(tc2, fx_setup_default_defines, fx_teardown_default_defines);
-  tcase_add_test(tc2, test_gtk_widget_set_logical_color_regular);
-  tcase_add_test(tc2, test_gtk_widget_set_logical_color_invalid);
-  suite_add_tcase (s, tc2);
-
-  /* Return created suite */
-  return s;             
-}
diff --git a/tests/check-hildon-helper.c b/tests/check-hildon-helper.c
new file mode 100644 (file)
index 0000000..16ea2c3
--- /dev/null
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2006 Nokia Corporation.
+ *
+ * Contact: Luc Pionchon <luc.pionchon@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <stdlib.h>
+#include <check.h>
+#include <gtk/gtkmain.h>
+#include <gtk/gtklabel.h>
+#include "test_suites.h"
+#include "hildon-helper.h"
+
+/* -------------------- Fixtures -------------------- */
+
+static void 
+fx_setup_default_helper ()
+{
+  int argc = 0;
+
+  gtk_init(&argc, NULL);
+}
+
+static void 
+fx_teardown_default_helper ()
+{
+}
+/* -------------------- Test cases -------------------- */
+
+/* ----- Test case for hildon_helper_set_logical_font -----*/
+
+/**
+ * Purpose: test setting a new logical font to a GtkWidget
+ * Cases considered:
+ *    - Set the font name "TimesNewRoman"
+ */
+START_TEST (test_hildon_helper_set_logical_font_regular)
+{
+  GtkWidget *label = NULL;
+  gulong signum = G_MAXULONG;
+
+  label = gtk_label_new ("test label");
+
+  signum = hildon_helper_set_logical_font (label, "TimesNewRoman");
+  gtk_widget_destroy (GTK_WIDGET (label));
+
+  fail_if (signum <= 0,
+          "hildon-helper: the returned signal id is %ul and should be > 0",
+          signum);
+}
+END_TEST
+
+/**
+ * Purpose: test setting a logical font with invalid parameters
+ * Cases considered:
+ *    - Set the font name "TimesNewRoman" to a NULL Widget
+ *    - Set a NULL font name to a valid Widget
+ */
+START_TEST (test_hildon_helper_set_logical_font_invalid)
+{
+  GtkWidget *label = NULL;
+  gulong signum = G_MAXULONG;
+
+  /* Test 1 */
+  signum = hildon_helper_set_logical_font (NULL, "TimesNewRoman");
+  fail_if (signum != 0,
+          "hildon-helper: the returned signal id is %ul and should be 0",
+          signum);
+
+  /* Test 2 */
+  label = gtk_label_new ("test label");
+
+  signum = hildon_helper_set_logical_font (label, NULL);
+  gtk_widget_destroy (GTK_WIDGET (label));
+
+  fail_if (signum != 0,
+          "hildon-helper: the returned signal id is %ul and should be 0",
+          signum);
+}
+END_TEST
+
+
+/* ----- Test case for hildon_helper_set_logical_color -----*/
+
+/**
+ * Purpose: test setting a new logical color to a GtkWidget
+ * Cases considered:
+ *    - Set the logical color "Blue"
+ */
+START_TEST (test_hildon_helper_set_logical_color_regular)
+{
+  GtkWidget *label = NULL;
+  gulong signum = G_MAXULONG;
+
+  label = gtk_label_new ("test label");
+
+  signum = hildon_helper_set_logical_color (label, 
+                                               GTK_RC_BG, 
+                                               GTK_STATE_NORMAL, 
+                                               "Blue");
+  gtk_widget_destroy (GTK_WIDGET (label));
+
+  fail_if (signum <= 0,
+          "hildon-helper: the returned signal id is %ul and should be > 0",
+          signum);
+}
+END_TEST
+
+/**
+ * Purpose: test setting a logical color with invalid parameters
+ * Cases considered:
+ *    - Set the color name "Blue" to a NULL Widget
+ *    - Set a NULL color name to a valid Widget
+ */
+START_TEST (test_hildon_helper_set_logical_color_invalid)
+{
+  GtkWidget *label = NULL;
+  gulong signum = G_MAXULONG;
+
+  /* Test 1 */
+  signum = hildon_helper_set_logical_color (NULL,
+                                               GTK_RC_BG, 
+                                               GTK_STATE_NORMAL, 
+                                               "Blue");
+  fail_if (signum != 0,
+          "hildon-helper: the returned signal id is %ul and should be 0",
+          signum);
+
+  /* Create the widget */
+  label = gtk_label_new ("test label");
+
+  /* Test 2 */
+  signum = hildon_helper_set_logical_color (label,
+                                               GTK_RC_BG, 
+                                               GTK_STATE_NORMAL, 
+                                               NULL);
+  gtk_widget_destroy (GTK_WIDGET (label));
+
+  fail_if (signum != 0,
+          "hildon-helper: the returned signal id is %ul and should be 0",
+          signum);
+}
+END_TEST
+
+
+
+/* ---------- Suite creation ---------- */
+
+Suite *create_hildon_helper_suite()
+{
+  /* Create the suite */
+  Suite *s = suite_create("Hildonhelper");
+
+  /* Create test cases */
+  TCase *tc1 = tcase_create("hildon_helper_set_logical_font");
+  TCase *tc2 = tcase_create("hildon_helper_set_logical_color");
+
+  /* Create test case for set_logical_font and add it to the suite */
+  tcase_add_checked_fixture(tc1, fx_setup_default_helper, fx_teardown_default_helper);
+  tcase_add_test(tc1, test_hildon_helper_set_logical_font_regular);
+  tcase_add_test(tc1, test_hildon_helper_set_logical_font_invalid);
+  suite_add_tcase (s, tc1);
+
+  /* Create test case for set_logical_color and add it to the suite */
+  tcase_add_checked_fixture(tc2, fx_setup_default_helper, fx_teardown_default_helper);
+  tcase_add_test(tc2, test_hildon_helper_set_logical_color_regular);
+  tcase_add_test(tc2, test_hildon_helper_set_logical_color_invalid);
+  suite_add_tcase (s, tc2);
+
+  /* Return created suite */
+  return s;             
+}
index 826bb5e..0978ba0 100644 (file)
@@ -61,7 +61,7 @@ configure_tests(gint environment)
   /* srunner_add_suite(sr, create_hildon_dialoghelp_suite()); */
   srunner_add_suite(sr, create_hildon_calendar_popup_suite());
   srunner_add_suite(sr, create_hildon_caption_suite());
-  srunner_add_suite(sr, create_hildon_defines_suite());
+  srunner_add_suite(sr, create_hildon_helper_suite());
   srunner_add_suite(sr, create_hildon_find_toolbar_suite());
   /* srunner_add_suite(sr, create_hildon_name_password_dialog_suite());
   srunner_add_suite(sr, create_hildon_get_password_dialog_suite());