!******************************************************************************!
! Test plotting LayerMulti file in log modes
!
! @bug      2542 PLOT / LayerMulti: LayerMulti ignores mode=
! @author:  J Bauer
! @version: $Id: test_plot_layermulti_modes.mm,v 1.3 2014/02/28 14:35:45 ntn Exp $
!******************************************************************************!
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
    set instructions "You should see four plots. \n\n&
                      The LayerMulti plots on the right should look like the &
                      Layer1D plots on the left, except for color."

    call createFiles
    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 10 /title

      plot/id=plot1 ram:file1|ram:file2 cm=real    ! The two type 1000 files as Layers, for Comparison
      plot/id=plot2 ram:file1|ram:file2 cm=10LOG   ! Same as Plot 1, but in mode=10LOG
      plot/id=plot3 ram:file3           cm=real    ! Should look like Plot 1
      plot/id=plot4 ram:file3           cm=10LOG   ! Should look like Plot 2

    pipe off

  endif
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


!******************************************************************************!
! Generate data files to be used by the plots
!******************************************************************************!
procedure createFiles

  waveform ram:file1 form="CF" elem=1000 shape=sin  amp=1000
  waveform ram:file2 form="CF" elem=1000 shape=ramp amp=1000

  group ram:file3 ram:file1 ram:file2   ! create a type 3000 file to be used by LayerMulti

return
