!
! Tests related to pipe sections and data pipes.
!
! Author:  J. Czechowski, J. Hallam
!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE
  switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE

  %test_pipe_share/interactive=^interact/baseline=^baseline
  %test_pipe_clear

  if interAct then
    set instructions "Should see (1) plot of a sine wave, &
                                 (2) plot of a square wave."
    
    pipe on
      panel/msgid=MAIN/setup/controls=gc

      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" "^{instructions}" 24 7 /title

      ! (1) Pipe referenced before it is created
      plot/id=plot1 _sine y1=-1.5 y2=1.5
      waveform _sine FORM=SF ELEM=1K SHAPE=SINE


      ! (2) Pipe referenced after it is created
      waveform _square FORM=SF ELEM=1K SHAPE=SQUARE
      plot/id=plot2 _square y1=-1.5 y2=1.5
      
    pipe off

    %test_pipe_setstate
  endif

endmacro


!******************************************************************************!
procedure processMessage m:msg
  !say "msg.name ^msg.name, data ^msg.data"
  
  if msg.name eqs "MAIN" then
    assert/text="Pipe 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
