[maemo-commits] [maemo-commits] r9899 - in projects/haf/branches/hildon-libs/hildon-1: . src tests

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Feb 15 14:37:22 EET 2007
Author: mdk
Date: 2007-02-15 14:37:20 +0200 (Thu, 15 Feb 2007)
New Revision: 9899

Modified:
   projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2
   projects/haf/branches/hildon-libs/hildon-1/src/hildon-caption.c
   projects/haf/branches/hildon-libs/hildon-1/src/hildon-time-editor.c
   projects/haf/branches/hildon-libs/hildon-1/tests/check-hildon-caption.c
   projects/haf/branches/hildon-libs/hildon-1/tests/check-hildon-controlbar.c
   projects/haf/branches/hildon-libs/hildon-1/tests/check-hildon-date-editor.c
   projects/haf/branches/hildon-libs/hildon-1/tests/check-hildon-font-selection-dialog.c
   projects/haf/branches/hildon-libs/hildon-1/tests/check-hildon-note.c
Log:
Fixing the tests a little.
Fixing some mem problems in the time editor.


Modified: projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2
===================================================================
--- projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2	2007-02-15 12:21:26 UTC (rev 9898)
+++ projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2	2007-02-15 12:37:20 UTC (rev 9899)
@@ -1,3 +1,14 @@
+2007-02-15  Michael Dominic Kostrzewa  <michael.kostrzewa at nokia.com> 
+
+	* src/hildon-time-editor.c: Check before freeing am/pm strings in
+	finalize.
+
+	* tests/check-hildon-caption.c: 
+	* tests/check-hildon-controlbar.c:
+	* tests/check-hildon-date-editor.c:
+	* tests/check-hildon-font-selection-dialog.c:
+	* tests/check-hildon-note.c: Fixing the tests a little.
+
 2007-02-14  Michael Dominic Kostrzewa  <michael.kostrzewa at nokia.com> 
 
 	* examples/Makefile.am:

Modified: projects/haf/branches/hildon-libs/hildon-1/src/hildon-caption.c
===================================================================
--- projects/haf/branches/hildon-libs/hildon-1/src/hildon-caption.c	2007-02-15 12:21:26 UTC (rev 9898)
+++ projects/haf/branches/hildon-libs/hildon-1/src/hildon-caption.c	2007-02-15 12:37:20 UTC (rev 9899)
@@ -1059,7 +1059,7 @@
     priv = HILDON_CAPTION_GET_PRIVATE (caption);
     g_assert (priv);
 
-    return (gchar*) gtk_label_get_text (GTK_LABEL (GTK_LABEL (priv->label)));
+    return (gchar*) gtk_label_get_text (GTK_LABEL (priv->label));
 }
 
 /**

Modified: projects/haf/branches/hildon-libs/hildon-1/src/hildon-time-editor.c
===================================================================
--- projects/haf/branches/hildon-libs/hildon-1/src/hildon-time-editor.c	2007-02-15 12:21:26 UTC (rev 9898)
+++ projects/haf/branches/hildon-libs/hildon-1/src/hildon-time-editor.c	2007-02-15 12:37:20 UTC (rev 9899)
@@ -698,9 +698,12 @@
     HildonTimeEditorPrivate *priv = HILDON_TIME_EDITOR_GET_PRIVATE (obj_self);
     g_assert (priv);
 
-    g_free (priv->am_symbol);
-    g_free (priv->pm_symbol);
+    if (priv->am_symbol) 
+            g_free (priv->am_symbol);
 
+    if (priv->pm_symbol)
+            g_free (priv->pm_symbol);
+
     if (priv->highlight_idle)
         g_source_remove (priv->highlight_idle);
 
@@ -793,7 +796,7 @@
     guint i, h, m, s;
     gchar str[3];
 
-    g_assert (HILDON_IS_TIME_EDITOR (editor));
+    g_return_if_fail (HILDON_IS_TIME_EDITOR (editor));
 
     priv = HILDON_TIME_EDITOR_GET_PRIVATE (editor);
     g_assert (priv);

Modified: projects/haf/branches/hildon-libs/hildon-1/tests/check-hildon-caption.c
===================================================================
--- projects/haf/branches/hildon-libs/hildon-1/tests/check-hildon-caption.c	2007-02-15 12:21:26 UTC (rev 9898)
+++ projects/haf/branches/hildon-libs/hildon-1/tests/check-hildon-caption.c	2007-02-15 12:37:20 UTC (rev 9899)
@@ -38,6 +38,8 @@
 
 #include <libintl.h>
 
+#define _(String) dgettext("hildon-libs", String)
+
 /* -------------------- Fixtures -------------------- */
 
 static HildonCaption *caption = NULL;
