added test case for bug 28760
[hildon] / ut / hildon-widgets_tests.c
index 71aa561..ae93bd1 100644 (file)
 #include <hildon-widgets/hildon-grid.h>
 #include <hildon-widgets/hildon-time-editor.h>
 #include <hildon-widgets/hildon-name-password-dialog.h>
+#include <hildon-widgets/hildon-caption.h>
 #include <outo.h>
 
 /* Icon which must exist (HildonGridItem). */
-#define VALID_ICON  "Help"
+#define VALID_ICON  "qgn_list_gene_default_app"
 
 /*prototypes to keep the compiler happy*/
 testcase *get_tests(void);
@@ -167,11 +168,13 @@ int test19c(void);
 int test19d(void);
 int test19e(void);
 
+#if 0
 /* find object dialog */
 int test20a(void);
 int test20b(void);
 int test20c(void);
 int test20d(void);
+#endif
 
 /* find object options dialog */
 /*int test21a(void);
@@ -314,10 +317,13 @@ int test35e(void);
 int test35f(void);
 int test35g(void);
 int test35h(void);
+
+#if 0
 int test36a(void);
 int test36b(void);
 int test36c(void);
 int test36d(void);
+#endif
 
 /* New infoprint/banner functionalities. */
 int test37a(void);
@@ -332,6 +338,13 @@ int test39b(void);
 #ifndef HILDON_DISABLE_DEPRECATED
 int test41a(void);
 #endif
+
+int test42 (void);
+int test43 (void);
+int test44 (void);
+int test45 (void);
+int test46 (void);
+
 /* this has to be like this (not static). outo
    calls for this! */
 testcase *get_tests(void);
@@ -2908,6 +2921,75 @@ int test39b()
    return 1;
 }
 
+int test42 ()
+{
+  GtkWidget *entry, *caption;
+
+  entry = gtk_entry_new ();
+  caption = hildon_caption_new (NULL /* group */,
+                               "caption text",
+                               GTK_WIDGET(entry), NULL,
+                               HILDON_CAPTION_OPTIONAL /* flag */);
+
+  g_assert (caption);
+  return 1;
+}
+
+int test43 ()
+{
+  GtkWidget *dialog;
+
+  dialog = hildon_get_password_dialog_new (NULL, TRUE);
+  g_assert (dialog);
+
+  dialog = hildon_get_password_dialog_new (NULL, FALSE);
+  g_assert (dialog);
+
+  return 1;
+}
+
+int test44 ()
+{
+  GtkWidget *dialog;
+
+  dialog = hildon_get_password_dialog_new_with_default (NULL, "seekrit",
+                                                       TRUE);
+  g_assert (dialog);
+
+  dialog = hildon_get_password_dialog_new_with_default (NULL, "seekrit",
+                                                       FALSE);
+  g_assert (dialog);
+
+  return 1;
+}
+
+int test45 ()
+{
+  GtkWidget *dialog;
+
+  dialog = hildon_calendar_popup_new (NULL, 1973, 5, 11);
+
+  g_assert (dialog);
+
+  return 1;
+}
+
+int test46 ()
+{
+  GtkWidget *dialog;
+
+  dialog = hildon_add_home_dialog_new (NULL, "oldname", "newname");
+
+  g_assert (dialog);
+
+  dialog = hildon_add_home_dialog_new (NULL, "oldname", NULL);
+
+  g_assert (dialog);
+
+  return 1;
+}
+
+
 testcase tcases[] =
 {
     {*test1a, "hildon_controlbar_new", EXPECT_OK},
@@ -2997,10 +3079,12 @@ testcase tcases[] =
     {*test19c, "htp_editor_set/get_number: inv", EXPECT_OK},
     {*test19d, "htp_editor_set_number: null", EXPECT_ASSERT},
     {*test19e, "htp_editor_get_number: null", EXPECT_ASSERT},
+#if 0
     {*test20a, "hildon_find_object: new", EXPECT_OK},
     {*test20b, "hildon_find_object: with_options", EXPECT_OK},
     {*test20c, "hildon_find_object: get_text", EXPECT_OK},
     {*test20d, "hildon_find_object: get_label", EXPECT_OK},
+#endif
     /*{*test21a, "hildon_find_options: new", EXPECT_OK},
     {*test21b, "hildon_find_options: hide_loc", EXPECT_OK},
     {*test21c, "hildon_find_options: hide_find_in", EXPECT_OK},
@@ -3064,11 +3148,11 @@ testcase tcases[] =
     {*test32a, "hildon_rename_dialog: ok", EXPECT_OK},
     {*test32b, "hildon_rename_dialog: NULL(ok)", EXPECT_OK},
     {*test33a1, "grid_item_new (\"foo\")", EXPECT_OK},
-    {*test33a2, "grid_item_new (NULL)", EXPECT_ASSERT},
+    {*test33a2, "grid_item_new (NULL)", EXPECT_OK},
     {*test33b1, "grid_item_new_label (\"foo\", \"bar\")", EXPECT_OK},
     {*test33b2, "grid_item_new_label (\"foo\", NULL)", EXPECT_OK},
-    {*test33b3, "grid_item_new_label (NULL, \"bar\")", EXPECT_ASSERT},
-    {*test33b4, "grid_item_new_label (NULL, NULL)", EXPECT_ASSERT},
+    {*test33b3, "grid_item_new_label (NULL, \"bar\")", EXPECT_OK},
+    {*test33b4, "grid_item_new_label (NULL, NULL)", EXPECT_OK},
     {*test33c1, "grid_item_set_emblem (foo, \"bar\")", EXPECT_OK},
     {*test33c2, "grid_item_set_emblem (foo, NULL)", EXPECT_OK},
     {*test33c3, "grid_item_set_emblem (NULL, \"bar\")", EXPECT_ASSERT},
@@ -3116,17 +3200,25 @@ testcase tcases[] =
     {*test35f, "hildon_time_editor_enable_duration_mode (TRUE, FALSE", EXPECT_OK},
     {*test35g, "hildon_time_editor_set/get_time with foo value check", EXPECT_ASSERT},
     {*test35h, "hildon_time_editor_set/get_duration_range with foo value check", EXPECT_ASSERT},
+#if 0
     {*test36a, "hildon_find_replace_dialog_new", EXPECT_OK},
     {*test36b, "hildon_find_replace_dialog_new_with_options", EXPECT_OK},
     {*test36c, "hildon_find_replace_dialog_get_text", EXPECT_OK},
     {*test36d, "hildon_find_replace_dialog_get_new_text", EXPECT_OK},
+#endif
     {*test37a, "gtk_infoprint_temporarily_disable_wrap", EXPECT_OK},
     {*test37b, "gtk_banner_temporarily_disable_wrap", EXPECT_OK},
     {*test39a, "namepassword dialog get_name", EXPECT_OK},
     {*test39b, "namepassword dialog get_password", EXPECT_OK},
 /*    {*test38a, "gtk_confirmation_banner (sometext)", EXPECT_OK},
     {*test38a, "gtk_confirmation_banner (NULL)", EXPECT_OK},*/
-   
+
+    { test42, "hildon_caption_new", EXPECT_OK },
+    { test43, "hildon_get_password_dialog_new", EXPECT_OK },
+    { test44, "hildon_get_password_dialog_new_with_default", EXPECT_OK },
+    { test45, "hildon_calendor_popup_new", EXPECT_OK },
+    { test46, "hildon_add_home_dialog_new", EXPECT_OK },
+
     {0} /*REMEMBER THE TERMINATING NULL*/
 };
 
@@ -3139,5 +3231,3 @@ testcase* get_tests()
     g_log_set_always_fatal (G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
     return tcases;
 }
-
-