!******************************************************************************!
! Tests PLOT of Jeff's CJ, with both 1000 and 2000 files
!
! Arguments: None
!
! @bug      NXM-3894  12-bit integer Midas Data Type needed
! @since    4.1.2
! @author:  Jeanette McCall
!******************************************************************************!
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)
  switch NONATIVE    nonative GET DEF=FALSE SDEF=TRUE  ! run with all Java

  res savedUseNative env.usenative
  if nonative then
    env set usenative |
  else
    env set usenative |IO|Math|Cast|Convert|Other|
  endif
  res t1000cj jeff1000cj.tmp
  res t2000cj jeff2000cj.tmp

  if interAct then
    set instructions "Tests PLOT of Jeff's 12-bit CJ, both 1000 and 2000 files\n\n&
                      This needs to be run with and without the NONATIVE switch\n\n&
                      Curently NONATIVE = ^{nonative}"

    waveform t1000cj FORM="CJ" AMP=200 ELEM=512
    fft t1000cj t2000cj{FORM=CJ} NFFT=32

    pipe on
      panel/msgid=MAIN/setup/controls=gc
      gcontrol label macro "Test MACRO"
      gcontrol menu  main "Exit with Status =" "PASS,FAIL" TABLE={ItemColors={PASS="GREEN",FAIL="RED"}} /tleft

      gcontrol text  idtext "Instructions" instructions 24 12 /title

      plot/id=plot1000cj t1000cj
      plot/id=plot2000cj t2000cj

      list2/id=list1000cj t1000cj
      list2/id=list2000cj t2000cj

      shellgui/id=statusshell/attach
      say "********************************"
      say "status of 1000 CJ"
      say "********************************"
      status  t1000cj
      say "********************************"
      say "status of 2000 CJ"
      say "********************************"
      status  t2000cj
    pipe off

    erase t1000cj t2000cj
  endif
  env set usenative savedUseNative
endmacro

!******************************************************************************!
! Main process message for this macro. Should be right after the ENDMACRO.
!******************************************************************************!
procedure processMessage m:msg
  if msg.name eqs "MAIN" then
    assert/text="^reg.main.name: User indicated tests" msg.data eqss "PASS"
    pipe stop
  else
    say "Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
  endif
return

!******************************************************************************!
! If an unexpected exception is caught, mark test as failed, unless it is expected
!******************************************************************************!
procedure processException m:emsg
  if expectedException REXISTS then
    assert/text="^reg.main.name: Expected ERROR starts with: ^{expectedException}" expectedException EQSS emsg.data.message
    remove expectedException
  else
    assert/text="^reg.main.name: Caught unexpected exception ^{emsg.data}" "FALSE" isTrue
    if "Trace" SUBS ENV.DEBUG then invoke ,, emsg.data.printStackTrace()
  endif
return