@@ -285,7 +287,7 @@
   /* We control i18n so we will never set it properly because apparently it will not be useful for testing */
   /* so _("ecdg_ti_caption_separato") should return the same result that "ecdg_ti_caption_separator" */
   /* If in the future we decide activate internationalization we must modify test implementation */
-  expected_ret_label = g_strconcat(TEST_LABEL,"ecdg_ti_caption_separator",NULL);
+  expected_ret_label = g_strconcat(TEST_LABEL,_("ecdg_ti_caption_separator"),NULL);
 
   /* Test 1 */
   hildon_caption_set_label (caption, TEST_LABEL);
@@ -303,7 +305,7 @@
   /* Test 2 */
   hildon_caption_set_label (caption, "");
   
-  fail_if (strcmp (hildon_caption_get_label (caption),"ecdg_ti_caption_separator") != 0,
+  fail_if (strcmp (hildon_caption_get_label (caption),_("ecdg_ti_caption_separator")) != 0,
            "hildon-caption: the returned label is %s and should be default separator",
            hildon_caption_get_label (caption));
 }
@@ -363,7 +365,7 @@
 
   /* Test 1 */
   hildon_caption_set_label (caption, TEST_LABEL);
-  expected_ret_label = g_strconcat(TEST_LABEL,"ecdg_ti_caption_separator",NULL);
+  expected_ret_label = g_strconcat(TEST_LABEL, _("ecdg_ti_caption_separator"),NULL);
 
   fail_if (strcmp (hildon_caption_get_label (caption), expected_ret_label) != 0,
 	   "hildon-caption: the returned label is %s and should be %s",
@@ -374,7 +376,7 @@
   /* Test 2 */
   hildon_caption_set_label (caption, "");
 
-  fail_if (strcmp (hildon_caption_get_label (caption), "ecdg_ti_caption_separator") != 0,
+  fail_if (strcmp (hildon_caption_get_label (caption), _("ecdg_ti_caption_separator")) != 0,
 	   "hildon-caption: the returned label is %s and should be default separator",
 	   hildon_caption_get_label (caption));
 }

Modified: projects/haf/branches/hildon-libs/hildon-1/tests/check-hildon-controlbar.c
===================================================================
--- projects/haf/branches/hildon-libs/hildon-1/tests/check-hildon-controlbar.c	2007-02-15 12:21:26 UTC (rev 9898)
+++ projects/haf/branches/hildon-libs/hildon-1/tests/check-hildon-controlbar.c	2007-02-15 12:37:20 UTC (rev 9899)
@@ -176,9 +176,9 @@
 
   min=hildon_controlbar_get_min(controlbar);
 
-  fail_if (min != 0,
-           "hildon-controlbar: The returned min is %d and should be 0",
-           min);
+  fail_if (min != init_min,
+           "hildon-controlbar: The returned min is %d and should be %d",
+           min, init_min);
 
   max=hildon_controlbar_get_max(controlbar);
 
@@ -193,14 +193,14 @@
 
   min=hildon_controlbar_get_min(controlbar);
 
-  fail_if (min != 0,
-           "hildon-controlbar: The returned min is %d and should be 0",
-           min, 0);
+  fail_if (min != init_min,
+           "hildon-controlbar: The returned min is %d and should be %d",
+           min, init_min);
   max=hildon_controlbar_get_max(controlbar);
 
-  fail_if (max != 0,
-           "hildon-controlbar: The returned max is %d and should be 0",
-           max);
+  fail_if (max != init_max,
+           "hildon-controlbar: The returned max is %d and should be %d",
+           max, init_max);
 
   /* Test 4: Set a range of [G_MAXINT,-1] */
   init_min = G_MAXINT;
@@ -209,15 +209,15 @@
 
   max=hildon_controlbar_get_max(controlbar);
 
-  fail_if (max != 0,
-           "hildon-controlbar: The returned max is %d and should be 0",
-           max);
+  fail_if (max != init_max,
+           "hildon-controlbar: The returned max is %d and should be %d",
+           max, init_max);
 
   min=hildon_controlbar_get_min(controlbar);
 
-  fail_if (min != 0,
-           "hildon-controlbar: The returned min is %d and should be 0",
-           min);
+  fail_if (min != init_max,
+           "hildon-controlbar: The returned min is %d and should be %d",
+           min, init_max);
 
   /* Test 5: Set a range of [1,G_MININT] */
   init_min = 1;
@@ -226,15 +226,15 @@
 
   max=hildon_controlbar_get_max(controlbar);
 
-  fail_if (max != 0,
-           "hildon-controlbar: The returned max is %d and should be 0",
-           max);
+  fail_if (max != init_min,
+           "hildon-controlbar: The returned max is %d and should be %d",
+           max, init_min);
 
   min=hildon_controlbar_get_min(controlbar);
 
-  fail_if (min != 0,
-           "hildon-controlbar: The returned min is %d and should be 0",
-           min);
+  fail_if (min != init_min,
+           "hildon-controlbar: The returned min is %d and should be %d",
+           min, init_min);
 }
 END_TEST
 

