@@ -29,7 +29,9 @@ local function send_keys(...)
2929end
3030
3131local function load_ui ()
32- local view = b .BlueprintUI {}
32+ local options = {}
33+ blueprint .parse_gui_commandline (options , {})
34+ local view = b .BlueprintUI {presets = options }
3335 view :show ()
3436 return view
3537end
@@ -394,6 +396,22 @@ function test.name_no_collision()
394396 expect .eq (' Set' , get_screen_word (name_help_text_pos ))
395397 send_keys (' LEAVESCREEN' ) -- cancel ui
396398 end )
399+
400+ mock .patch (dfhack .filesystem , ' listdir_recursive' ,
401+ mock .func ({{path = ' blueprint' }}),
402+ function ()
403+ local view = load_ui ()
404+ view .subviews .name .text = ' blueprint/'
405+ view .subviews .name .on_change ()
406+ view :updateLayout ()
407+ local name_help_label = view .subviews .name_help
408+ local name_help_text_pos = {x = name_help_label .frame_body .x1 ,
409+ y = name_help_label .frame_body .y1 }
410+ view :onRender ()
411+ expect .eq (' Set' , get_screen_word (name_help_text_pos ),
412+ ' dirname does not conflict with similar filename' )
413+ send_keys (' LEAVESCREEN' ) -- cancel ui
414+ end )
397415end
398416
399417function test .name_collision ()
@@ -409,6 +427,22 @@ function test.name_collision()
409427 expect .eq (' Warning:' , get_screen_word (name_help_text_pos ))
410428 send_keys (' LEAVESCREEN' ) -- cancel ui
411429 end )
430+
431+ mock .patch (dfhack .filesystem , ' listdir_recursive' ,
432+ mock .func ({{path = ' blueprint' , isdir = true }}),
433+ function ()
434+ local view = load_ui ()
435+ view .subviews .name .text = ' blueprint/'
436+ view .subviews .name .on_change ()
437+ view :updateLayout ()
438+ local name_help_label = view .subviews .name_help
439+ local name_help_text_pos = {x = name_help_label .frame_body .x1 ,
440+ y = name_help_label .frame_body .y1 }
441+ view :onRender ()
442+ expect .eq (' Warning:' , get_screen_word (name_help_text_pos ),
443+ ' dirname match generates warning' )
444+ send_keys (' LEAVESCREEN' ) -- cancel ui
445+ end )
412446end
413447
414448-- widgets to configure which blueprint phases to output
0 commit comments