ImageComparer.Compare Method (Image, Image, List<ToleranceRectangle>, Image%)

Compares specific regions of two images by the area specified by tolerance rectangles.

Returns true if the image difference is within tolerance, and computes the margin by which tolerance is missed as a diff image.

Namespace:  Microsoft.VisualStudio.TestTools.UITesting
Assembly:  Microsoft.VisualStudio.TestTools.UITesting (in Microsoft.VisualStudio.TestTools.UITesting.dll)

Syntax

'Declaration
Public Shared Function Compare ( _
    actualImage As Image, _
    expectedImage As Image, _
    rectangleList As List(Of ToleranceRectangle), _
    <OutAttribute> ByRef diffImage As Image _
) As Boolean
public static bool Compare(
    Image actualImage,
    Image expectedImage,
    List<ToleranceRectangle> rectangleList,
    out Image diffImage
)
public:
static bool Compare(
    Image^ actualImage, 
    Image^ expectedImage, 
    List<ToleranceRectangle>^ rectangleList, 
    [OutAttribute] Image^% diffImage
)
static member Compare : 
        actualImage:Image * 
        expectedImage:Image * 
        rectangleList:List<ToleranceRectangle> * 
        diffImage:Image byref -> bool
public static function Compare(
    actualImage : Image, 
    expectedImage : Image, 
    rectangleList : List<ToleranceRectangle>, 
    diffImage : Image
) : boolean

Parameters

  • actualImage
    Type: Image

    Actual image.

  • expectedImage
    Type: Image

    Expected image.

  • rectangleList
    Type: List<ToleranceRectangle>

    List of tolerance rectangles indicating area to compare and tolerance value.

  • diffImage
    Type: Image%

    An image whose argb values represent the margin by which tolerance has been missed.

Return Value

Type: Boolean
True if the two images meet to values specified in tolerance rectangles.

.NET Framework Security

See Also

Reference

ImageComparer Class

Compare Overload

Microsoft.VisualStudio.TestTools.UITesting Namespace