Modified: projects/haf/branches/hildon-libs/hildon-1/tests/check-hildon-date-editor.c
===================================================================
--- projects/haf/branches/hildon-libs/hildon-1/tests/check-hildon-date-editor.c	2007-02-15 12:21:26 UTC (rev 9898)
+++ projects/haf/branches/hildon-libs/hildon-1/tests/check-hildon-date-editor.c	2007-02-15 12:37:20 UTC (rev 9899)
@@ -871,7 +871,7 @@
   guint day;
   guint ret_day;
 
-  day = 30;
+  day = 25;
 
   /* Test 1: Try day 30 */
   hildon_date_editor_set_day (date_editor, day);

Modified: projects/haf/branches/hildon-libs/hildon-1/tests/check-hildon-font-selection-dialog.c
===================================================================
--- projects/haf/branches/hildon-libs/hildon-1/tests/check-hildon-font-selection-dialog.c	2007-02-15 12:21:26 UTC (rev 9898)
+++ projects/haf/branches/hildon-libs/hildon-1/tests/check-hildon-font-selection-dialog.c	2007-02-15 12:37:20 UTC (rev 9899)
@@ -33,7 +33,7 @@
 #include "hildon-font-selection-dialog.h"
 
 #define PREVIEW_TEXT TEST_STRING
-#define DEFAULT_FONT_FAMILY "Nokia Sans"
+#define DEFAULT_FONT_FAMILY "Sans"
 
 static const guint16 N_FONT_SIZES = 7;
 static const guint16 FONT_SIZES[] = 

Modified: projects/haf/branches/hildon-libs/hildon-1/tests/check-hildon-note.c
===================================================================
--- projects/haf/branches/hildon-libs/hildon-1/tests/check-hildon-note.c	2007-02-15 12:21:26 UTC (rev 9898)
+++ projects/haf/branches/hildon-libs/hildon-1/tests/check-hildon-note.c	2007-02-15 12:37:20 UTC (rev 9899)
@@ -89,8 +89,8 @@
     
   g_object_get_property(G_OBJECT (note),"note_type",&enum_value);
   note_type = g_value_get_int(&enum_value);
