Skip to content

Commit

Permalink
Flash PR - Spectrum Viewer: ToF Range changed to Range (#2241)
Browse files Browse the repository at this point in the history
  • Loading branch information
samtygier-stfc authored Jun 27, 2024
2 parents 26f996b + 235dd88 commit 29c00de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def add_range(self, range_min: int | float, range_max: int | float) -> None:
self.set_tof_range_label(range_min, range_max)

def set_tof_range_label(self, range_min: float, range_max: float) -> None:
self._tof_range_label.setText(f'ToF range: {range_min:.3f} - {range_max:.3f}')
self._tof_range_label.setText(f'Range: {range_min:.3f} - {range_max:.3f}')

def set_image_index_range_label(self, range_min: int, range_max: int) -> None:
self._image_index_range_label.setText(f'Image index range: {range_min} - {range_max}')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ def test_WHEN_set_roi_alpha_called_THEN_set_roi_visibility_flags_called(self, _,
def test_WHEN_add_range_called_THEN_region_and_label_set_correctly(self, _, range_min, range_max):
self.spectrum_plot_widget.add_range(range_min, range_max)
self.assertEqual(self.spectrum_plot_widget.range_control.getRegion(), (range_min, range_max))
self.assertEqual(self.spectrum_plot_widget._tof_range_label.text,
f"ToF range: {range_min:.3f} - {range_max:.3f}")
self.assertEqual(self.spectrum_plot_widget._tof_range_label.text, f"Range: {range_min:.3f} - {range_max:.3f}")

def test_WHEN_get_roi_called_THEN_SensibleROI_returned(self):
spectrum_roi = SpectrumROI("roi", self.sensible_roi, rotatable=False, scaleSnap=True, translateSnap=True)
Expand All @@ -136,7 +135,7 @@ def test_WHEN_remove_roi_called_THEN_roi_removed_from_roi_dict(self):

def test_WHEN_set_tof_range_called_THEN_range_control_set_correctly(self):
self.spectrum_plot_widget.set_tof_range_label(0, 100)
self.assertEqual(self.spectrum_plot_widget._tof_range_label.text, "ToF range: 0.000 - 100.000")
self.assertEqual(self.spectrum_plot_widget._tof_range_label.text, "Range: 0.000 - 100.000")

def test_WHEN_rename_roi_called_THEN_roi_renamed(self):
spectrum_roi = SpectrumROI("roi_1", self.sensible_roi, rotatable=False, scaleSnap=True, translateSnap=True)
Expand Down

0 comments on commit 29c00de

Please sign in to comment.