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

Function test_DialogLoadMask_5

pyxrf/gui_module/tests/test_wd_load_data.py:241–268  ·  view source on GitHub ↗

Setting home directory

(qtbot)

Source from the content-addressed store, hash-verified

239
240
241def test_DialogLoadMask_5(qtbot):
242 """Setting home directory"""
243
244 dlg = DialogLoadMask()
245 qtbot.addWidget(dlg)
246 dlg.show()
247
248 # Set image size
249 n_rows, n_columns = 25, 37
250 dlg.set_image_size(n_rows=n_rows, n_columns=n_columns)
251
252 assert dlg._compute_home_directory() == ".", "Home directory is computed incorrectly"
253 d_name = os.path.join("file", "directory")
254 d_name = os.path.abspath(d_name)
255 dlg.set_default_directory(d_name)
256 assert dlg.get_default_directory() == d_name, "Returned default directory is incorrect"
257 assert dlg._compute_home_directory() == d_name, "Home directory is computed incorrectly"
258
259 d_name2 = os.path.join("file", "directory")
260 d_name2 = os.path.abspath(d_name2)
261 dlg.set_default_directory(d_name2)
262 f_path = os.path.join(d_name2, "file_name.bin")
263 dlg.set_mask_file_path(f_path)
264 assert dlg._compute_home_directory() == d_name2, "Home directory is computed incorrectly"
265
266 # Now clear the default directory
267 dlg.set_default_directory(d_name)
268 assert dlg._compute_home_directory() == d_name2, "Home directory is computed incorrectly"
269
270
271def test_DialogLoadMask_6(qtbot, monkeypatch):

Callers

nothing calls this directly

Calls 7

set_image_sizeMethod · 0.95
set_default_directoryMethod · 0.95
get_default_directoryMethod · 0.95
set_mask_file_pathMethod · 0.95
DialogLoadMaskClass · 0.85
showMethod · 0.80

Tested by

no test coverage detected