-  fail_if( note_type != HILDON_NOTE_CONFIRMATION_TYPE,
-	   "hildon-note: Type was not set property on creation (HILDON_NOTE_CONFIRMATION_TYPE)",note_type);
+  fail_if( note_type != HILDON_NOTE_TYPE_CONFIRMATION,
+	   "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_CONFIRMATION)",note_type);
 
   gtk_widget_destroy (GTK_WIDGET (note));
   note=NULL;
@@ -109,8 +109,8 @@
 
   g_object_get_property(G_OBJECT (note),"note_type",&enum_value);
   note_type = g_value_get_int(&enum_value);
-  fail_unless( note_type == HILDON_NOTE_CONFIRMATION_TYPE,
-               "hildon-note: Type was not set property on creation (HILDON_NOTE_CONFIRMATION_TYPE)",note_type);
+  fail_unless( note_type == HILDON_NOTE_TYPE_CONFIRMATION,
+               "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_CONFIRMATION)",note_type);
 
   gtk_widget_destroy (GTK_WIDGET (note));
   note=NULL;
@@ -152,8 +152,8 @@
 
   g_object_get_property(G_OBJECT (invalid_note),"note_type",&enum_value);
   note_type = g_value_get_int(&enum_value);
-  fail_if( note_type != HILDON_NOTE_CONFIRMATION_TYPE,
-	   "hildon-note: Type was not set property on creation (HILDON_NOTE_CONFIRMATION_TYPE)",note_type);
+  fail_if( note_type != HILDON_NOTE_TYPE_CONFIRMATION,
+	   "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_CONFIRMATION)",note_type);
 
   gtk_widget_destroy (GTK_WIDGET (invalid_note));
   invalid_note=NULL;
@@ -201,8 +201,8 @@
 
   g_object_get_property(G_OBJECT (note),"note_type",&enum_value);
   note_type = g_value_get_int(&enum_value);   
-  fail_if( note_type != HILDON_NOTE_INFORMATION_THEME_TYPE,
-	   "hildon-note: Type was not set property on creation (HILDON_NOTE_INFORMATION_THEME_TYPE)",note_type);
+  fail_if( note_type != HILDON_NOTE_TYPE_INFORMATION_THEME,
+	   "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_INFORMATION_THEME)",note_type);
 
   gtk_widget_destroy (GTK_WIDGET (note));
   note=NULL;
@@ -221,8 +221,8 @@
 
   g_object_get_property(G_OBJECT (note),"note_type",&enum_value);
   note_type = g_value_get_int(&enum_value);
-  fail_if( note_type != HILDON_NOTE_INFORMATION_THEME_TYPE,
-	   "hildon-note: Type was not set property on creation (HILDON_NOTE_INFORMATION_THEME_TYPE)",note_type);
+  fail_if( note_type != HILDON_NOTE_TYPE_INFORMATION_THEME,
+	   "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_INFORMATION_THEME)",note_type);
 
   gtk_widget_destroy (GTK_WIDGET (note));
   note=NULL;
@@ -264,8 +264,8 @@
 
   g_object_get_property(G_OBJECT (invalid_note),"note_type",&enum_value);
   note_type = g_value_get_int(&enum_value);
-  fail_if( note_type != HILDON_NOTE_INFORMATION_THEME_TYPE,
-	   "hildon-note: Type was not set property on creation (HILDON_NOTE_INFORMATION_THEME_TYPE)",note_type);
+  fail_if( note_type != HILDON_NOTE_TYPE_INFORMATION_THEME,
+	   "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_INFORMATION_THEME)",note_type);
     
   gtk_widget_destroy (GTK_WIDGET (invalid_note));
   invalid_note=NULL;
@@ -318,8 +318,8 @@
   
   g_object_get_property(G_OBJECT (note),"note_type",&enum_value);
   note_type = g_value_get_int(&enum_value);  
