! This tests the msglab1 macro for the Macro Messages Lab 1
!
! Author:  Neon Ngo
! Version: $Id: test_msglab1.mm,v 1.2 2008/02/18 23:16:01 ntn Exp $
!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE
  switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE

  if interAct then
    res inst "Should see a map of the world. Click inside map and a yellow X should mark where you &
              clicked. A message with name=MARK and data=PosLonLatAlt should be displayed in the &
              Message Output."

    pipe on
      panel/msgid=MAIN/setup/controls=gc
      gcontrol text idtext "Instructions" "^inst" 24 8 /title
      gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft
      set gc.main.itemColors {PASS=GREEN,FAIL=RED}

      msglab1/id=msglab1/bg

      shellgui/attach
    pipe off
  endif
endmacro

procedure processMessage m:msg
  if msg.name eqs "MAIN" then
    assert/text="^reg.main.name: Tests for MSGLAB1" msg.data eqss "PASS"

    ! Check for running msglab1 macro
    assert/text="^reg.main.name: REG.MSGLAB1 found" REG.msglab1 rexists

    ! Stop the macro
    set reg.msglab1.state FINISH
    pause 1

    ! Did the macro stop?
    assert/text="^reg.main.name: REG.MSGLAB1 removed" REG.msglab1 nrexists

    pipe stop
  else
    say "^reg.main.name: Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
  endif
return
