[pygobject] overrides: Fix Gtk.TextBuffer.insert_with_tags_by_name() with no tags



commit e8c071f518a0e1c3e1877705291d24f056bed77e
Author: Garrett Regier <garrettregier gmail com>
Date:   Thu Oct 13 15:00:52 2016 -0700

    overrides: Fix Gtk.TextBuffer.insert_with_tags_by_name() with no tags
    
    The text was not inserted when no tags were provided.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=772896

 gi/overrides/Gtk.py         |    3 ---
 tests/test_overrides_gtk.py |   12 ++++++++++++
 2 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index 2c0e870..63990ed 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -745,9 +745,6 @@ class TextBuffer(Gtk.TextBuffer):
             self.apply_tag(tag, start, iter)
 
     def insert_with_tags_by_name(self, iter, text, *tags):
-        if not tags:
-            return
-
         tag_objs = []
 
         for tag in tags:
diff --git a/tests/test_overrides_gtk.py b/tests/test_overrides_gtk.py
index 6562413..8e8a66d 100644
--- a/tests/test_overrides_gtk.py
+++ b/tests/test_overrides_gtk.py
@@ -1852,6 +1852,18 @@ class TestTextBuffer(unittest.TestCase):
         self.assertTrue(sel[1].equal(end))
 
         buffer.set_text('')
+        buffer.insert_with_tags(buffer.get_start_iter(), 'HelloHello')
+        start, end = buffer.get_bounds()
+        text = buffer.get_text(start, end, False)
+        self.assertEqual(text, 'HelloHello')
+
+        buffer.set_text('')
+        buffer.insert_with_tags_by_name(buffer.get_start_iter(), 'HelloHello')
+        start, end = buffer.get_bounds()
+        text = buffer.get_text(start, end, False)
+        self.assertEqual(text, 'HelloHello')
+
+        buffer.set_text('')
         buffer.insert_with_tags(buffer.get_start_iter(), 'HelloHello', tag)
         (start, end) = buffer.get_bounds()
         self.assertTrue(start.begins_tag(tag))


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