!******************************************************************************!
! Test initializing the theme in a stand-alone popup
!
! Arguments: None
!
! @bug      2529 POPUP / THEME: Graphics initialization missing from POPUP command
! @author:  J Bauer / JC4
!******************************************************************************!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE  ! for normal interactive test(s)
  switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE  ! for defects or more obscure test case(s)

  if interAct then
    set instructions "In a separate shell, start a NEW NeXtMidas session and then run the following commands. &
                      \n\n   nM> popup/blocking=\"Mouse|Macro\" view \"YesNo\" \"Do you like PI?\" \"QUESTION\" \n\n &
                      The POPUP should have the default NeXtMidas theme set. Press either YES/NO on the POPUP &
                      to close it. On this macro, PRESS PASS if the POPUP theme was set or FAIL if it was not."

    pipe on
      panel/msgid=MAIN/setup/controls=gc
      gcontrol label macro "Test MACRO"
      gcontrol menu  main "Exit with Status =" "PASS,FAIL" TABLE={ItemColors={PASS="GREEN",FAIL="RED"}} /tleft

      gcontrol text  idtext "Instructions" instructions 24 8 /title

    pipe off

  endif
endmacro

!******************************************************************************!
! Main process message for this macro. Should be right after the ENDMACRO.
procedure processMessage m:msg
  if msg.name eqs "MAIN" then
    assert/text="^reg.main.name: User indicated tests" msg.data eqss "PASS"
    pipe stop
  else
    say "Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
  endif
return

!******************************************************************************!
! If an unexpected exception is caught, mark test as failed
!******************************************************************************!
procedure processException m:emsg
  assert/text="^reg.main.name: Caught unexpected exception ^{emsg.data}" "FALSE" isTrue
  if "Trace" SUBS ENV.DEBUG invoke ,, emsg.data.printStackTrace()
return


