!******************************************************************************!
! Test PLOT's handling of cases where a file does not exist.
! Note: default is now POPUP|PRINT as of NeXtMidas 4.1.4
!
! @issue    NXM-4061 PLOT throws Exception rather than giving File Not Found MJPopup
! @author:  J. Czechowski
!******************************************************************************!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE
  switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE

  if interAct then
    pipe init
      res myres nxm.sys.test.does_not_exist.prm ! <-- file does not exist
      res inst  "Should see:\n&
                 1) pop-up error message\n&
                 2) WARN message in the terminal\n&
                 both saying that <path>/does_not_exist.prm not found."
      info "A Warning for file not found should appear below this line"

      panel/msgid=MAIN/setup/controls=gc
      plot/id=idplot/READOUT="+OnAxis|+DateString" myres

      gcontrol label macro "MACRO"
      gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft
      set gc.main.itemColors {PASS=GREEN,FAIL=RED}
      gcontrol text idtext "Instructions" "^inst" 24 7 /title

    pipe off
  endif
endmacro

!******************************************************************************!
procedure processMessage m:msg
  !say "msg.name ^msg.name, data ^msg.data"

  if msg.name eqs "MAIN" then
    assert/text="^reg.main.name: User indicated tests" msg.data eqss "PASS"
    pipe stop
  else
    say "^reg.main.name: Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
  endif
return
