!******************************************************************************!
! Test plotting a file where the YMIN and YMAX are the same
!
! @bug      2479 PLOT: nothing displays if Y2 <= Y1
! @bug      2478 PLOT: cuts off values equal to lower limit of the range
! @author:  JC4, J Bauer
!******************************************************************************!
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 "On the LEFT, you should see:\n\n&
                      top:    blank plot\n&
                      bottom: a plot with a straight line at Y=1\n\n&
                      CLICK the OPENFILE button. A plot with a straight line at y=1 should show up in the top left plot.\n\n&
                      CLICK each button in order to adjust the index/bounds of the top plot.\n&
                      => The plot should always show a straight line at Y=1\n&
                      => there should be warnings in the terminal about\n   setting values equal.\n\n\n&
                      On the RIGHT, you should see:\n&
                      plot with a straight horizontal line at bottom (Y=0)."
    
    wave ram:temp form=sd shape=constant amp=1
    wave ram:temp2 "SF" ELEM=131072 SHAPE=COS FREQ=1.5E6 DELTA=160E-9
    fft/1d/psd ram:temp2 ram:temp3 16384
    

    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 20 /title
      
      gcontrol button myButt "" "OPENFILE"
      gcontrol button setRY "" "Set View Y1==Y2"
      gcontrol button setRX "" "Set View X1==X2"
      gcontrol button setORY "" "Set Plot Y1==Y2"
      gcontrol button setORX "" "Set Plot X1==X2"
      
      plot/id=plot1 scale="-AutoMin|-AutoMax"
      plot/id=plot2 ram:temp y1=1 y2=3  
      plot/id=plot3 ram:temp3           

    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
  elseif msg.name eqs "MYBUTT" then
    info "!!!!You should see warning(s) about setting bounds to equal values.!!!!"
    message send plot1 name="OPENFILE" info=-1 data=ram:temp quals={VIEWLIMITS={YMIN=1,Y2=1}}
  elseif msg.name eqs "SETRY" then
    invoke ,, reg.plot1.setYBounds(1.001,1.001)
  elseif msg.name eqs "SETORY" then
    invoke ,, reg.plot1.setOuterLimits("YMIN",.99)
    invoke ,, reg.plot1.setOuterLimits("YMAX",.99)
    invoke ,, reg.plot1.applyUserBounds("OUTER")
  elseif msg.name eqs "SETRX" then
    invoke ,, reg.plot1.setXBounds(1.01,1.01)
  elseif msg.name eqs "SETORX" then
    invoke ,, reg.plot1.setOuterLimits("XMIN",.99)
    invoke ,, reg.plot1.setOuterLimits("X2",.99)
    invoke ,, reg.plot1.applyUserBounds("OUTER") 
    
  else
    say "Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
  endif
return

!******************************************************************************!
! Sample test procedure description
procedure test_xyz

return
