back to nexaweb
search
Close source view

  1. ' get the menu bar object
  2. Set appObj = Browser("Welcome To Nexaweb").Page("Welcome To Nexaweb").JavaApplet("DefaultJvmDetector").Object.getScriptObject()
  3.  
  4. ' get the tabpane
  5. Set tabPaneObj = appObj.findObject( "//tabPane" )
  6.  
  7. ' get the number of tabs in the tabpane
  8. tabCount = tabPaneObj.getTabCount()
  9.  
  10. ' verify the number of tabs in the tabpane to be 3
  11. if( tabCount <>3 ) then
  12.     failString = "Expected tab count was 3.   Actual tab count was " + CStr( tabCount )
  13.     Reporter.ReportEvent micFail,"Tab Count",  failString
  14. Else
  15.     Reporter.ReportEvent micPass,"Tab Count",  "Got expected tab count 3"
  16. End If
  17.  
  18.  
  19. ' get the tabs as a vector
  20. Set tabVector = tabPaneObj.getTabs()
  21.  
  22. ' test the text of the first tab
  23. Set tabObj = tabVector.elementAt( 0 )
  24. tabText = tabObj.getText()
  25. if( tabText <> "Tab 1" ) then
  26.     Reporter.ReportEvent micFail,"Tab 1 Text",  "Expected text to be 'Tab1'  Actual text was " + tabText
  27. Else
  28.     Reporter.ReportEvent micPass,"Tab 1 Text",  "Got expected text "+tabText
  29. End If
  30.  
  31. ' test the text of the second tab
  32. Set tabObj = tabVector.elementAt( 1 )
  33. tabText = tabObj.getText()
  34. if( tabText <> "Tab 2" ) then
  35.     Reporter.ReportEvent micFail,"Tab 2 Text",  "Expected text to be 'Tab2'  Actual text was " + tabText
  36. Else
  37.     Reporter.ReportEvent micPass,"Tab 2 Text",  "Got expected text "+tabText
  38. End If
  39.  
  40. ' test the text of the third tab
  41. Set tabObj = tabVector.elementAt( 2 )
  42. tabText = tabObj.getText()
  43. if( tabText <> "Tab 3" ) then
  44.     Reporter.ReportEvent micFail,"Tab 2 Text",  "Expected text to be 'Tab3'  Actual text was " + tabText
  45. Else
  46.     Reporter.ReportEvent micPass,"Tab 2 Text",  "Got expected text "+tabText
  47. End If
  48.  
  49.  
  50.  
  51. ' select the second tab
  52. tabPaneObj.selectTab( 1 )
  53.  
  54. ' verify that the selected tab was the second tab
  55. Set tabObj = tabPaneObj.getSelectedTab()
  56. tabText = tabObj.getText()
  57. if( tabText <> "Tab 2" ) then
  58.     Reporter.ReportEvent micFail,"Selected Tab Text",  "Expected text to be 'Tab2'  Actual text was " + tabText
  59. Else
  60.     Reporter.ReportEvent micPass,"Selected Tab Text",  "Got expected text "+tabText
  61. End If
  62.  
  63. ' get the contents of the tab
  64. Set content = tabObj.getView()
  65. objCount = content.getChildObjectCount()
  66.  
  67. ' verify the number of objects that make up the tab
  68. if( objCount <> 5 ) then
  69.     failString = "Expected object count was 5.   Actual tab count was " + CStr( objCount )
  70.     Reporter.ReportEvent micFail,"Tab View Object Count",  failString
  71. Else
  72.     Reporter.ReportEvent micPass,"Tab View Object Count",  "Got expected tab count 5"
  73. End If
  74.  
  75. ' verify the text of the first object in the tab
  76. Set labelObj = content.getChildObjectAt( 0 )
  77. labelText = labelObj.getText()
  78. if( labelText <> "Tab 2 Child 1" ) then
  79.     Reporter.ReportEvent micFail,"Child 1 Text",  "Expected text to be 'Tab 2 Child 1'  Actual text was " + labelText
  80. Else
  81.     Reporter.ReportEvent micPass,"Child 1 Text",  "Got expected text "+labelText
  82. End If
  83.  
  84. ' verify the text of the second object in the tab
  85. Set labelObj = content.getChildObjectAt( 1 )
  86. labelText = labelObj.getText()
  87. if(labelText <> "Tab 2 Child 2" ) then
  88.     Reporter.ReportEvent micFail,"Child 2 Text",  "Expected text to be 'Tab 2 Child 2'  Actual text was " + labelText
  89. Else
  90.     Reporter.ReportEvent micPass,"Child 2 Text",  "Got expected text "+labelText
  91. End If
  92.  
  93.  
  94. ' verify the text of the third object in the tab
  95. Set labelObj = content.getChildObjectAt( 2 )
  96. labelText = labelObj.getText()
  97. if( labelText <> "Tab 2 Child 3" ) then
  98.     Reporter.ReportEvent micFail,"Child 3 Text",  "Expected text to be 'Tab2 Child 3'  Actual text was " + labelText
  99. Else
  100.     Reporter.ReportEvent micPass,"Child 3 Text",  "Got expected text "+labelText
  101. End If
  102.  
  103.  
  104. ' verify the text of the fourth object in the tab
  105. Set labelObj = content.getChildObjectAt( 3 )
  106. labelText = labelObj.getText()
  107. if( labelText <> "Tab 2 Child 4" ) then
  108.     Reporter.ReportEvent micFail,"Child 4 Text",  "Expected text to be 'Tab2 Child 4'  Actual text was " + labelText
  109. Else
  110.     Reporter.ReportEvent micPass,"Child 4 Text",  "Got expected text "+labelText
  111. End If
  112.  
  113.  
  114. ' verify the text of the fifith object in the tab
  115. Set labelObj = content.getChildObjectAt( 4 )
  116. labelText = labelObj.getText()
  117. if( labelText <> "Tab 2 Child 5" ) then
  118.     Reporter.ReportEvent micFail,"Child 5 Text",  "Expected text to be 'Tab2 Child 5'  Actual text was " + labelText
  119. Else
  120.     Reporter.ReportEvent micPass,"Child 5 Text",  "Got expected text "+labelText
  121. End If
  122.  
  123.  
  124.  
  125. ' select the third tab
  126. tabPaneObj.selectTab( 2 )
  127.  
  128. ' verify that the selected tab was the second tab
  129. Set tabObj = tabPaneObj.getSelectedTab()
  130. tabText = tabObj.getText()
  131. if( tabText <> "Tab 3" ) then
  132.     Reporter.ReportEvent micFail,"Selected Tab Text",  "Expected text to be 'Tab 3'  Actual text was " + tabText
  133. Else
  134.     Reporter.ReportEvent micPass,"Selected Tab Text",  "Got expected text "+tabText
  135. End If
  136.  
  137. ' get the contents of the tab
  138. Set content = tabObj.getView()
  139.  
  140. ' verify the conent of the first tab
  141. labelText = content.getText()
  142. if( labelText <> "third tab" ) then
  143.     Reporter.ReportEvent micFail,"Tab 3 Content",  "Expected text to be 'third tab'  Actual text was " + labelText
  144. Else
  145.     Reporter.ReportEvent micPass,"Tab 3 Content",  "Got expected text "+labelText
  146. End If
  147.  

© Copyright 2005-2008 Nexaweb Technologies Inc. All Rights Reserved.