! Tests pipe data flowing from X-Midas to NeXtMidas.
! NOTE: This test requires a graphics display to run.
!
!  @issue   NXM-4131 NEXTOPT create test that pipes data from XM to NXM
!  @author  Jeanette McCall
!  @since   NeXtMidas 4.1.4
!
startmacro

  local baseln       ! Baseline testing?
  local interAct     ! Interactive? testing

  switch BASELINE    baseln GET               ! Baseline testing?
  switch INTERACTIVE interAct GET             ! Interactive testing?
  if baseln   eq -1 then res baseln    1      ! switch not specified, default to enable Baseline testing
  if interAct eq -1 then res interAct ^baseln ! switch not specified, default to ^baseline

  if interAct le 0 then
    info "Run %test_xm_piped_data/baseline or with /interactive to enable additional tests that requires X11 display"
  else

    res nsamples 3e7
    nm/on/bg/id=999
    nm INFO "*****************************************************\n      &
             *                 Click ENDMACRO                    *\n      &
             * Tests PIPE Data flowing from X-Midas to NeXtMidas *\n      &
             *    Should see NM plot along with XRTRASTER plot   *\n      &
             *****************************************************"

    xpipe on
      WAVEFORM/rs/tl=1k/ctag=3:SFREQ _wavexm SF nsamples SIN
      MFFT/rs/fftp=3 _wavexm _fftxm 1k hann 0.0
      XRTRASTER/xs=2/mtag=X:CFREQ/lpb=2/stretch _fftxm 0    0.25 lo ,, 20
      nm/xs=3 plot/theme=WoB xmpipe:_fftxm cnt=click Z1=-100 Z2=80 CM=20LOG /lpb=16
    xpipe off

    nm/off

  endif  ! interAct
endmacro

