SlicerDMRI icon indicating copy to clipboard operation
SlicerDMRI copied to clipboard

ENH: Set scalar range values in tractography display node test

Open jhlegarreta opened this issue 7 months ago • 1 comments

Set scalar range values in tractography display node test:

  • Set the auto mode to False.
  • Set the range values explicitly.

Fixes:

13: test_TestWindowLevel (test_tractography_display.test_tractography_displayTest) ... FAIL
13:
13: ======================================================================
13: FAIL: test_TestWindowLevel (test_tractography_display.test_tractography_displayTest)
13: ----------------------------------------------------------------------
13: Traceback (most recent call last):
13:   File "SlicerDMRI/Modules/Loadable/TractographyDisplay/Testing/Python/test_tractography_display.py",
 line 262, in test_TestWindowLevel
13:     self.assertEqual(scalar_range[0], .1)
13: AssertionError: 0.0 != 0.1

raised for example in: https://github.com/SlicerDMRI/SlicerDMRI/actions/runs/7223184160/job/19681721059#step:8:1690

jhlegarreta avatar Dec 16 '23 23:12 jhlegarreta

This is probably only a workaround for the test to pass: it is observed that

  • autoWL.click() does not toggle the state the of the checkbox when being called from the test (it does from 3D Slicer's Python console). autoWL.setChecked(False) and autoWL.toggle() do change the state.
  • It was probably the intent of the primary developer for the scalar range values of the display node (the displayed bundle object) being automatically updated once the slider's values are changed (provided that the display node's auto scalar range is False, maybe), which is not working probably because some signal/slots are not connected/do not exist, or some additional code is not being called from the connected slots.

These are separate issues and need a dedicated PR. So, for now, this PR is good as it is, and is ready to be merged.

jhlegarreta avatar Dec 16 '23 23:12 jhlegarreta