diff options
author | Juliette Monsel <j4321@users.noreply.github.com> | 2018-10-12 16:44:10 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-10-12 16:44:10 (GMT) |
commit | bf034715db9d6e1603ea432d40041e5577ed3332 (patch) | |
tree | 1a0760703b4a32e3bee5f1d726ab51f48d864f68 /Lib/tkinter/test/test_tkinter | |
parent | dc0d571b6401527f236b0513f29847e2b9b8a188 (diff) | |
download | cpython-bf034715db9d6e1603ea432d40041e5577ed3332.zip cpython-bf034715db9d6e1603ea432d40041e5577ed3332.tar.gz cpython-bf034715db9d6e1603ea432d40041e5577ed3332.tar.bz2 |
bpo-23831: Add moveto method to the tkinter.Canvas widget. (GH-9768)
Diffstat (limited to 'Lib/tkinter/test/test_tkinter')
-rw-r--r-- | Lib/tkinter/test/test_tkinter/test_widgets.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/tkinter/test/test_tkinter/test_widgets.py b/Lib/tkinter/test/test_tkinter/test_widgets.py index c068a9d..12a0fbe 100644 --- a/Lib/tkinter/test/test_tkinter/test_widgets.py +++ b/Lib/tkinter/test/test_tkinter/test_widgets.py @@ -745,6 +745,29 @@ class CanvasTest(AbstractWidgetTest, unittest.TestCase): self.checkPixelsParam(widget, 'yscrollincrement', 10, 0, 11.2, 13.6, -10, '0.1i') + @requires_tcl(8, 6) + def test_moveto(self): + widget = self.create() + i1 = widget.create_rectangle(1, 1, 20, 20, tags='group') + i2 = widget.create_rectangle(30, 30, 50, 70, tags='group') + x1, y1, _, _ = widget.bbox(i1) + x2, y2, _, _ = widget.bbox(i2) + widget.moveto('group', 200, 100) + x1_2, y1_2, _, _ = widget.bbox(i1) + x2_2, y2_2, _, _ = widget.bbox(i2) + self.assertEqual(x1_2, 200) + self.assertEqual(y1_2, 100) + self.assertEqual(x2 - x1, x2_2 - x1_2) + self.assertEqual(y2 - y1, y2_2 - y1_2) + widget.tag_lower(i2, i1) + widget.moveto('group', y=50) + x1_3, y1_3, _, _ = widget.bbox(i1) + x2_3, y2_3, _, _ = widget.bbox(i2) + self.assertEqual(y2_3, 50) + self.assertEqual(x2_3, x2_2) + self.assertEqual(x2_2 - x1_2, x2_3 - x1_3) + self.assertEqual(y2_2 - y1_2, y2_3 - y1_3) + @add_standard_options(IntegerSizeTests, StandardOptionsTests) class ListboxTest(AbstractWidgetTest, unittest.TestCase): |