! Tests the panel.
!
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 COREGRAPHICS  coregraphics GET DEF=FALSE SDEF=TRUE  ! for a quick check of graphics - more extreme tests - since 3.8.1

  ! TBD -- MANY TESTS TO GO!!!
  set gotTimerMessage {0="FALSE",1="FALSE"}

  if interAct and coreGraphics isfalse then
    pipe init
      panel/headless/controls=gc/setup
      set str "PANEL TIMER test, should complete in a few seconds without &
               user interaction. If not, click FAIL."
      gcontrol text idtext "Instructions" "^str" 24 5 /title
      gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft

      set reg.panel.timers 2
      set reg.panel.timer(0) 1
      set reg.panel.timer(1) 2
    pipe off

    %test_panel_no_display_server
    %test_panel_pop
    %test_panel_pane_autoclose
    %test_panel_icon_switches
    %test_panel_tabs/options=+rotatetabs
    %test_panel_tabs/options=-rotatetabs
    %test_panel_multiple
    %test_panel_borders
    %test_panel_config
    %test_panel_jsetup
    %test_panel_setup "good"
    %test_panel_theme
    %test_panel_subs_parent
    %test_panel_subs_parent
    %test_panel_tsetup  ! BUG 2189, 2190
    %test_widget_wrapper/interactive=^interAct
    %test_panel_menubar
    %test_panel_divide_fixed_regions/interactive=^interAct

    if baseline then
      ! Only run in baseline, tests error conditions, if there is a problem,
      ! the panel could error out or show up off of the viewable screen.
      %test_panel_setup "bad"
      %test_panel_setup "big"
      %test_panel_setup "off"
      %test_panel_autogrid
    endif

  ! Quick test of graphics (extreme tests)
  elseif coreGraphics then
    %test_panel_menubar/COREGRAPHICS
    %test_panel_config
    %test_panel_pane_autoclose
    %test_panel_jsetup/COREGRAPHICS
    %test_panel_subs_parent
    %test_panel_subs_parent
    %test_panel_theme
    %test_panel_tsetup/COREGRAPHICS
  endif

endmacro

procedure processMessage m:msg

timex NOW t
!!!say "^reg.MAIN.name: Got ^msg.name, at time ^t"
if msg.name eqs "MAIN" then
  assert/text="PANEL: - TIMERs" gotTimerMessage.0 isTRUE AND &
                                gotTimerMessage.1 isTRUE
  pipe stop

elseif msg.name eqs "TIMER"
  if msg.info EQ 0 then
    set gotTimerMessage.0 "TRUE"
  elseif msg.info EQ 1 then
    ! Should get this timer message last
    set gotTimerMessage.1 "TRUE"
    mess send "MAIN",, "MAIN"
  else
    assert/text="Got unexpected timer message" FALSE
  endif
else
  ! Dont care
endif

return
