'**********************************************************************************
'Function: CompareBitmap
'Paremeter:
' obj - instant of window
'fileExp- the file of the expected bmpfile with the whole path
'Note:
' this function is usted to compare the expected bmpfile with the current window (this feature can't do by QTP checkpoint)
' Modification history :
' Sr Date Modified By Why & What is modified
' 1. 2006.7.12 Anson new
' 2. 2006.7.17 anson modify HTML foramt of report
'******************************************************************************
Public Function CompareBitmap (obj, fileExp)
Dim oCompareUtil, fileAct
' Temporary file for storing the current object bitmap
fileAct = environment("ResultDir") & "\" & CStr(RandomNumber (1,10000)) & ".bmp"
obj.CaptureBitmap fileAct, TRUE
' Create a Compare Util Object
Set oCompareUtil = CreateObject("Mercury.FileCompare")
' Compare and Report results
IF oCompareUtil.IsEqualBin(fileExp, fileAct, 0, 1) then
Reporter.ReportEvent micPass, "Bitmap Check", "Expected bitmap file: " & fileExp & " matched the actual object bitmap "
CompareBitmap = TRUE
ELSE
Reporter.ReportEvent micFail, "Bitmap Check", "Expected bitmap file: " & fileExp & " did not match the actual object bitmap "
'Output expected bitmap to results
Reporter.ReportEvent micDone,"Expected bitmap:","<<TABLE><TR><TD><img src='" & fileExp & "'></TD><TD>" & "<img src='" & fileAct & "'></TD></TR></TABLE>>"
'Output actual bitmap to results
' reporter.ReportEvent micDone,"Actual bitmap:","<<img src='" & fileAct & "'>>"
CompareBitmap = FALSE
END IF
End Function