!******************************************************************************!
! Test case with heavy graphics and processing designed to see CentOS 7 graphics degradation
!
! Arguments: None
!
! @bug      NXM-3213 Graphics degradation in CentOS 7
! @since    3.8.1
! @author:  Kevin Esterheld
!******************************************************************************!
startmacro L:numPlots[12]
  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

  if interAct or coreGraphics then
    set instructions "1) Make sure all 12 sd360s load completely (including gcontrols)\n\n&
                      2) Make sure DRAGBOXes render as they are drawn\n\n&
                      3) Bring up MMB plot menus in all but one of the plots\n\n&
                      3) Popout the remaining plot and bring up a MMB menu in it\n\n&
                      If everything loads and is responsive click PASS"

    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 24 /title
      
      do ii 1 12
        sd360/bg/id=sd360^{ii} infinity
      enddo

     
    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"
    do ii 1 12
      message SEND sd360^{ii} ,, "STATE" ,, "EXIT"
    enddo
    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