summaryrefslogtreecommitdiff
path: root/tests/test_overrides_gtk.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_overrides_gtk.py')
-rw-r--r--tests/test_overrides_gtk.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_overrides_gtk.py b/tests/test_overrides_gtk.py
index 69f0d38..fdb3ccb 100644
--- a/tests/test_overrides_gtk.py
+++ b/tests/test_overrides_gtk.py
@@ -4,6 +4,8 @@
import contextlib
import unittest
+import time
+import sys
from compathelper import _unicode, _bytes
@@ -638,6 +640,21 @@ class TestGtk(unittest.TestCase):
self.assertEqual(viewport.props.vadjustment, vadjustment)
self.assertEqual(viewport.props.hadjustment, hadjustment)
+ def test_stock_lookup(self):
+ l = Gtk.stock_lookup('gtk-ok')
+ self.assertEqual(type(l), Gtk.StockItem)
+ self.assertEqual(l.stock_id, 'gtk-ok')
+ self.assertEqual(Gtk.stock_lookup('nosuchthing'), None)
+
+ def test_gtk_main(self):
+ # with no arguments
+ GLib.timeout_add(100, Gtk.main_quit)
+ Gtk.main()
+
+ # overridden function ignores its arguments
+ GLib.timeout_add(100, Gtk.main_quit, 'hello')
+ Gtk.main()
+
@unittest.skipUnless(Gtk, 'Gtk not available')
class TestTreeModel(unittest.TestCase):
@@ -1420,6 +1437,18 @@ class TestTreeModel(unittest.TestCase):
filtered[0][1] = 'ONE'
self.assertEqual(filtered[0][1], 'ONE')
+ def test_list_store_performance(self):
+ model = Gtk.ListStore(int, str)
+
+ iterations = 2000
+ start = time.clock()
+ i = iterations
+ while i > 0:
+ model.append([1, 'hello'])
+ i -= 1
+ end = time.clock()
+ sys.stderr.write('[%.0f µs/append] ' % ((end - start) * 1000000 / iterations))
+
@unittest.skipUnless(Gtk, 'Gtk not available')
class TestTreeView(unittest.TestCase):