]> Pileus Git - ~andy/gtk/blobdiff - gtk/tests/object.c
Change FSF Address
[~andy/gtk] / gtk / tests / object.c
index c243913c50a390dabfffbf2819d26335bd2d45d6..ff3979ecc046d85f61533bcc62b29297dccd0839 100644 (file)
@@ -13,9 +13,7 @@
  * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 #include <gtk/gtk.h>
 #include <string.h>
@@ -72,7 +70,6 @@ list_ignore_properties (gboolean buglist)
     { "GtkColorSelection",      "current-color",        (void*) NULL, },                /* not a valid boxed color */
     { "GtkComboBox",            "row-span-column",      (void*) MATCH_ANY_VALUE },      /* GtkComboBoxEntry needs a tree model for this */
     { "GtkComboBox",            "column-span-column",   (void*) MATCH_ANY_VALUE },      /* GtkComboBoxEntry needs a tree model for this */
-    { "GtkComboBoxEntry",       "text-column",          (void*) MATCH_ANY_VALUE },      /* GtkComboBoxEntry needs a tree model for this */
     { "GtkFileChooserButton",   "select-multiple",      (void*) MATCH_ANY_VALUE },      /* property disabled */
     { "GtkFileChooserButton",   "action",               (void*) GTK_FILE_CHOOSER_ACTION_SAVE },
     { "GtkFileChooserButton",   "action",               (void*) GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER },
