Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

349 lines
11 KiB

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "COMCTL32.OCX"
  3. Begin VB.Form frmTest
  4. Caption = "SDK BVT Tree"
  5. ClientHeight = 8910
  6. ClientLeft = 210
  7. ClientTop = 345
  8. ClientWidth = 8910
  9. Icon = "frmTest.frx":0000
  10. LinkTopic = "Form1"
  11. ScaleHeight = 8910
  12. ScaleWidth = 8910
  13. Begin ComctlLib.Toolbar Toolbar1
  14. Align = 1 'Align Top
  15. Height = 630
  16. Left = 0
  17. TabIndex = 1
  18. Top = 0
  19. Width = 8910
  20. _ExtentX = 15716
  21. _ExtentY = 1111
  22. ButtonWidth = 1296
  23. ButtonHeight = 953
  24. ToolTips = 0 'False
  25. AllowCustomize = 0 'False
  26. Appearance = 1
  27. ImageList = "ImageList1"
  28. _Version = 327682
  29. BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7}
  30. NumButtons = 6
  31. BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7}
  32. Caption = "Waiting"
  33. Key = "waiting"
  34. Object.Tag = ""
  35. ImageIndex = 1
  36. EndProperty
  37. BeginProperty Button2 {0713F354-850A-101B-AFC0-4210102A8DA7}
  38. Caption = "Running"
  39. Key = "running"
  40. Object.Tag = ""
  41. ImageIndex = 2
  42. EndProperty
  43. BeginProperty Button3 {0713F354-850A-101B-AFC0-4210102A8DA7}
  44. Caption = "Passed"
  45. Key = "passed"
  46. Object.Tag = ""
  47. ImageIndex = 3
  48. EndProperty
  49. BeginProperty Button4 {0713F354-850A-101B-AFC0-4210102A8DA7}
  50. Caption = "Failed"
  51. Key = "failed"
  52. Object.Tag = ""
  53. ImageIndex = 4
  54. EndProperty
  55. BeginProperty Button5 {0713F354-850A-101B-AFC0-4210102A8DA7}
  56. Caption = "Skipped"
  57. Key = "skipped"
  58. Object.Tag = ""
  59. ImageIndex = 5
  60. EndProperty
  61. BeginProperty Button6 {0713F354-850A-101B-AFC0-4210102A8DA7}
  62. Caption = "Not Impl."
  63. Key = "notimpl"
  64. Object.Tag = ""
  65. ImageIndex = 6
  66. EndProperty
  67. EndProperty
  68. End
  69. Begin ComctlLib.TreeView tvwTest
  70. Height = 5175
  71. Left = 60
  72. TabIndex = 0
  73. ToolTipText = "Double-click for extended status"
  74. Top = 660
  75. Width = 5655
  76. _ExtentX = 9975
  77. _ExtentY = 9128
  78. _Version = 327682
  79. Indentation = 423
  80. LabelEdit = 1
  81. LineStyle = 1
  82. Style = 7
  83. ImageList = "ImageList1"
  84. Appearance = 1
  85. End
  86. Begin ComctlLib.ImageList ImageList1
  87. Left = 5160
  88. Top = 5880
  89. _ExtentX = 1005
  90. _ExtentY = 1005
  91. BackColor = -2147483643
  92. ImageWidth = 16
  93. ImageHeight = 16
  94. MaskColor = 12632256
  95. _Version = 327682
  96. BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7}
  97. NumListImages = 9
  98. BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
  99. Picture = "frmTest.frx":014A
  100. Key = ""
  101. EndProperty
  102. BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
  103. Picture = "frmTest.frx":0464
  104. Key = ""
  105. EndProperty
  106. BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
  107. Picture = "frmTest.frx":077E
  108. Key = ""
  109. EndProperty
  110. BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
  111. Picture = "frmTest.frx":0A98
  112. Key = ""
  113. EndProperty
  114. BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
  115. Picture = "frmTest.frx":0DB2
  116. Key = ""
  117. EndProperty
  118. BeginProperty ListImage6 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
  119. Picture = "frmTest.frx":10CC
  120. Key = ""
  121. EndProperty
  122. BeginProperty ListImage7 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
  123. Picture = "frmTest.frx":13E6
  124. Key = ""
  125. EndProperty
  126. BeginProperty ListImage8 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
  127. Picture = "frmTest.frx":1700
  128. Key = ""
  129. EndProperty
  130. BeginProperty ListImage9 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
  131. Picture = "frmTest.frx":1A1A
  132. Key = ""
  133. EndProperty
  134. EndProperty
  135. End
  136. End
  137. Attribute VB_Name = "frmTest"
  138. Attribute VB_GlobalNameSpace = False
  139. Attribute VB_Creatable = False
  140. Attribute VB_PredeclaredId = True
  141. Attribute VB_Exposed = False
  142. Option Explicit
  143. Private Sub Form_Resize()
  144. If Me.WindowState <> 1 Then
  145. tvwTest.Top = Toolbar1.Height
  146. tvwTest.Left = Me.ScaleLeft
  147. tvwTest.Width = Me.ScaleWidth
  148. If Me.ScaleHeight - Toolbar1.Height > 0 Then tvwTest.Height = Me.ScaleHeight - Toolbar1.Height
  149. End If
  150. End Sub
  151. Public Sub Run()
  152. Dim i As Integer
  153. Dim nummodules As Integer
  154. Dim Start As Variant
  155. Dim finish As Variant
  156. Start = Time
  157. nummodules = 0
  158. frmMain.txtServer.text = Trim(frmMain.txtServer.text)
  159. tvwTest.Nodes.Clear
  160. ClearTests
  161. tvwTest.Nodes.Add , , "root", "Final Result", 1
  162. 'call registernodes and registertests for all selected modules
  163. For i = 0 To frmMain.lstModules.ListCount - 1
  164. If frmMain.lstModules.Selected(i) Then
  165. nummodules = nummodules + 1
  166. Modules(frmMain.lstModules.List(i)).RegisterNodes
  167. Modules(frmMain.lstModules.List(i)).RegisterTests
  168. End If
  169. Next i
  170. If nummodules = 0 Then
  171. MsgBox "Nothing to do." & vbCrLf & "Please check a module or two!", vbCritical, "Where would you like to go today?"
  172. Exit Sub
  173. End If
  174. Me.Show
  175. Me.Refresh
  176. 'get the ball rolling
  177. tvwTest.Nodes("root").EnsureVisible
  178. TestNode "root"
  179. 'Me.Caption = "SDK BVT Completed"
  180. finish = Time
  181. BuildTextSummary Start, finish
  182. End Sub
  183. Public Sub AddNode(parent, key, text As String, Optional visible As Boolean = True)
  184. Dim n As Node
  185. Set n = tvwTest.Nodes.Add(parent, tvwChild, key, text, 1)
  186. If visible Then n.EnsureVisible
  187. End Sub
  188. Private Sub TestNode(key As String)
  189. DoEvents
  190. Dim this As Node
  191. Set this = tvwTest.Nodes(key)
  192. this.Image = 2
  193. If this.Children Then
  194. TestAllChildrenOf key
  195. Else
  196. 'this.EnsureVisible
  197. 'Set tvwTest.SelectedItem = this
  198. Select Case Modules(Tests(key)).Execute(this)
  199. Case 0
  200. If this.Tag = "" Then this.Image = 4 Else this.Image = 8
  201. Case 1
  202. If this.Tag = "" Then this.Image = 3 Else this.Image = 7
  203. Case 2
  204. If this.Tag = "" Then this.Image = 5 Else this.Image = 9
  205. Case 3
  206. this.Image = 6
  207. End Select
  208. End If
  209. End Sub
  210. Private Sub TestAllChildrenOf(key As String)
  211. Dim this As Node
  212. Dim that As Node
  213. Dim skips As Integer
  214. Dim Fails As Integer
  215. Dim nimps As Integer
  216. Set this = tvwTest.Nodes(key)
  217. Set that = this.Child
  218. Do
  219. DoEvents
  220. TestNode that.key
  221. Set that = that.Next
  222. Loop Until that Is Nothing
  223. skips = 0
  224. Fails = 0
  225. Set that = this.Child
  226. Do
  227. DoEvents
  228. If that.Image = 4 Or that.Image = 8 Then Fails = Fails + 1
  229. If that.Image = 5 Or that.Image = 9 Then skips = skips + 1
  230. If that.Image = 6 Then nimps = nimps + 1
  231. Set that = that.Next
  232. Loop Until that Is Nothing
  233. If Fails > 0 Then
  234. this.Image = 4
  235. Else
  236. If skips > 0 Then
  237. this.Image = 5
  238. Else
  239. If nimps = this.Children Then
  240. this.Image = 6
  241. Else
  242. this.Image = 3
  243. End If
  244. End If
  245. End If
  246. End Sub
  247. Public Function AllOfThesePassed(ParamArray keys()) As Boolean
  248. 'only returns true if all suppied keys resulted in "passed"
  249. Dim i As Integer
  250. AllOfThesePassed = True
  251. For i = LBound(keys) To UBound(keys)
  252. If tvwTest.Nodes(keys(i)).Image <> 3 And tvwTest.Nodes(keys(i)).Image <> 7 Then
  253. AllOfThesePassed = False
  254. Exit Function
  255. End If
  256. Next i
  257. End Function
  258. Private Sub tvwTest_DblClick()
  259. If Not tvwTest.SelectedItem Is Nothing Then
  260. If tvwTest.SelectedItem.Tag <> "" Then
  261. Dim f As New frmObjText
  262. f.txtMain.text = tvwTest.SelectedItem.Tag
  263. f.Caption = tvwTest.SelectedItem.FullPath
  264. f.Show
  265. End If
  266. If tvwTest.SelectedItem.key = "root" Then tvwTest.SelectedItem.Expanded = Not tvwTest.SelectedItem.Expanded
  267. End If
  268. End Sub
  269. Private Sub BuildTextSummary(Start As Variant, finish As Variant)
  270. Dim s As String
  271. Dim n As Node
  272. s = s & "Start Time: " & Start & vbCrLf
  273. s = s & "Finish Time: " & finish & vbCrLf & vbCrLf
  274. For Each n In tvwTest.Nodes
  275. s = s & "Node [" & n.FullPath & "]" & vbCrLf
  276. s = s & "Nodekey [" & n.key & "]" & vbCrLf
  277. s = s & "Result ["
  278. Select Case n.Image
  279. Case 3, 7
  280. s = s & "PASSED]" & vbCrLf
  281. Case 4, 8
  282. s = s & " *** FAILED *** ]" & vbCrLf
  283. Case 5, 9
  284. s = s & "Skipped]" & vbCrLf
  285. Case 6
  286. s = s & "Not-Implemented]" & vbCrLf
  287. Case Else
  288. s = s & "this shouldn't happen]" & vbCrLf
  289. End Select
  290. If n.Image = 8 And Len(n.Tag) > 2 Then
  291. s = s & "------- [Extended] ----------------------------------" & vbCrLf
  292. s = s & n.Tag & vbCrLf
  293. s = s & "-----------------------------------------------------" & vbCrLf
  294. End If
  295. s = s & vbCrLf & vbCrLf
  296. Next n
  297. tvwTest.Nodes("root").Tag = s
  298. If tvwTest.Nodes("root").Tag <> "" Then
  299. If tvwTest.Nodes("root").Image = 3 Then tvwTest.Nodes("root").Image = 7
  300. If tvwTest.Nodes("root").Image = 4 Then tvwTest.Nodes("root").Image = 8
  301. If tvwTest.Nodes("root").Image = 5 Then tvwTest.Nodes("root").Image = 9
  302. End If
  303. Open "\bvtlog.txt" For Append As #1
  304. Print #1, s
  305. Close #1
  306. End Sub