@@ -240,6 +240,28 @@ def test_browse(self):
240240 self .assertIsNotNone (cur )
241241 self .assertTrue (samepath (cur .path (), path ))
242242
243+ def test_browse_prefix (self ):
244+ widget = self .widget
245+ path = self .data_regions_path
246+ browse_dialog = widget ._browse_dialog
247+ with mock .patch .object (widget , "_browse_dialog" ) as r :
248+ dlg = browse_dialog ()
249+ dlg .setOption (QFileDialog .DontUseNativeDialog )
250+ dlg .selectFile (path )
251+ dlg .exec_ = dlg .exec = lambda : QFileDialog .Accepted
252+ r .return_value = dlg
253+ with mock .patch .object (owcsvimport .CSVImportDialog , "exec_" ,
254+ lambda _ : QFileDialog .Accepted ):
255+ dir = os .path .dirname (__file__ )
256+ widget .workflowEnv = lambda : {"basedir" : dir }
257+ widget .workflowEnvChanged ("basedir" , dir , "" )
258+ widget .browse_relative (prefixname = "basedir" )
259+
260+ cur = widget .current_item ()
261+ self .assertIsNotNone (cur )
262+ self .assertTrue (samepath (cur .path (), path ))
263+ self .assertIsInstance (cur .varPath (), PathItem .VarPath )
264+
243265 def test_browse_for_missing (self ):
244266 missing = os .path .dirname (__file__ ) + "/this file does not exist.csv"
245267 widget = self .create_widget (
0 commit comments