@@ -983,3 +983,64 @@ def _qmsgbox(*args, **kwargs):
983983 # AF column should be hidden
984984 assert pos_table .table ().isColumnHidden (af_col )
985985 assert pos_table .table ().isColumnHidden (af_btn_col )
986+
987+
988+ def test_grid_plan_fov_update (qtbot : QtBot , global_mmcore : CMMCorePlus ) -> None :
989+ mmc = global_mmcore
990+ wdg = MDAWidget ()
991+ qtbot .addWidget (wdg )
992+ wdg .show ()
993+
994+ wdg .tab_wdg .setChecked (wdg .grid_plan , True )
995+ grid_plan = useq .GridRowsColumns (rows = 2 , columns = 1 )
996+ wdg .grid_plan .setValue (grid_plan )
997+
998+ assert wdg .value ().grid_plan .fov_height == 512
999+ assert wdg .value ().grid_plan .fov_width == 512
1000+
1001+ with qtbot .waitSignal (mmc .events .roiSet ):
1002+ mmc .setROI (0 , 0 , 100 , 150 )
1003+ assert wdg .value ().grid_plan .fov_width == 100
1004+ assert wdg .value ().grid_plan .fov_height == 150
1005+
1006+ with qtbot .waitSignal (mmc .events .pixelSizeChanged ):
1007+ mmc .setPixelSizeConfig ("Res20x" )
1008+ assert wdg .value ().grid_plan .fov_width == 50
1009+ assert wdg .value ().grid_plan .fov_height == 75
1010+
1011+
1012+ def test_grid_plan_subsequence_fov_update (
1013+ qtbot : QtBot , global_mmcore : CMMCorePlus
1014+ ) -> None :
1015+ mmc = global_mmcore
1016+ wdg = MDAWidget ()
1017+ qtbot .addWidget (wdg )
1018+ wdg .show ()
1019+
1020+ pos = useq .AbsolutePosition (
1021+ x = 0.0 ,
1022+ y = 0.0 ,
1023+ z = 0.0 ,
1024+ sequence = useq .MDASequence (
1025+ grid_plan = useq .GridRowsColumns (
1026+ fov_width = 512.0 , fov_height = 512.0 , rows = 3 , columns = 1
1027+ )
1028+ ),
1029+ )
1030+ wdg .tab_wdg .setChecked (wdg .stage_positions , True )
1031+ wdg .stage_positions .setValue ([pos ])
1032+
1033+ sp = wdg .stage_positions
1034+ assert sp .value ()[0 ].sequence .grid_plan .fov_width == 512
1035+ assert sp .value ()[0 ].sequence .grid_plan .fov_height == 512
1036+
1037+ with qtbot .waitSignal (mmc .events .roiSet ):
1038+ mmc .setROI (0 , 0 , 100 , 150 )
1039+
1040+ assert sp .value ()[0 ].sequence .grid_plan .fov_width == 100
1041+ assert sp .value ()[0 ].sequence .grid_plan .fov_height == 150
1042+
1043+ with qtbot .waitSignal (mmc .events .pixelSizeChanged ):
1044+ mmc .setPixelSizeConfig ("Res20x" )
1045+ assert sp .value ()[0 ].sequence .grid_plan .fov_width == 50
1046+ assert sp .value ()[0 ].sequence .grid_plan .fov_height == 75
0 commit comments