@@ -89,11 +86,6 @@ list_ignore_properties (gboolean buglist)
   static const IgnoreProperty bug_properties[] = {
     { "GtkComboBox",            "active",               (void*) MATCH_ANY_VALUE },      /* FIXME: triggers NULL model bug */
     { "GtkCTree",               "spacing",              (void*) MATCH_ANY_VALUE },      /* FIXME: triggers signedness bug */
-    { "GtkCurve",               "curve-type",           (void*) MATCH_ANY_VALUE },      /* FIXME: triggers OOM */
-    { "GtkCurve",               "min-x",                (void*) 0x80000000 },           /* FIXME: triggers coordinate OOB */
-    { "GtkCurve",               "min-y",                (void*) 0x80000000 },           /* FIXME: triggers coordinate OOB */
-    { "GtkCurve",               "max-x",                (void*) 0x80000000 },           /* FIXME: triggers coordinate OOB */
-    { "GtkCurve",               "max-y",                (void*) 0x80000000 },           /* FIXME: triggers coordinate OOB */
     { "GtkFileChooserButton",   "local-only",           (void*) MATCH_ANY_VALUE },      /* FIXME: triggers NULL path assertion */
     { "GtkFileChooserDialog",   "local-only",           (void*) MATCH_ANY_VALUE },      /* FIXME: triggers NULL path assertion */
     { "GtkFileChooserWidget",   "local-only",           (void*) MATCH_ANY_VALUE },      /* FIXME: triggers NULL path assertion */
@@ -185,15 +177,15 @@ value_as_pointer (GValue *value)
   if (g_value_fits_pointer (value))
     return g_value_peek_pointer (value);
   if (G_VALUE_HOLDS_BOOLEAN (value))
-    return (void*) g_value_get_boolean (value);
+    return GINT_TO_POINTER(g_value_get_boolean (value));
   if (G_VALUE_HOLDS_CHAR (value))
     return (void*) (gssize) g_value_get_char (value);
   if (G_VALUE_HOLDS_UCHAR (value))
     return (void*) (gsize) g_value_get_uchar (value);
   if (G_VALUE_HOLDS_INT (value))
-    return (void*) g_value_get_int (value);
+    return GINT_TO_POINTER(g_value_get_int (value));
   if (G_VALUE_HOLDS_UINT (value))
-    return (void*) g_value_get_uint (value);
+    return GUINT_TO_POINTER(g_value_get_uint (value));
   if (G_VALUE_HOLDS_LONG (value))
     return (void*) g_value_get_long (value);
   if (G_VALUE_HOLDS_ULONG (value))
@@ -218,7 +210,7 @@ object_test_property (GObject           *object,
   if (pspec->flags & G_PARAM_WRITABLE &&
       !(pspec->flags & (G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY)))
     {
-      GValue value = { 0, };
+      GValue value = G_VALUE_INIT;
       guint i;
       const IgnoreProperty *ignore_properties;
       /* select value to set */
@@ -227,15 +219,16 @@ object_test_property (GObject           *object,
       /* ignore untestable properties */
       ignore_properties = list_ignore_properties (FALSE);
       for (i = 0; ignore_properties[i].name; i++)
-        if (g_type_is_a (G_OBJECT_TYPE (object), g_type_from_name (ignore_properties[i].type_name)) &&
-            strcmp (pspec->name, ignore_properties[i].name) == 0 &&
-            (MATCH_ANY_VALUE == ignore_properties[i].value ||
-             value_as_pointer (&value) == ignore_properties[i].value ||
-             (G_VALUE_HOLDS_STRING (&value) &&
-              strcmp (g_value_get_string (&value), ignore_properties[i].value) == 0)))
+        if (g_strcmp0 ("", ignore_properties[i].name) ||
+            (g_type_is_a (G_OBJECT_TYPE (object), g_type_from_name (ignore_properties[i].type_name)) &&
+             strcmp (pspec->name, ignore_properties[i].name) == 0 &&
+             (MATCH_ANY_VALUE == ignore_properties[i].value ||
+              value_as_pointer (&value) == ignore_properties[i].value ||
+              (G_VALUE_HOLDS_STRING (&value) &&
+               strcmp (g_value_get_string (&value), ignore_properties[i].value) == 0))))
           break;
       /* ignore known property bugs if not testing thoroughly */
-      if (ignore_properties[i].name == NULL && !g_test_thorough())
+      if (ignore_properties[i].name == NULL && !g_test_thorough ())
         {
           ignore_properties = list_ignore_properties (TRUE);
           for (i = 0; ignore_properties[i].name; i++)
@@ -250,7 +243,7 @@ object_test_property (GObject           *object,
       /* assign unignored properties */
       if (ignore_properties[i].name == NULL)
         {
-          if (g_test_verbose())
+          if (g_test_verbose ())
             g_print ("PropertyTest: %s::%s := (%s value (%s): %p)\n",
                      g_type_name (G_OBJECT_TYPE (object)), pspec->name,
                      SELECT_NAME (dvalue), g_type_name (G_VALUE_TYPE (&value)),
@@ -283,14 +276,7 @@ static void
 widget_fixups (GtkWidget *widget)
 {
   /* post-constructor for widgets that need additional settings to work correctly */
-  if (GTK_IS_COMBO_BOX_ENTRY (widget))
-    {
-      GtkListStore *store = gtk_list_store_new (1, G_TYPE_STRING);
-      g_object_set (widget, "model", store, "text-column", 0, NULL);
-      g_object_unref (store);
-      gtk_combo_box_append_text (GTK_COMBO_BOX (widget), "test text");
-    }
-  else if (GTK_IS_COMBO_BOX (widget))
+  if (GTK_IS_COMBO_BOX (widget))
     {
       GtkListStore *store = gtk_list_store_new (1, G_TYPE_STRING);
       g_object_set (widget, "model", store, NULL);
@@ -330,7 +316,7 @@ main (int   argc,
   /* initialize test program */
   pixbuf_init ();
   gtk_test_init (&argc, &argv);
-  gtk_test_register_all_types();
+  gtk_test_register_all_types ();
   /* install a property test for each widget type */
   otypes = gtk_test_list_all_types (NULL);
   for (i = 0; otypes[i]; i++)
@@ -342,5 +328,5 @@ main (int   argc,
         g_test_add_data_func (testpath, (void*) otypes[i], widget_property_tests);
         g_free (testpath);
       }
-  return g_test_run();
+  return g_test_run ();
 }