!------------------------------------------------------------------------------!
! Tests for case where List2 does not show a row update
!
!   @Author : J. Bauer
!   @Version: $Id: test_list2_table.mm,v 1.6 2012/12/19 13:09:14 jwb Exp $
!   @Bug 2392: LIST2: Should handle table and table files
!------------------------------------------------------------------------------!
!
startmacro
  
  set instructions "You should see two LIST2, the top with three columns and the &
                    bottom list2 with only two. The lists should have the &
                    same data in the first two columns (A and B). There should NOT &
                    be a column C displayed in the bottom list. There should NOT &
                    be data in column B in row 3 in either list. Click on the &
                    button to add a row to each list. A row should get added, &
                    and there should still NOT be a column C displayed in the bottom list."

  ! template to use for the first table (includes Column C)
  set t:templ {}
  set templ._GLOBAL_ {AUTOHIDE="FALSE",AUTOORDER="TRUE",WIDTH=12}
  set templ.A {WIDTH=12}
  set templ.B {WIDTH=12}
  set templ.C {TYPE="STRING",WIDTH=12}

  ! first row does not have a column C, so it should never be displayed unless in a template
  set t:myTable {}
  set myTable.ROW1 {A="A1",B="B1"}
  set myTable.ROW2 {A="A2",B="B2",C="C2"}
  set myTable.ROW3 {A="A3",C="C3"}

  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 19 /title
      
      gcontrol button myButt "" "Add Row"
      
      info "It is expected to see several INFO messages below this one. "
      list2/id=toplist/msgid=main myTable template=templ
      list2/id=botlist/msgid=main myTable 
      
  pipe off

endmacro


procedure processMessage m:msg
  if msg.name EQS "MAIN" then
    assert/text="^reg.main.name: user indicated" msg.data eqs "PASS"
    pipe stop
  
  elseif msg.name eqs "MYBUTT" then
    set reg.toplist.addRow {A="Apple",B="Banana",C="Cupcake"}
    set reg.botlist.addRow {A="Apple",B="Banana",C="ERROR:SHOULD NOT SEE THIS"}
  endif
  
return
