MCPcopy Index your code
hub / github.com/python/cpython / test_grid_bbox

Method test_grid_bbox

Lib/test/test_tkinter/test_geometry_managers.py:810–839  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

808 self.assertEqual(self.root.tk.call('grid', 'anchor', self.root), 'se')
809
810 def test_grid_bbox(self):
811 self.assertEqual(self.root.grid_bbox(), (0, 0, 0, 0))
812 self.assertEqual(self.root.grid_bbox(0, 0), (0, 0, 0, 0))
813 self.assertEqual(self.root.grid_bbox(0, 0, 1, 1), (0, 0, 0, 0))
814 with self.assertRaisesRegex(TclError, 'expected integer but got "x"'):
815 self.root.grid_bbox('x', 0)
816 with self.assertRaisesRegex(TclError, 'expected integer but got "x"'):
817 self.root.grid_bbox(0, 'x')
818 with self.assertRaisesRegex(TclError, 'expected integer but got "x"'):
819 self.root.grid_bbox(0, 0, 'x', 0)
820 with self.assertRaisesRegex(TclError, 'expected integer but got "x"'):
821 self.root.grid_bbox(0, 0, 0, 'x')
822 with self.assertRaises(TypeError):
823 self.root.grid_bbox(0, 0, 0, 0, 0)
824 t = self.root
825 # de-maximize
826 t.wm_geometry('1x1+0+0')
827 t.wm_geometry('')
828 f1 = tkinter.Frame(t, width=75, height=75, bg='red')
829 f2 = tkinter.Frame(t, width=90, height=90, bg='blue')
830 f1.grid_configure(row=0, column=0)
831 f2.grid_configure(row=1, column=1)
832 self.root.update()
833 self.assertEqual(t.grid_bbox(), (0, 0, 165, 165))
834 self.assertEqual(t.grid_bbox(0, 0), (0, 0, 75, 75))
835 self.assertEqual(t.grid_bbox(0, 0, 1, 1), (0, 0, 165, 165))
836 self.assertEqual(t.grid_bbox(1, 1), (75, 75, 90, 90))
837 self.assertEqual(t.grid_bbox(10, 10, 0, 0), (0, 0, 165, 165))
838 self.assertEqual(t.grid_bbox(-2, -2, -1, -1), (0, 0, 0, 0))
839 self.assertEqual(t.grid_bbox(10, 10, 12, 12), (165, 165, 0, 0))
840
841 def test_grid_location(self):
842 with self.assertRaises(TypeError):

Callers

nothing calls this directly

Calls 7

grid_bboxMethod · 0.80
assertRaisesRegexMethod · 0.80
wm_geometryMethod · 0.80
grid_configureMethod · 0.80
assertEqualMethod · 0.45
assertRaisesMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected