mirror of https://github.com/python/cpython
Issue #6157: Fixed tkinter.Text.debug(). Original patch by Guilherme Polo.
This commit is contained in:
parent
2849e0dfb7
commit
0b9e815d8d
|
@ -2990,8 +2990,9 @@ class Text(Widget, XView, YView):
|
|||
def debug(self, boolean=None):
|
||||
"""Turn on the internal consistency checks of the B-Tree inside the text
|
||||
widget according to BOOLEAN."""
|
||||
return self.tk.getboolean(self.tk.call(
|
||||
self._w, 'debug', boolean))
|
||||
if boolean is None:
|
||||
return self.tk.call(self._w, 'debug')
|
||||
self.tk.call(self._w, 'debug', boolean)
|
||||
def delete(self, index1, index2=None):
|
||||
"""Delete the characters between INDEX1 and INDEX2 (not included)."""
|
||||
self.tk.call(self._w, 'delete', index1, index2)
|
||||
|
|
|
@ -14,6 +14,17 @@ class TextTest(unittest.TestCase):
|
|||
def tearDown(self):
|
||||
self.text.destroy()
|
||||
|
||||
def test_debug(self):
|
||||
text = self.text
|
||||
olddebug = text.debug()
|
||||
try:
|
||||
text.debug(0)
|
||||
self.assertEqual(text.debug(), 0)
|
||||
text.debug(1)
|
||||
self.assertEqual(text.debug(), 1)
|
||||
finally:
|
||||
text.debug(olddebug)
|
||||
self.assertEqual(text.debug(), olddebug)
|
||||
|
||||
def test_search(self):
|
||||
text = self.text
|
||||
|
|
|
@ -610,6 +610,19 @@ class TextTest(AbstractWidgetTest, unittest.TestCase):
|
|||
else:
|
||||
self.checkEnumParam(widget, 'wrap', 'char', 'none', 'word')
|
||||
|
||||
def test_bbox(self):
|
||||
widget = self.create()
|
||||
bbox = widget.bbox('1.1')
|
||||
self.assertEqual(len(bbox), 4)
|
||||
for item in bbox:
|
||||
self.assertIsInstance(item, int)
|
||||
|
||||
self.assertIsNone(widget.bbox('end'))
|
||||
self.assertRaises(tkinter.TclError, widget.bbox, 'noindex')
|
||||
self.assertRaises(tkinter.TclError, widget.bbox, None)
|
||||
self.assertRaises(tkinter.TclError, widget.bbox)
|
||||
self.assertRaises(tkinter.TclError, widget.bbox, '1.1', 'end')
|
||||
|
||||
|
||||
@add_standard_options(PixelSizeTests, StandardOptionsTests)
|
||||
class CanvasTest(AbstractWidgetTest, unittest.TestCase):
|
||||
|
|
Loading…
Reference in New Issue