DialogLoadMask - ROI selection group. Check if validation of dialog controls works as expected. In this test the values are set using dialog box functions, not using mouse/keyboard input.
(qtbot, use_keys_and_mouse)
| 189 | |
| 190 | @pytest.mark.parametrize("use_keys_and_mouse", [False, True]) |
| 191 | def test_DialogLoadMask_4(qtbot, use_keys_and_mouse): |
| 192 | """ |
| 193 | DialogLoadMask - ROI selection group. |
| 194 | Check if validation of dialog controls works as expected. |
| 195 | In this test the values are set using dialog box functions, not using mouse/keyboard input. |
| 196 | """ |
| 197 | |
| 198 | dlg = DialogLoadMask() |
| 199 | qtbot.addWidget(dlg) |
| 200 | dlg.show() |
| 201 | |
| 202 | # Set image size |
| 203 | n_rows, n_columns = 25, 37 |
| 204 | dlg.set_image_size(n_rows=n_rows, n_columns=n_columns) |
| 205 | |
| 206 | def _activate_mask_selection_group(state): |
| 207 | if use_keys_and_mouse: |
| 208 | dlg.gb_mask.setChecked(state) |
| 209 | else: |
| 210 | dlg.set_mask_file_active(state) |
| 211 | assert dlg.get_mask_file_active() == state, "Mask selection group status is incorrect" |
| 212 | assert dlg.gb_mask.isChecked() == state, "Mask selection group check status is incorrect" |
| 213 | |
| 214 | assert dlg.le_load_mask.isValid() is True, "Validation status of the mask file name is incorrect" |
| 215 | _activate_mask_selection_group(True) |
| 216 | assert dlg.le_load_mask.isValid() is False, "Validation status of the mask file name is incorrect" |
| 217 | _activate_mask_selection_group(False) |
| 218 | assert dlg.le_load_mask.isValid() is True, "Validation status of the mask file name is incorrect" |
| 219 | |
| 220 | fpath = "/file/path/file_name.bin" # File path doesn't have to be real |
| 221 | |
| 222 | # Set file name during 'inactive' state |
| 223 | dlg.set_mask_file_path(fpath) |
| 224 | assert dlg.le_load_mask.isValid() is True, "Validation status of the mask file name is incorrect" |
| 225 | _activate_mask_selection_group(True) |
| 226 | assert dlg.le_load_mask.isValid() is True, "Validation status of the mask file name is incorrect" |
| 227 | _activate_mask_selection_group(False) |
| 228 | assert dlg.le_load_mask.isValid() is True, "Validation status of the mask file name is incorrect" |
| 229 | |
| 230 | # Set file name during 'inactive' state |
| 231 | dlg.set_mask_file_path("") # Clear the file path |
| 232 | assert dlg.le_load_mask.isValid() is True, "Validation status of the mask file name is incorrect" |
| 233 | _activate_mask_selection_group(True) |
| 234 | assert dlg.le_load_mask.isValid() is False, "Validation status of the mask file name is incorrect" |
| 235 | dlg.set_mask_file_path(fpath) |
| 236 | assert dlg.le_load_mask.isValid() is True, "Validation status of the mask file name is incorrect" |
| 237 | _activate_mask_selection_group(False) |
| 238 | assert dlg.le_load_mask.isValid() is True, "Validation status of the mask file name is incorrect" |
| 239 | |
| 240 | |
| 241 | def test_DialogLoadMask_5(qtbot): |
nothing calls this directly
no test coverage detected