Regions.CreateRegionInfo Method

Applies to TestComplete 15.44, last modified on November 10, 2022

Description

Creates a RegionInfo object that corresponds to a rectangular area of the specified tested object. Use the resulting RegionInfo object to compare a specific area of the tested object with a stored baseline image. For more information on image comparison, see About Region Checkpoints.

Declaration

Regions.CreateRegionInfo(AObject, ClientX, ClientY, Width, Height, Mouse)

AObject [in]    Required    Variant    
ClientX [in]    Required    Integer    
ClientY [in]    Required    Integer    
Width [in]    Required    Integer    
Height [in]    Required    Integer    
Mouse [in]    Optional    Boolean Default value: True   
Result A RegionInfo object

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

AObject

Specifies the name of the object whose rectangular area you want to obtain.

ClientX

Specifies the horizontal coordinate of the top-left corner of the rectangular area.

ClientY

Specifies the vertical coordinate of the top-left corner of the rectangular area.

Width

Specifies the width of the rectangular area.

Height

Specifies the height of the rectangular area.

Mouse

Specifies whether the captured image of the specified area will contain the mouse pointer. The default value is True, which means that the image will contain the mouse pointer.

Result Value

The RegionInfo object that represents the specified rectangular area of the object.

Remarks

To capture the image of the specified rectangular area, use the Picture method of the RegionInfo object.

If a region checkpoint compares a baseline image with the tested object’s rectangular area specified by the RegionInfo object, it performs comparison until the actual rectangular area matches the baseline image or until the timeout period specified by the Auto-wait timeout setting elapses. If a region checkpoint compares a baseline image with the Picture object, it returns the comparison results immediately.

Example

The routine below demonstrates how to use the RegionInfo object to specify the area of the tested application and compare the area with the baseline image stored in the project’s Regions collection:

JavaScript, JScript

function Test()
{

  // Specifies the window's region to be verified
  var reg = Regions.CreateRegionInfo(Sys.Process("TestedApp").Window("Main", "*"), 0, 0, 100, 150, false);
  // Compares the wndMain Stores item with the image of the specified region
  Regions.wndMain.Check(reg);

}

Python

def Test():
  # Specifies the window's region to be verified 
  reg = Regions.CreateRegionInfo(Sys.Process("TestedApp").Window("Main", "*"), 0, 0, 100, 150, False)
  # Compares the wndMain Stores item with the image of the specified region 
  Regions.wndMain.Check(reg)

VBScript

Sub Test

  ' Specifies the window's region to be verified
  Set reg = Regions.CreateRegionInfo(Sys.Process("TestedApp").Window("Main", "*"), 0, 0, 100, 150, false)
  ' Compares the wndMain Stores item with the image of the specified region
  Regions.wndMain.Check(reg)

End Sub

DelphiScript

procedure Test();
var reg: OleVariant;
begin

  // Specifies the window's region to be verified
  reg := Regions.CreateRegionInfo(Sys.Process('TestedApp').Window('Main', '*'), 0, 0, 100, 150, false);
  // Compares the wndMain Stores item with the image of the specified region
  Regions.wndMain.Check(reg);

end;

C++Script, C#Script

function Test()
{

  // Specifies the window's region to be verified
  var reg = Regions["CreateRegionInfo"](Sys["Process"]("TestedApp")["Window"]("Main", "*"), 0, 0, 100, 150, false);
  // Compares the wndMain Stores item with the image of the specified region
  Regions["wndMain"]["Check"](reg);

}

See Also

Regions Object
Region Object
Check Method
About Region Checkpoints

Highlight search results