!******************************************************************************!
! Test the plotting of Type 1000 files (Layer1D).
!
! Author:  Neon Ngo
! Bug: 70 - PLOT: Incorrect scaling of complex float file with CM=RvI (Real vs Imaginary)
!******************************************************************************!
startmacro
  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
    call setDatDir

    set defaultInstructions &
        "Should see a plot of CF Type 1000 file in RvI (Real vs Imaginary) mode. &
         The x-axis should be around -100 to 250. The y-axis should be from -140 to 225. &
         The plot should have a large circular polygon around it with a bunch of smaller &
         semi-circular polygons in the lower left quadrant."

    pipe on

    panel/msgid=MAIN/setup/controls=gc
    ! test for Bug 90 - PLOT: Incorrect scaling of complex float file with CM=RvI (Real vs Imaginary)
    plot/id=idplot ^{datDir}.fftdemo.prm cm=RvI

    gcontrol label mainLabel "Main"
    gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft
    set gc.main.itemColors {PASS=GREEN,FAIL=RED}
    gcontrol text idtext "Instructions" "^defaultInstructions" 40 10 /title

    pipe off
  endif

  ! Additional interactive tests, only run with /BASELINE
  if interAct and baseline then
    %test_plot_layer1d_all         ! Bug 892 Bug 2367 fixed in 414 - partial duplicate
    %test_plot_layer1d_data_bounds  ! NXM-3847
    %test_plot_layer1d_feature      ! Bug 2166
    !%test_plot_layer1d_openfile    ! Bug 2115 Skipping since probably covered elsewhere
    %test_plot_layer1d_psk_rvi_radius ! NXM-4065 MPlot should include radius on real vs imag readouts
    %test_plot_layer1d_raster       ! Bug 605
    %test_plot_layer1d_readout      ! Bug 2063 Bug 2155 Bug 2426
    %test_plot_layer1d_traces       ! Bug 2397
    %test_plot_layer1d_time_overlap ! Bug 2419
  endif

endmacro

!******************************************************************************!
procedure processMessage m:msg
!say "msg.name ^msg.name, data ^msg.data"

if msg.name eqs "MAIN" then
  assert/text="Plot Layer1D (Type 1000 files)" msg.data eqss "PASS"
  pipe stop
else
  ! do nothing
  say "^reg.main.name: Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
endif

return

!******************************************************************************!
! Set the dat directory
!******************************************************************************!
procedure setDatDir
  invoke nxmMajor env.nmversion.subString(0,1)
  invoke major java.lang.Integer.valueOf(nxmMajor)
  if major GE 4 then
    invoke s:datDir           nxm.sys.test.DatLocator.getDatDirLocation()
    invoke s:datDirSlash      nxm.sys.test.DatLocator.getDatDirSlashLocation()
    invoke z:sysDatFull       nxm.sys.test.DatLocator.sysDatFull()
    invoke z:sysTestDatExists nxm.sys.test.DatLocator.sysTestDatExists()
  else
    set s:datDir           "nxm.sys.dat"
    set s:datDirSlash      "nxm/sys/dat"
    set z:sysDatFull       true
    set z:sysTestDatExists false
  endif
return
