! This tests the graphicslab3 macro for the Macro Graphics Lab 3
!
! Author:  Neon Ngo
! Version: $Id: test_graphicslab3.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 "For every click on the world plot with cities overlaid, the point should be saved &
              into the Points Selected history list (fields should be in red) and the last selected &
              point should be marked with a red feature on the plot and the position widgets under &
              Status should be updated accordingly. Change the Map Options and City &
              Color under Plot Options and the plot should be updated accordingly."

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

      graphicslab3/id=lab/bg
    pipe off
  endif
endmacro

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

    ! Check for running lab macro
    if REG.LAB rexists then
      ! Stop the macro
      set reg.lab.state FINISH
      pause 2

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

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