[StScrollView] Fix incorrect assertion, defaults, and test case

The type we don't currently handle is _ALWAYS, my original use
of g_return_if_fail was wrong.

Also the default should be AUTOMATIC in the properties, not ALWAYS.

Finally the test case was still using the incorrect St.ScrollPolicy.

https://bugzilla.gnome.org/show_bug.cgi?id=609015
This commit is contained in:
Colin Walters 2010-02-22 11:51:54 -05:00
parent ec725cc6d4
commit fb9fd6925a
2 changed files with 7 additions and 6 deletions

View File

@ -504,7 +504,7 @@ st_scroll_view_class_init (StScrollViewClass *klass)
"Vertical Scrollbar Policy",
"When the vertical scrollbar is displayed",
GTK_TYPE_POLICY_TYPE,
GTK_POLICY_ALWAYS,
GTK_POLICY_AUTOMATIC,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_VSCROLLBAR_POLICY, pspec);
@ -512,7 +512,7 @@ st_scroll_view_class_init (StScrollViewClass *klass)
"Horizontal Scrollbar Policy",
"When the horizontal scrollbar is displayed",
GTK_TYPE_POLICY_TYPE,
GTK_POLICY_ALWAYS,
GTK_POLICY_AUTOMATIC,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_HSCROLLBAR_POLICY, pspec);
@ -918,7 +918,7 @@ st_scroll_view_set_policy (StScrollView *scroll,
StAdjustment *hadjust, *vadjust;
g_return_if_fail (ST_IS_SCROLL_VIEW (scroll));
g_return_if_fail (hscroll == GTK_POLICY_ALWAYS || vscroll == GTK_POLICY_ALWAYS);
g_return_if_fail (hscroll != GTK_POLICY_ALWAYS && vscroll != GTK_POLICY_ALWAYS);
priv = ST_SCROLL_VIEW (scroll)->priv;

View File

@ -1,6 +1,7 @@
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
const Clutter = imports.gi.Clutter;
const Gtk = imports.gi.Gtk;
const St = imports.gi.St;
const UI = imports.testcommon.ui;
@ -22,9 +23,9 @@ let v = new St.ScrollView();
vbox.add(v, { expand: true });
toggle.connect('notify::checked', function () {
v.set_policy(toggle.checked ? St.ScrollPolicy.AUTOMATIC
: St.ScrollPolicy.NEVER,
St.ScrollPolicy.AUTOMATIC);
v.set_policy(toggle.checked ? Gtk.PolicyType.AUTOMATIC
: Gtk.PolicyType.NEVER,
Gtk.PolicyType.AUTOMATIC);
});
let b = new St.BoxLayout({ vertical: true,