-  fail_if( note_type != HILDON_NOTE_CONFIRMATION_TYPE,
-	   "hildon-note: Type was not set property on creation (HILDON_NOTE_CONFIRMATION_TYPE)",note_type);
+  fail_if( note_type != HILDON_NOTE_TYPE_CONFIRMATION,
+	   "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_CONFIRMATION)",note_type);
   
   g_object_get_property(G_OBJECT (note),"icon",&icon_name_value);
   ret_icon_name = g_value_get_string (&icon_name_value);
@@ -345,8 +345,8 @@
   
   g_object_get_property(G_OBJECT (note),"note_type",&enum_value);
   note_type = g_value_get_int(&enum_value);  
-  fail_if( note_type != HILDON_NOTE_CONFIRMATION_TYPE,
-	   "hildon-note: Type was not set property on creation (HILDON_NOTE_CONFIRMATION_TYPE)",note_type);
+  fail_if( note_type != HILDON_NOTE_TYPE_CONFIRMATION,
+	   "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_CONFIRMATION)",note_type);
   
   g_object_get_property(G_OBJECT (note),"icon",&icon_name_value);
   ret_icon_name = g_value_get_string (&icon_name_value);
@@ -404,8 +404,8 @@
 
   g_object_get_property(G_OBJECT (invalid_note),"note_type",&enum_value);
   note_type = g_value_get_int(&enum_value);
-  fail_if( note_type != HILDON_NOTE_CONFIRMATION_TYPE,
-	   "hildon-note: Type was not set property on creation (HILDON_NOTE_CONFIRMATION_TYPE)",note_type);
+  fail_if( note_type != HILDON_NOTE_TYPE_CONFIRMATION,
+	   "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_CONFIRMATION)",note_type);
 
   gtk_widget_destroy (GTK_WIDGET (invalid_note));
   invalid_note=NULL;
@@ -457,8 +457,8 @@
 
   g_object_get_property(G_OBJECT (note),"note_type",&enum_value);
   note_type = g_value_get_int(&enum_value);   
-  fail_if( note_type != HILDON_NOTE_PROGRESSBAR_TYPE,
-	   "hildon-note: Type was not set property on creation (HILDON_NOTE_PROGRESSBAR_TYPE)",note_type);
+  fail_if( note_type != HILDON_NOTE_TYPE_PROGRESSBAR,
+	   "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_PROGRESSBAR)",note_type);
 
   gtk_widget_destroy (GTK_WIDGET (note));
   note=NULL;
@@ -483,8 +483,8 @@
 
   g_object_get_property(G_OBJECT (note),"note_type",&enum_value);
   note_type = g_value_get_int(&enum_value);   
-  fail_if( note_type != HILDON_NOTE_PROGRESSBAR_TYPE,
-	   "hildon-note: Type was not set property on creation (HILDON_NOTE_PROGRESSBAR_TYPE)",note_type);
+  fail_if( note_type != HILDON_NOTE_TYPE_PROGRESSBAR,
+	   "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_PROGRESSBAR)",note_type);
 
   gtk_widget_destroy (GTK_WIDGET (progress_bar));
   gtk_widget_destroy (GTK_WIDGET (note));
@@ -534,8 +534,8 @@
 
   g_object_get_property(G_OBJECT (note),"note_type",&enum_value);
   note_type = g_value_get_int(&enum_value);
-  fail_if( note_type != HILDON_NOTE_PROGRESSBAR_TYPE,
-	   "hildon-note: Type was not set property on creation (HILDON_NOTE_PROGRESSBAR_TYPE)",note_type);
+  fail_if( note_type != HILDON_NOTE_TYPE_PROGRESSBAR,
+	   "hildon-note: Type was not set property on creation (HILDON_NOTE_TYPE_PROGRESSBAR)",note_type);
 
   gtk_widget_destroy (GTK_WIDGET (note));
   note=NULL;


More information about the maemo-commits mailing list