[pygobject] Add test case for Gtk.TextIter.forward_search()
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Add test case for Gtk.TextIter.forward_search()
- Date: Mon, 30 Jul 2012 09:59:27 +0000 (UTC)
commit 94e5d58e7794de91d3291e0e51c42070da4fc92b
Author: Martin Pitt <martinpitt gnome org>
Date: Mon Jul 30 11:58:24 2012 +0200
Add test case for Gtk.TextIter.forward_search()
https://bugzilla.gnome.org/show_bug.cgi?id=679415
tests/test_overrides.py | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/tests/test_overrides.py b/tests/test_overrides.py
index c1f6968..3d25d52 100644
--- a/tests/test_overrides.py
+++ b/tests/test_overrides.py
@@ -1761,6 +1761,25 @@ class TestGtk(unittest.TestCase):
self.assertFalse(start.ends_tag())
self.assertFalse(start.toggles_tag())
+ def test_text_buffer_search(self):
+ buffer = Gtk.TextBuffer()
+ buffer.set_text('Hello World Hello GNOME')
+
+ i = buffer.get_iter_at_offset(0)
+ self.assertTrue(isinstance(i, Gtk.TextIter))
+
+ self.assertEqual(i.forward_search('world', 0, None), None)
+
+ (start, end) = i.forward_search('World', 0, None)
+ self.assertEqual(start.get_offset(), 6)
+ self.assertEqual(end.get_offset(), 11)
+
+ (start, end) = i.forward_search('world',
+ Gtk.TextSearchFlags.CASE_INSENSITIVE,
+ None)
+ self.assertEqual(start.get_offset(), 6)
+ self.assertEqual(end.get_offset(), 11)
+
def test_buttons(self):
self.assertEqual(Gtk.Button, overrides.Gtk.Button)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]