Commit ad680ae9 authored by Simon Feltman's avatar Simon Feltman

tests: Move class definition depending on GTK+ within function evaluation

Move the definition of WindowWithSizeAllocOverride inside of the test
function call to so it is lazily defined. This avoids problems running tests
on systems without GTK+ installed.
parent 45d45e7c
......@@ -633,26 +633,26 @@ class TestGtk(unittest.TestCase):
@unittest.skipUnless(Gtk, 'Gtk not available')
class TestSignals(unittest.TestCase):
class WindowWithSizeAllocOverride(Gtk.ScrolledWindow):
__gsignals__ = {'size-allocate': 'override'}
def test_class_closure_override_with_aliased_type(self):
class WindowWithSizeAllocOverride(Gtk.ScrolledWindow):
__gsignals__ = {'size-allocate': 'override'}
def __init__(self):
Gtk.ScrolledWindow.__init__(self)
self._alloc_called = False
self._alloc_value = None
self._alloc_error = None
def __init__(self):
Gtk.ScrolledWindow.__init__(self)
self._alloc_called = False
self._alloc_value = None
self._alloc_error = None
def do_size_allocate(self, alloc):
self._alloc_called = True
self._alloc_value = alloc
def do_size_allocate(self, alloc):
self._alloc_called = True
self._alloc_value = alloc
try:
Gtk.ScrolledWindow.do_size_allocate(self, alloc)
except Exception as e:
self._alloc_error = e
try:
Gtk.ScrolledWindow.do_size_allocate(self, alloc)
except Exception as e:
self._alloc_error = e
def test_class_closure_override_with_aliased_type(self):
win = self.WindowWithSizeAllocOverride()
win = WindowWithSizeAllocOverride()
rect = Gdk.Rectangle()
rect.width = 100
rect.height = 100
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment