mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 21:21:21 +00:00
Merge branch 'wip/otte/for-main' into 'main'
testsuite: Be less verbose in accessor-apis test Closes #5763 See merge request GNOME/gtk!5851
This commit is contained in:
commit
03b71a9759
@ -352,6 +352,21 @@ gtk_adjustment_dispatch_properties_changed (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static double
|
||||
gtk_adjustment_sanitize_value (GtkAdjustment *self,
|
||||
double value)
|
||||
{
|
||||
GtkAdjustmentPrivate *priv = gtk_adjustment_get_instance_private (self);
|
||||
|
||||
/* don't use CLAMP() so we don't end up below lower if upper - page_size
|
||||
* is smaller than lower
|
||||
*/
|
||||
value = MIN (value, priv->upper - priv->page_size);
|
||||
value = MAX (value, priv->lower);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_adjustment_new:
|
||||
* @value: the initial value
|
||||
@ -419,6 +434,8 @@ adjustment_set_value (GtkAdjustment *adjustment,
|
||||
{
|
||||
GtkAdjustmentPrivate *priv = gtk_adjustment_get_instance_private (adjustment);
|
||||
|
||||
value = gtk_adjustment_sanitize_value (adjustment, value);
|
||||
|
||||
if (priv->value != value)
|
||||
{
|
||||
priv->value = value;
|
||||
@ -497,11 +514,7 @@ gtk_adjustment_set_value_internal (GtkAdjustment *adjustment,
|
||||
{
|
||||
GtkAdjustmentPrivate *priv = gtk_adjustment_get_instance_private (adjustment);
|
||||
|
||||
/* don't use CLAMP() so we don't end up below lower if upper - page_size
|
||||
* is smaller than lower
|
||||
*/
|
||||
value = MIN (value, priv->upper - priv->page_size);
|
||||
value = MAX (value, priv->lower);
|
||||
value = gtk_adjustment_sanitize_value (adjustment, value);
|
||||
|
||||
if (animate && priv->duration != 0 && priv->clock != NULL)
|
||||
{
|
||||
@ -825,11 +838,7 @@ gtk_adjustment_configure (GtkAdjustment *adjustment,
|
||||
gtk_adjustment_set_page_increment (adjustment, page_increment);
|
||||
gtk_adjustment_set_page_size (adjustment, page_size);
|
||||
|
||||
/* don't use CLAMP() so we don't end up below lower if upper - page_size
|
||||
* is smaller than lower
|
||||
*/
|
||||
value = MIN (value, upper - page_size);
|
||||
value = MAX (value, lower);
|
||||
value = gtk_adjustment_sanitize_value (adjustment, value);
|
||||
|
||||
if (value != priv->value)
|
||||
{
|
||||
|
@ -214,6 +214,11 @@ gtk_list_base_adjustment_value_changed_cb (GtkAdjustment *adjustment,
|
||||
&pos,
|
||||
&cell_area))
|
||||
{
|
||||
/* If we get here with n-items == 0, then somebody cleared the list but
|
||||
* GC hasn't run. So no item to be found. */
|
||||
if (gtk_list_base_get_n_items (self) == 0)
|
||||
return;
|
||||
|
||||
g_warning ("%s failed to scroll to given position. Ignoring...", G_OBJECT_TYPE_NAME (self));
|
||||
return;
|
||||
}
|
||||
|
@ -126,6 +126,22 @@ property_name_mangle (GString *symbol_name,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
add_type_name (GPtrArray *type_names,
|
||||
GType type)
|
||||
{
|
||||
char *options[2];
|
||||
|
||||
options[0] = type_name_mangle (g_type_name (type), FALSE);
|
||||
g_ptr_array_add (type_names, options[0]);
|
||||
|
||||
options[1] = type_name_mangle (g_type_name (type), TRUE);
|
||||
if (g_str_equal (options[0], options[1]))
|
||||
g_free (options[1]);
|
||||
else
|
||||
g_ptr_array_add (type_names, options[1]);
|
||||
}
|
||||
|
||||
const char *getters[] = { "get", "is", "ref" };
|
||||
const char *setters[] = { "set" };
|
||||
|
||||
@ -135,8 +151,9 @@ get_potential_names (GType type,
|
||||
const char *property_name)
|
||||
{
|
||||
GPtrArray *options;
|
||||
char *type_name_options[2];
|
||||
guint n_type_name_options, n_verbs;
|
||||
GPtrArray *type_names;
|
||||
GType *interfaces;
|
||||
guint n_verbs, n_interfaces;
|
||||
const char **verbs;
|
||||
guint i, j;
|
||||
|
||||
@ -151,22 +168,22 @@ get_potential_names (GType type,
|
||||
n_verbs = G_N_ELEMENTS (setters);
|
||||
}
|
||||
|
||||
type_name_options[0] = type_name_mangle (g_type_name (type), FALSE);
|
||||
type_name_options[1] = type_name_mangle (g_type_name (type), TRUE);
|
||||
if (g_str_equal (type_name_options[0], type_name_options[1]))
|
||||
n_type_name_options = 1;
|
||||
else
|
||||
n_type_name_options = 2;
|
||||
type_names = g_ptr_array_new_with_free_func (g_free);
|
||||
add_type_name (type_names, type);
|
||||
interfaces = g_type_interfaces (type, &n_interfaces);
|
||||
for (i = 0; i < n_interfaces; i++)
|
||||
add_type_name (type_names, interfaces[i]);
|
||||
g_free (interfaces);
|
||||
|
||||
options = g_ptr_array_new ();
|
||||
|
||||
for (i = 0; i < n_type_name_options; i++)
|
||||
for (i = 0; i < type_names->len; i++)
|
||||
{
|
||||
for (j = 0; j < n_verbs; j++)
|
||||
{
|
||||
GString *str;
|
||||
|
||||
str = g_string_new (type_name_options[i]);
|
||||
str = g_string_new (g_ptr_array_index (type_names, i));
|
||||
g_string_append_c (str, '_');
|
||||
g_string_append (str, verbs[j]);
|
||||
g_string_append_c (str, '_');
|
||||
@ -182,7 +199,7 @@ get_potential_names (GType type,
|
||||
GString *str;
|
||||
|
||||
/* try without a verb */
|
||||
str = g_string_new (type_name_options[i]);
|
||||
str = g_string_new (g_ptr_array_index (type_names, i));
|
||||
g_string_append_c (str, '_');
|
||||
property_name_mangle (str, property_name);
|
||||
|
||||
@ -190,8 +207,7 @@ get_potential_names (GType type,
|
||||
}
|
||||
}
|
||||
|
||||
g_free (type_name_options[0]);
|
||||
g_free (type_name_options[1]);
|
||||
g_ptr_array_free (type_names, TRUE);
|
||||
|
||||
g_ptr_array_add (options, NULL);
|
||||
|
||||
@ -218,9 +234,12 @@ check_function_name (GType type,
|
||||
}
|
||||
|
||||
g_test_message ("No %s for property %s::%s", get ? "getter" : "setter", g_type_name (type), property_name);
|
||||
for (i = 0; names[i] != NULL; i++)
|
||||
if (g_test_verbose ())
|
||||
{
|
||||
g_test_message (" %s", names[i]);
|
||||
for (i = 0; names[i] != NULL; i++)
|
||||
{
|
||||
g_test_message (" %s", names[i]);
|
||||
}
|
||||
}
|
||||
|
||||
g_test_fail ();
|
||||
|
Loading…
Reference in New Issue
Block a user