(self)
| 103 | |
| 104 | |
| 105 | def test_horizontal_range(self): |
| 106 | lscale = ttk.LabeledScale(self.root, from_=0, to=10) |
| 107 | lscale.pack() |
| 108 | lscale.update() |
| 109 | |
| 110 | linfo_1 = lscale.label.place_info() |
| 111 | prev_xcoord = lscale.scale.coords()[0] |
| 112 | self.assertEqual(prev_xcoord, int(linfo_1['x'])) |
| 113 | # change range to: from -5 to 5. This should change the x coord of |
| 114 | # the scale widget, since 0 is at the middle of the new |
| 115 | # range. |
| 116 | lscale.scale.configure(from_=-5, to=5) |
| 117 | # The following update is needed since the test doesn't use mainloop, |
| 118 | # at the same time this shouldn't affect test outcome |
| 119 | lscale.update() |
| 120 | curr_xcoord = lscale.scale.coords()[0] |
| 121 | self.assertNotEqual(prev_xcoord, curr_xcoord) |
| 122 | # the label widget should have been repositioned too |
| 123 | linfo_2 = lscale.label.place_info() |
| 124 | self.assertEqual(lscale.label['text'], 0 if self.wantobjects else '0') |
| 125 | self.assertEqual(curr_xcoord, int(linfo_2['x'])) |
| 126 | # change the range back |
| 127 | lscale.scale.configure(from_=0, to=10) |
| 128 | self.assertNotEqual(prev_xcoord, curr_xcoord) |
| 129 | self.assertEqual(prev_xcoord, int(linfo_1['x'])) |
| 130 | |
| 131 | lscale.destroy() |
| 132 | |
| 133 | |
| 134 | def test_variable_change(self): |
nothing calls this directly
no test coverage detected