07-13-2010, 03:13 PM
(This post was last modified: 07-13-2010, 03:15 PM by sasmitakumari.)
I had gone through this site and still since unable to capture the tool tip as my AUT is a Java Application and have embedded Java Applet and Swing features. And tool tip of it could not be captured as simple as like that. So I have followed bitmap file comparison.
This is only for reference, NOT a question to other.
Ex:
This is only for reference, NOT a question to other.
Ex:
Code:
Set objParent = JavaWindow("XXX")
objTest = fngetWithParentJavaApplet(objParent,"JavaObject","tagname","SchemaViewComponent")
objTest1 = fnGetOthrChldObjOfJavaApplet(objTest(0),"JavaObject","tagname","JToolTip")
If Not IsEmpty(objTest1(0)) Then
objTest1(0).CaptureBitmap "C:\TempToolTip.bmp",True
wait 2
If comparebitmap("C:\TempToolTip.bmp","<expected bitmap file>") Then
Reporter.ReportEvent micPass,"Comparing Tooltip bitmap", "Actual Tool tip bmp matches with expected bmp"
Else
Reporter.ReportEvent micFail,"Comparing Tooltip bitmap", "Actual Tool tip bmp does NOT match with expected bmp"
End If
Else
Reporter.ReportEvent micFail,"Capturing Tooltip","Failed to open tooltip for SIDCommon domain schema"
End If
function comparebitmap(actualbmp, expectedbmp)
set fcomapre = createobject( "mercury.filecompare" )
if fcomapre.isequalbin(actualbmp, expectedbmp, 0, 1) Then
comparebitmap = true
else
comparebitmap = false
end if
End Function
'Gets the Child the child object whose property has been passed as parameter and the
'associated parent Applet
Public Function fngetWithParentJavaApplet(pObjParJavaWin,pStrChldObj,pStrProp,pStrVal)
Dim Desc,Lists,i
Dim Desc1,Lists1,j
Dim obja(1)
Dim arrProp
Dim arrPropVal
Dim boolMatchProp,k
arrProp = Split(pStrProp,";")
arrPropVal = Split(pStrVal,";")
Set Desc = Description.Create()
Desc("Class Name").Value = "JavaApplet"
Set Lists =pObjParJavaWin.ChildObjects(Desc)
wait 2
For i = 0 To Lists.Count - 1
Set Desc1 = Description.Create()
Desc1("Class Name").Value = pStrChldObj
Set Lists1 =Lists(i).ChildObjects(Desc1)
wait 2
If Lists1.Count <>0 Then
For j = 0 to Lists1.Count -1
boolMatchProp = False
For k = 0 to Ubound(arrProp)
If Lists1(j).getROProperty(arrProp(k)) = arrPropVal(k) Then
If k = 0 Then
boolMatchProp = True
Else
boolMatchProp = True and boolMatchProp
End If
Else
boolMatchProp = False
End If
Next
If boolMatchProp = True Then
' If Lists1(j).getROProperty(pStrProp) =pStrVal Then
Set obja(0) = Lists(i)
Set obja(1) = Lists1(j)
fngetWithParentJavaApplet = obja
wait 2
Exit Function
End If
Next
End If
Next
fngetWithParentJavaApplet = obja
End Function 'fngetWithParentJavaApplet
'To get other child object of the parent JavaApplet
Function fnGetOthrChldObjOfJavaApplet(pObjParJApplet,pStrChldObj,pStrProp,pStrVal)
Dim Desc,Lists,i
Dim obja(1)
Dim arrProp
Dim arrPropVal
Dim boolMatchProp,j
arrProp = Split(pStrProp,";")
arrPropVal = Split(pStrVal,";")
Set Desc = Description.Create()
Desc("Class Name").Value = pStrChldObj
Set Lists =pObjParJApplet.ChildObjects(Desc)
wait 2
If Lists.Count <>0 Then
For i = 0 to Lists.Count -1
boolMatchProp = False
For j = 0 to Ubound(arrProp)
If Lists(i).getROProperty(arrProp(j)) = arrPropVal(j) Then
If j = 0 Then
boolMatchProp = True
Else
boolMatchProp = True and boolMatchProp
End If
Else
boolMatchProp = False
End If
Next
If boolMatchProp = True Then
Set obja(0) = Lists(i)
fnGetOthrChldObjOfJavaApplet = obja
wait 2
Exit Function
End If
Next
End If
fnGetOthrChldObjOfJavaApplet = obja
End Function 'fnGetOthrChldObjOfJavaApplet