!**************************************************************************************************!
! Tests for the MENU type of GCONTROL
!
! @bug 2319 Gcontrol: flag int value does not work and documentation issues:
! @author  J Hallam, J Bauer
! @version $Id: test_gcontrol_indexing.mm,v 1.2 2011/01/26 14:19:02 jwb Exp $
!**************************************************************************************************!

startmacro

  pipe ON
    
    panel/msgid=main/setup/controls=gc
      gcontrol label  macro "MACRO"
        gcontrol menu main "Exit with Status = " "PASS,FAIL"  /tleft
        set gc.main.itemcolors {PASS=GREEN,FAIL=RED}

        gcontrol/title TEXT instructions INSTRUCTIONS "This test is meant to run &
                       non-interactive. " 24 3
        
      gcontrol label labelDogs "Dogs"
	      gcontrol button dogsHEX "Dogs 0xF" "Dog1,Dog2,Dog3,Dog4" 0xF /chkbox /toggle /tleft
	      info "Should see a deprecation warning below for setting a MASK with a number"
	      gcontrol button dogsDEC7 "Dogs '7'" "Dog1,Dog2,Dog3,Dog4" 7 /chkbox /toggle /tleft
	      gcontrol button dogsDEC15 "Dogs3" "Dog1,Dog2,Dog3,Dog4" dog3 /chkbox /toggle /tleft
	      gcontrol button dogsALLSTR "Dogs All Str" "Dog1,Dog2,Dog3,Dog4" "|Dog1|Dog2|Dog3|Dog4" /chkbox /toggle /tleft
      
      gcontrol label labelNumbers "Numbers"
        gcontrol button numbers1 "Numbers 1" "1,2,3,4" 1 /chkbox /toggle /tleft
        gcontrol button numbers2 "Numbers 2" "1,2,3,4" 2 /chkbox /toggle /tleft
        gcontrol button numbers3 "Numbers 3" "1,2,3,4" 3 /chkbox /toggle /tleft
        gcontrol button numbers4 "Numbers 4" "1,2,3,4" 4 /chkbox /toggle /tleft
        !gcontrol line line1 "" "blue"
        gcontrol button numbersStr "Numbers '1|3'" "1,2,3,4" "1|3" /chkbox /toggle /tleft
        
     message send main "START" "START"    ! Used for non-interactive testing
        
  pipe OFF

endmacro

procedure processMessage m:msg
  !say "Got msg: ^msg"
  if msg.name eqs "MAIN"
    assert/text="^reg.main.name: user indicated" msg.data eqs "PASS"
    pipe stop
  elseif msg.name EQS "START" then
    ! Non-interactive test mode
    assert/text="GC Mask Value=0xF" gc.dogsHEX.value EQS "|Dog1|Dog2|Dog3|Dog4|"
    assert/text="GC Mask Value=7" gc.dogsDEC7.value EQS "|Dog1|Dog2|Dog3|"
    assert/text="GC Mask Value=15" gc.dogsDEC15.value EQS "|Dog3|"
    assert/text="GC String Value for All" gc.dogsALLSTR.value EQS "|Dog1|Dog2|Dog3|Dog4|"
    assert/text="GC Number items Mask val=1" gc.numbers1.value EQS "|1|"
    assert/text="GC Number items Mask val=2" gc.numbers2.value EQS "|2|"
		assert/text="GC Number items Mask val=3" gc.numbers3.value EQS "|3|"
		assert/text="GC Number items Mask val=4" gc.numbers4.value EQS "|4|"
		assert/text="GC Number items String val='1|3'" gc.numbersStr.value EQS "|1|3|"
    pipe stop
  endif

return