From: Christian Dywan Date: Tue, 18 Sep 2012 19:00:56 +0000 (+0200) Subject: Remove generic browser creation and property set tests X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4b795e1567d39317b1598e479a30f68348a3fd2;p=midori Remove generic browser creation and property set tests --- diff --git a/tests/browser.c b/tests/browser.c index f05e1be4..fa949124 100644 --- a/tests/browser.c +++ b/tests/browser.c @@ -15,32 +15,16 @@ static void browser_create (void) { MidoriApp* app; + MidoriSpeedDial* dial; MidoriBrowser* browser; - GtkActionGroup* action_group; - GList* actions; app = midori_app_new (); + dial = midori_speed_dial_new ("/", NULL); + g_object_set (app, "speed-dial", dial, NULL); browser = midori_app_create_browser (app); gtk_widget_destroy (GTK_WIDGET (browser)); - - app = midori_app_new (); - browser = midori_app_create_browser (app); - action_group = midori_browser_get_action_group (browser); - actions = gtk_action_group_list_actions (action_group); - while (actions) - { - GtkAction* action = actions->data; - if (g_strcmp0 (gtk_action_get_name (action), "WindowClose")) - if (g_strcmp0 (gtk_action_get_name (action), "EncodingCustom")) - if (g_strcmp0 (gtk_action_get_name (action), "AddSpeedDial")) - if (g_strcmp0 (gtk_action_get_name (action), "PrivateBrowsing")) - if (g_strcmp0 (gtk_action_get_name (action), "AddDesktopShortcut")) - gtk_action_activate (action); - actions = g_list_next (actions); - } - g_list_free (actions); - gtk_widget_destroy (GTK_WIDGET (browser)); g_object_unref (app); + g_object_unref (dial); } static void diff --git a/tests/properties.c b/tests/properties.c index 99bd847f..2613fdb7 100644 --- a/tests/properties.c +++ b/tests/properties.c @@ -11,29 +11,6 @@ #include "midori.h" -typedef struct -{ - const gchar* type; - const gchar* property; -} ObjectProperty; - -static ObjectProperty properties_object_skip[] = -{ - { "MidoriWebSettings", "user-agent" }, -}; - -static gboolean -properties_should_skip (const gchar* type, - const gchar* property) -{ - guint i; - for (i = 0; i < G_N_ELEMENTS (properties_object_skip); i++) - if (g_str_equal (properties_object_skip[i].type, type)) - if (g_str_equal (properties_object_skip[i].property, property)) - return TRUE; - return FALSE; -} - #define pspec_is_writable(pspec) (pspec->flags & G_PARAM_WRITABLE \ && !(pspec->flags & (G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY))) @@ -49,19 +26,12 @@ properties_object_get_set (GObject* object) for (i = 0; i < n_properties; i++) { GParamSpec *pspec = pspecs[i]; - GType type = G_PARAM_SPEC_TYPE (pspec); - const gchar* property = g_param_spec_get_name (pspec); - void* value = NULL; guint j; /* Skip properties of parent classes */ if (pspec->owner_type != G_OBJECT_TYPE (object)) continue; - /* Skip properties that cannot be tested generically */ - if (properties_should_skip (G_OBJECT_TYPE_NAME (object), property)) - continue; - /* Verify that the ID is unique */ if (pspecs[i]->owner_type == G_OBJECT_TYPE (object)) for (j = 0; j < n_properties; j++) @@ -71,81 +41,6 @@ properties_object_get_set (GObject* object) pspec->param_id, g_param_spec_get_name (pspec), g_param_spec_get_name (pspecs[j])); - - if (!(pspec->flags & G_PARAM_READABLE)) - continue; - - g_object_get (object, property, &value, NULL); - if (type == G_TYPE_PARAM_BOOLEAN) - { - gboolean current_value = value ? TRUE : FALSE; - gboolean default_value = G_PARAM_SPEC_BOOLEAN (pspec)->default_value; - if (current_value != default_value) - g_error ("Set %s.%s to default (%d), but returned '%d'", - G_OBJECT_TYPE_NAME (object), property, - G_PARAM_SPEC_BOOLEAN (pspec)->default_value, current_value); - if (pspec_is_writable (pspec)) - { - g_object_set (object, property, !default_value, NULL); - g_object_get (object, property, ¤t_value, NULL); - if (current_value == default_value) - g_error ("Set %s.%s to non-default (%d), but returned '%d'", - G_OBJECT_TYPE_NAME (object), property, - !G_PARAM_SPEC_BOOLEAN (pspec)->default_value, current_value); - g_object_set (object, property, default_value, NULL); - g_object_get (object, property, ¤t_value, NULL); - if (current_value != default_value) - g_error ("Set %s.%s to default again (%d), but returned '%d'", - G_OBJECT_TYPE_NAME (object), property, - G_PARAM_SPEC_BOOLEAN (pspec)->default_value, current_value); - } - } - else if (type == G_TYPE_PARAM_STRING) - { - g_free (value); - if (pspec_is_writable (pspec)) - { - g_object_set (object, property, - G_PARAM_SPEC_STRING (pspec)->default_value, NULL); - g_object_get (object, property, &value, NULL); - if (g_strcmp0 (value, G_PARAM_SPEC_STRING (pspec)->default_value)) - g_error ("Set %s.%s to %s, but returned '%s'", - G_OBJECT_TYPE_NAME (object), property, - G_PARAM_SPEC_STRING (pspec)->default_value, (gchar*)value); - g_free (value); - } - } - else if (type == G_TYPE_PARAM_ENUM) - { - GEnumClass* enum_class = G_ENUM_CLASS ( - g_type_class_ref (pspec->value_type)); - - if (pspec_is_writable (pspec)) - { - gint k; - g_object_set (object, property, - G_PARAM_SPEC_ENUM (pspec)->default_value, NULL); - for (k = enum_class->minimum; k < enum_class->maximum; k++) - { - GEnumValue* enum_value; - GEnumValue* enum_value_; - - enum_value = g_enum_get_value (enum_class, k); - if (!enum_value) - g_error ("%s.%s has no value %d", - G_OBJECT_TYPE_NAME (object), property, k); - enum_value_ = g_enum_get_value_by_name (enum_class, - enum_value->value_name); - if (!enum_value) - g_error ("%s.%s has no value '%s'", - G_OBJECT_TYPE_NAME (object), property, enum_value->value_name); - g_assert_cmpint (enum_value->value, ==, enum_value_->value); - g_object_set (object, property, k, NULL); - } - } - - g_type_class_unref (enum_class); - } } g_free (pspecs); }