startmacro
!
! Test case for a plot in a hidden panel causing very high CPU usage.
!
! @bug     1201
! @author  Neon Ngo
! @version $Id: test_plot_hidden.mm,v 1.2 2007/12/19 20:24:35 jph Exp $
!
switch INTERACTIVE interAct GET DEF=TRUE

if interAct then
  pipe init
    panel/setup/controls=gc

    gcontrol menu main "Exit with Status" "PASS,FAIL" 1 /tleft
    set gc.main.itemColors {PASS=GREEN,FAIL=RED}
    gcontrol text info "Instructions" &
      "Monitor your system CPU usage (e.g. using top, task manager, etc.) and &
       verify it is not causing a high CPU load vs with the PLOT visible. &
       After about 30 seconds select the SHOW PANEL button to show the hidden &
       plot. Select PASS if CPU usage is about the same." 24 10 /title

    gcontrol menu showPlot "Show Hidden PLOT" "SHOW PANEL" /tleft

    plot/id=staticplot world
    message FUNC=SEND ID=STATICPLOT NAME=OPENFILE DATA=cities 
  pipe off
endif

endmacro

!******************************************************************************!
procedure processMessage
  !say "Msg ^msg.name = ^msg.data from ^msg.fid"

  if msg.name eqs "MAIN" then
    assert/text="^reg.main.name: PLOT in hidden panel" msg.data eqss "PASS"
    pipe stop
  elseif msg.name eqs "SHOWPLOT" then
    set reg.panel.borders "LEFT|TOP"
  endif
return
