[pygobject] Gtk[HV]Scrollbar: Add a default value for the adjustment constructor parameter



commit a3ca47b086b7fcf084282be788c5d737dde847ac
Author: Johan Dahlin <johan gnome org>
Date:   Fri Mar 16 16:06:37 2012 -0300

    Gtk[HV]Scrollbar: Add a default value for the adjustment constructor parameter
    
    https://bugzilla.gnome.org/show_bug.cgi?id=672260

 gi/overrides/Gtk.py     |   15 +++++++++++++++
 tests/test_overrides.py |   14 ++++++++++++++
 2 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index 609e8cd..677bd4a 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -1425,6 +1425,21 @@ class ScrolledWindow(Gtk.ScrolledWindow):
 ScrolledWindow = override(ScrolledWindow)
 __all__.append('ScrolledWindow')
 
+
+class HScrollbar(Gtk.HScrollbar):
+    def __init__(self, adjustment=None):
+        Gtk.HScrollbar.__init__(self, adjustment=adjustment)
+
+HScrollbar = override(HScrollbar)
+__all__.append('HScrollbar')
+
+class VScrollbar(Gtk.VScrollbar):
+    def __init__(self, adjustment=None):
+        Gtk.VScrollbar.__init__(self, adjustment=adjustment)
+
+VScrollbar = override(VScrollbar)
+__all__.append('VScrollbar')
+
 class Paned(Gtk.Paned):
     def pack1(self, child, resize=False, shrink=True):
         super(Paned, self).pack1(child, resize, shrink)
diff --git a/tests/test_overrides.py b/tests/test_overrides.py
index e7ff5e0..81d2fb2 100644
--- a/tests/test_overrides.py
+++ b/tests/test_overrides.py
@@ -1804,6 +1804,20 @@ class TestGtk(unittest.TestCase):
         self.assertTrue(hasattr(widget.drag_dest_set_proxy, '__call__'))
         self.assertTrue(hasattr(widget.drag_get_data, '__call__'))
 
+    def test_scrollbar(self):
+        # PyGTK compat
+        adjustment = Gtk.Adjustment()
+
+        hscrollbar = Gtk.HScrollbar()
+        vscrollbar = Gtk.VScrollbar()
+        self.assertNotEquals(hscrollbar.props.adjustment, adjustment)
+        self.assertNotEquals(vscrollbar.props.adjustment, adjustment)
+
+        hscrollbar = Gtk.HScrollbar(adjustment)
+        vscrollbar = Gtk.VScrollbar(adjustment)
+        self.assertEquals(hscrollbar.props.adjustment, adjustment)
+        self.assertEquals(vscrollbar.props.adjustment, adjustment)
+
     def test_iconview(self):
         # PyGTK compat
         iconview = Gtk.IconView()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]