Make it pass again.

2008-01-03  Johan Dahlin  <johan@gnome.org>

	* tests/defaultvaluetest.c: Make it pass again.


svn path=/trunk/; revision=19300
This commit is contained in:
Johan Dahlin 2008-01-03 08:51:03 +00:00 committed by Johan Dahlin
parent 731fc9107a
commit caba82cf43
2 changed files with 43 additions and 11 deletions

View File

@ -1,3 +1,7 @@
2008-01-03 Johan Dahlin <johan@gnome.org>
* tests/defaultvaluetest.c: Make it pass again.
2008-01-02 Johan Dahlin <johan@gnome.org>
* tests/defaultvaluetest.c (test_type): Ignore a few more tests to

View File

@ -19,11 +19,9 @@
*/
#undef GTK_DISABLE_DEPRECATED
#define GTK_ENABLE_BROKEN
#include <string.h>
#include <gtk/gtk.h>
#include <gtk/gtktypebuiltins.h>
#include <gtk/gtkprinter.h>
#include <gtk/gtkpagesetupunixdialog.h>
#include <gtk/gtkprintunixdialog.h>
static void
@ -78,20 +76,34 @@ test_type (gconstpointer data)
return;
/* These can't be freely constructed/destroyed */
if (g_type_is_a (type, GTK_TYPE_PRINT_JOB))
if (g_type_is_a (type, GTK_TYPE_PRINT_JOB) ||
g_type_is_a (type, GDK_TYPE_PIXBUF_LOADER) ||
g_type_is_a (type, gdk_pixbuf_simple_anim_iter_get_type ()))
return;
/* The gtk_arg compat wrappers can't set up default values */
if (g_type_is_a (type, GTK_TYPE_CLIST) ||
g_type_is_a (type, GTK_TYPE_CTREE) ||
g_type_is_a (type, GTK_TYPE_LIST) ||
g_type_is_a (type, GTK_TYPE_TIPS_QUERY))
g_type_is_a (type, GTK_TYPE_TIPS_QUERY))
return;
klass = g_type_class_ref (type);
if (g_type_is_a (type, GTK_TYPE_SETTINGS))
instance = g_object_ref (gtk_settings_get_default ());
else if (g_type_is_a (type, GDK_TYPE_PANGO_RENDERER))
instance = g_object_ref (gdk_pango_renderer_get_default (gdk_screen_get_default ()));
else if (g_type_is_a (type, GDK_TYPE_PIXMAP))
instance = g_object_ref (gdk_pixmap_new (NULL, 1, 1, 1));
else if (g_type_is_a (type, GDK_TYPE_COLORMAP))
instance = g_object_ref (gdk_colormap_new (gdk_visual_get_best (), TRUE));
else if (g_type_is_a (type, GDK_TYPE_WINDOW))
{
GdkWindowAttr attributes;
attributes.window_type = GDK_WINDOW_TEMP;
instance = g_object_ref (gdk_window_new (NULL, &attributes, 0));
}
else
instance = g_object_new (type, NULL);
@ -110,11 +122,12 @@ test_type (gconstpointer data)
if ((pspec->flags & G_PARAM_READABLE) == 0)
continue;
/* Filter these out */
if (g_type_is_a (type, GTK_TYPE_WIDGET) &&
(strcmp (pspec->name, "name") == 0 ||
strcmp (pspec->name, "screen") == 0 ||
strcmp (pspec->name, "style") == 0))
if (g_type_is_a (type, GDK_TYPE_DISPLAY_MANAGER) &&
(strcmp (pspec->name, "default-display") == 0))
continue;
if (g_type_is_a (type, GDK_TYPE_PANGO_RENDERER) &&
(strcmp (pspec->name, "screen") == 0))
continue;
if (g_type_is_a (type, GTK_TYPE_ABOUT_DIALOG) &&
@ -235,6 +248,11 @@ test_type (gconstpointer data)
strcmp (pspec->name, "font-desc") == 0))
continue;
if (g_type_is_a (type, GTK_TYPE_TEXT) &&
(strcmp (pspec->name, "hadjustment") == 0 ||
strcmp (pspec->name, "vadjustment") == 0))
continue;
if (g_type_is_a (type, GTK_TYPE_TEXT_VIEW) &&
strcmp (pspec->name, "buffer") == 0)
continue;
@ -249,6 +267,12 @@ test_type (gconstpointer data)
strcmp (pspec->name, "vadjustment") == 0))
continue;
if (g_type_is_a (type, GTK_TYPE_WIDGET) &&
(strcmp (pspec->name, "name") == 0 ||
strcmp (pspec->name, "screen") == 0 ||
strcmp (pspec->name, "style") == 0))
continue;
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
g_object_get_property (instance, pspec->name, &value);
check_property ("Property", pspec, &value);
@ -277,7 +301,11 @@ test_type (gconstpointer data)
}
}
g_object_unref (instance);
if (g_type_is_a (type, GDK_TYPE_WINDOW))
gdk_window_destroy (GDK_WINDOW (instance));
else
g_object_unref (instance);
g_type_class_unref (klass);
}