Setting home directory
(qtbot, monkeypatch)
| 269 | |
| 270 | |
| 271 | def test_DialogLoadMask_6(qtbot, monkeypatch): |
| 272 | """Setting home directory""" |
| 273 | |
| 274 | dlg = DialogLoadMask() |
| 275 | dlg.show() |
| 276 | qtbot.addWidget(dlg) |
| 277 | qtbot.waitForWindowShown(dlg) |
| 278 | |
| 279 | # Set image size |
| 280 | n_rows, n_columns = 25, 37 |
| 281 | dlg.set_image_size(n_rows=n_rows, n_columns=n_columns) |
| 282 | |
| 283 | d_name = os.path.join("file", "directory") |
| 284 | d_name = os.path.abspath(d_name) |
| 285 | f_name = "file_name.bin" |
| 286 | d_path = os.path.join(d_name, f_name) |
| 287 | dlg.set_default_directory(d_name) |
| 288 | |
| 289 | # Activate the group |
| 290 | dlg.gb_mask.setChecked(True) |
| 291 | |
| 292 | monkeypatch.setattr(QFileDialog, "getOpenFileName", lambda *args: [""]) |
| 293 | qtbot.mouseClick(dlg.pb_load_mask, Qt.LeftButton) |
| 294 | assert dlg.le_load_mask.isValid() is False, "Incorrect state of the line edit widget" |
| 295 | assert dlg.le_load_mask.text() == dlg._le_load_mask_default_text, "Line Edit text is set incorrectly" |
| 296 | assert dlg.get_mask_file_path() == "", "Unexpected returned path for the mask file" |
| 297 | |
| 298 | monkeypatch.setattr(QFileDialog, "getOpenFileName", lambda *args: [d_path]) |
| 299 | qtbot.mouseClick(dlg.pb_load_mask, Qt.LeftButton) |
| 300 | assert dlg.le_load_mask.isValid() is True, "Incorrect state of the line edit widget" |
| 301 | assert dlg.le_load_mask.text() == d_path, "Line Edit text is set incorrectly" |
| 302 | assert dlg.get_mask_file_path() == d_path, "Unexpected returned path for the mask file" |
nothing calls this directly
no test coverage detected