Skip to content

Commit 32b578a

Browse files
committed
Test enabling autoscaling
1 parent 16237f2 commit 32b578a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/test_controller.py

+20
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,23 @@ def test_array_viewer_with_app() -> None:
179179
index_mock.reset_mock()
180180
viewer._view.set_current_index(index)
181181
index_mock.assert_not_called()
182+
183+
184+
@pytest.mark.usefixtures("any_app")
185+
def test_channel_autoscale() -> None:
186+
data = np.random.randint(0, 255, size=(10, 10, 10, 10, 10), dtype="uint8")
187+
viewer = ArrayViewer(data)
188+
189+
lut_model = viewer._lut_controllers[None].lut_model
190+
old_clims = lut_model.clims
191+
192+
# Adjust the clims with autoscale off
193+
lut_model.autoscale = False
194+
lut_model.clims = (old_clims[0] + 1, old_clims[1] + 1)
195+
196+
# Assert turning autoscale back on reverts the clims
197+
lut_model.autoscale = True
198+
assert lut_model.clims == old_clims
199+
200+
# NB: The view is (currently) responsible for disabling autoscale when
201+
# it moves a clim. Thus that behavior is tested for each backend.

0 commit comments

Comments
 (0)