!******************************************************************************!
! This will test the /LPS and /LPB switches on plot when plotting a Type 2000
! raster.
!
! @author  J. Czechowski IV
!!******************************************************************************!
startmacro l:lps[1] l:lpb[1]
  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
    res inst "A piped raster plot with ^lps segments should be visible."

    pipe on
      panel/msgid=MAIN/id=panel/setup/controls=gc

      set samples 5e6
      set sr      1e5

      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" ^inst 24 5 /title
      gcontrol label testlabel  "Test With /LPS=^lps /LPB=^lpb" AlwaysOpen

      waveform/RT _wave SF samples pulse freq=sr/10 amp=1e4 delta=1/sr
      fft/dbf _wave _waveb nfft=1k navg=1 over=0

      fcalc _wavec _waveb abs random 2 * * 100 - 0 max 2 * 50 - 0 max
      plot/id=plot1/lps=^lps/lpb=^lpb _wavec type=raster
    pipe off
  endif
endmacro

procedure processMessage m:msg
  if msg.name EQSS "MAIN" then
    assert/text="Plot raster with /LPS=^lps /LPB=^lpb test" &
          "PASS" SUBS msg.data
    pipe stop

  else
    say "Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
  endif
return


procedure processException
  say "Exception while running test"
  assert/text="Plot raster with /LPS=^lps test" 0
  pipe stop
return
