Test the `reset()` method: resetting the selection
(qtbot, full_range, selection, value_type)
| 266 | ]) |
| 267 | # fmt: on |
| 268 | def test_RangeManager_2(qtbot, full_range, selection, value_type): |
| 269 | """Test the `reset()` method: resetting the selection""" |
| 270 | rman = RangeManager() |
| 271 | qtbot.addWidget(rman) |
| 272 | rman.show() |
| 273 | |
| 274 | rman.set_value_type(value_type) |
| 275 | rman.set_range(full_range[0], full_range[1]) |
| 276 | rman.set_selection(value_low=selection[0], value_high=selection[1]) |
| 277 | |
| 278 | npt.assert_array_almost_equal(rman.get_range(), full_range, err_msg="Range is set incorrectly") |
| 279 | |
| 280 | # Verify that selection is displayed correctly |
| 281 | assert rman.le_min_value.text() == f"{selection[0]:.10g}", "Lower boundary is displayed incorrectly" |
| 282 | assert rman.le_max_value.text() == f"{selection[1]:.10g}", "Upper boundary is displayed incorrectly" |
| 283 | npt.assert_array_almost_equal(rman.get_selection(), selection, err_msg="Selection is set incorreclty") |
| 284 | |
| 285 | selection_changed = rman.reset() |
| 286 | assert selection_changed is True, "Change of selection is incorrectly reported" |
| 287 | |
| 288 | # Verify that selection is displayed correctly |
| 289 | assert rman.le_min_value.text() == f"{full_range[0]:.10g}", "Lower boundary is displayed incorrectly" |
| 290 | assert rman.le_max_value.text() == f"{full_range[1]:.10g}", "Upper boundary is displayed incorrectly" |
| 291 | npt.assert_array_almost_equal(rman.get_selection(), full_range, err_msg="Selection is set incorreclty") |
| 292 | |
| 293 | # Attemtp to reset again (selection shouldn't change) |
| 294 | selection_changed = rman.reset() |
| 295 | assert selection_changed is False, "Change of selection is incorrectly reported" |
| 296 | |
| 297 | |
| 298 | # fmt: off |
nothing calls this directly
no test coverage detected