! This tests the graphicslab2 macro for the Macro Graphics Lab 2
!
! Author:  Neon Ngo
! Version: $Id: test_graphicslab2.mm,v 1.1 2007/07/25 19:04:37 ntn Exp $
!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE
  switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE

  if interAct then
    res inst "There should be 4 plots across (sinewave, fftdemo, cities w/ world.prm, and &
              world.dbf w/ world.shp) and underneath each plot should be a list2 of these files."

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

      graphicslab2/id=lab/bg
    pipe off
  endif
endmacro

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

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

      ! 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
