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

Method test_grid_location

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

Source from the content-addressed store, hash-verified

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):
843 self.root.grid_location()
844 with self.assertRaises(TypeError):
845 self.root.grid_location(0)
846 with self.assertRaises(TypeError):
847 self.root.grid_location(0, 0, 0)
848 with self.assertRaisesRegex(TclError,
849 EXPECTED_SCREEN_DISTANCE_ERRMSG.format('x')):
850 self.root.grid_location('x', 'y')
851 with self.assertRaisesRegex(TclError,
852 EXPECTED_SCREEN_DISTANCE_ERRMSG.format('y')):
853 self.root.grid_location('1c', 'y')
854 t = self.root
855 # de-maximize
856 t.wm_geometry('1x1+0+0')
857 t.wm_geometry('')
858 f = tkinter.Frame(t, width=200, height=100,
859 highlightthickness=0, bg='red')
860 self.assertEqual(f.grid_location(10, 10), (-1, -1))
861 f.grid_configure()
862 self.root.update()
863 self.assertEqual(t.grid_location(-10, -10), (-1, -1))
864 self.assertEqual(t.grid_location(-10, 0), (-1, 0))
865 self.assertEqual(t.grid_location(-1, 0), (-1, 0))
866 self.assertEqual(t.grid_location(0, -10), (0, -1))
867 self.assertEqual(t.grid_location(0, -1), (0, -1))
868 self.assertEqual(t.grid_location(0, 0), (0, 0))
869 self.assertEqual(t.grid_location(200, 0), (0, 0))
870 self.assertEqual(t.grid_location(201, 0), (1, 0))
871 self.assertEqual(t.grid_location(0, 100), (0, 0))
872 self.assertEqual(t.grid_location(0, 101), (0, 1))
873 self.assertEqual(t.grid_location(201, 101), (1, 1))
874
875 def test_grid_propagate(self):
876 self.assertEqual(self.root.grid_propagate(), True)

Callers

nothing calls this directly

Calls 8

grid_locationMethod · 0.80
assertRaisesRegexMethod · 0.80
wm_geometryMethod · 0.80
grid_configureMethod · 0.80
assertRaisesMethod · 0.45
formatMethod · 0.45
assertEqualMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected