MCPcopy Create free account
hub / github.com/NSLS2/PyXRF / test_DialogLoadMask_6

Function test_DialogLoadMask_6

pyxrf/gui_module/tests/test_wd_load_data.py:271–302  ·  view source on GitHub ↗

Setting home directory

(qtbot, monkeypatch)

Source from the content-addressed store, hash-verified

269
270
271def 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"

Callers

nothing calls this directly

Calls 6

set_image_sizeMethod · 0.95
set_default_directoryMethod · 0.95
get_mask_file_pathMethod · 0.95
DialogLoadMaskClass · 0.85
showMethod · 0.80
isValidMethod · 0.80

Tested by

no test coverage detected