From ca94ff10ce2ea57bfde7692aaa558b1260c9ff75 Mon Sep 17 00:00:00 2001 From: Daniel Boles Date: Fri, 29 Jun 2018 20:00:06 +0100 Subject: [PATCH] testsuite/gtk/defaultvalue: Actually build...& fix It looks like this got dropped during the move from autotools and never restored. I can see why, since making it work wasn't a hugely fun task! Notes on some less then obvious details: * PlacesSidebar is private now and didn't seem to be to be particularly easy to adapt to, so this moves to checking for it by name, not TYPE. I couldn't find a (fast) better way; if you know how, please clean up * added 2 casts to avoid warnings from the new type-propagating ref() * GdkClipboard and GdkContentProvider need some properties dodged * GtkToolItemGroup is gone * fixed indentation and used TypeName:property-name syntax in a print() --- testsuite/gtk/defaultvalue.c | 51 +++++++++++++++++++++++++----------- testsuite/gtk/meson.build | 1 + 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/testsuite/gtk/defaultvalue.c b/testsuite/gtk/defaultvalue.c index 3ae0850868..4b559a0d23 100644 --- a/testsuite/gtk/defaultvalue.c +++ b/testsuite/gtk/defaultvalue.c @@ -96,20 +96,20 @@ test_type (gconstpointer data) if (g_type_is_a (type, GTK_TYPE_FILE_CHOOSER_BUTTON) || g_type_is_a (type, GTK_TYPE_FILE_CHOOSER_DIALOG) || g_type_is_a (type, GTK_TYPE_FILE_CHOOSER_WIDGET) || - g_type_is_a (type, GTK_TYPE_PLACES_SIDEBAR)) + g_str_equal (g_type_name (type), "GtkPlacesSidebar")) return; klass = g_type_class_ref (type); if (g_type_is_a (type, GTK_TYPE_SETTINGS)) - instance = g_object_ref (gtk_settings_get_default ()); + instance = G_OBJECT (g_object_ref (gtk_settings_get_default ())); else if (g_type_is_a (type, GDK_TYPE_SURFACE)) { - instance = g_object_ref (gdk_surface_new_popup (gdk_display_get_default (), - 0, - &(GdkRectangle) { 0, 0, 100, 100 })); + instance = G_OBJECT (g_object_ref (gdk_surface_new_popup (display, + &(GdkRectangle) { 0, 0, 100, 100 }))); } - else if (g_str_equal (g_type_name (type), "GdkX11Cursor")) + else if (g_type_is_a (type, GDK_TYPE_CLIPBOARD) || + g_str_equal (g_type_name (type), "GdkX11Cursor")) instance = g_object_new (type, "display", display, NULL); else instance = g_object_new (type, NULL); @@ -129,6 +129,20 @@ test_type (gconstpointer data) if ((pspec->flags & G_PARAM_READABLE) == 0) continue; + if (g_type_is_a (type, GDK_TYPE_CLIPBOARD) && + strcmp (pspec->name, "display") == 0) + continue; + + /* These are set in init() */ + if ((g_type_is_a (type, GDK_TYPE_CLIPBOARD) || + g_type_is_a (type, GDK_TYPE_CONTENT_PROVIDER)) && + strcmp (pspec->name, "formats") == 0) + continue; + + if (g_type_is_a (type, GDK_TYPE_CONTENT_PROVIDER) && + strcmp (pspec->name, "storable-formats") == 0) + continue; + /* This one has a special-purpose default value */ if (g_type_is_a (type, GTK_TYPE_DIALOG) && (strcmp (pspec->name, "use-header-bar") == 0)) @@ -214,6 +228,15 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS strcmp (pspec->name, "cell-area-context") == 0)) continue; +G_GNUC_END_IGNORE_DEPRECATIONS + + /* This is set in init() */ + if (g_type_is_a (type, GTK_TYPE_FONT_CHOOSER_WIDGET) && + strcmp (pspec->name, "tweak-action") == 0) + continue; + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + if (g_type_is_a (type, GTK_TYPE_ICON_VIEW) && (strcmp (pspec->name, "cell-area") == 0 || strcmp (pspec->name, "cell-area-context") == 0)) @@ -295,10 +318,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS strcmp (pspec->name, "buffer") == 0) continue; - if (g_type_is_a (type, GTK_TYPE_TOOL_ITEM_GROUP) && - strcmp (pspec->name, "label-widget") == 0) - continue; - if (g_type_is_a (type, GTK_TYPE_TREE_VIEW) && (strcmp (pspec->name, "hadjustment") == 0 || strcmp (pspec->name, "vadjustment") == 0)) @@ -326,7 +345,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS continue; /* show-desktop depends on desktop environment */ - if (g_type_is_a (type, GTK_TYPE_PLACES_SIDEBAR) && + if (g_str_equal (g_type_name (type), "GtkPlacesSidebar") && strcmp (pspec->name, "show-desktop") == 0) continue; @@ -341,11 +360,13 @@ G_GNUC_END_IGNORE_DEPRECATIONS strcmp (pspec->name, "adjustment") == 0) continue; - if (g_test_verbose ()) - g_print ("Property %s.%s\n", - g_type_name (pspec->owner_type), - pspec->name); + { + g_print ("Property %s:%s\n", + g_type_name (pspec->owner_type), + pspec->name); + } + g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); g_object_get_property (instance, pspec->name, &value); check_property ("Property", pspec, &value); diff --git a/testsuite/gtk/meson.build b/testsuite/gtk/meson.build index d2febc485c..319eb14343 100644 --- a/testsuite/gtk/meson.build +++ b/testsuite/gtk/meson.build @@ -17,6 +17,7 @@ tests = [ ['cellarea'], ['check-icon-names'], ['cssprovider'], + ['defaultvalue'], ['entry'], ['firefox-stylecontext'], ['floating'],