cancel
Showing results for 
Search instead for 
Did you mean: 

Regions.Compare with Masks

SOLVED
Highlighted
New Contributor

Regions.Compare with Masks

I am using Regions.Compare method in an If condition for branching between two different scenarios based on the displayed window. I don't use Check because it takes a longer time to process and generates a log error that terminates the script. Is there any way to include masks while using Compare? or is there any other way to compare a region as a branching condition (not as a region checkpoint) and still be able to use masks?

2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Hero

Re: Regions.Compare with Masks

Well,first of all, I don't like having "Stop on error" set to true... I like to have more granular control over when my automation stops.  So, if turn that off, then Regions.Check would work for you.

 

You could go the route of Picture.Compare (https://support.smartbear.com/testcomplete/docs/reference/program-objects/picture/compare.html?q=Pic...)

 

It's a bit different than Region compare... you wouldn't have a stored region in the system, you'd be using an external picture file loaded in.  I use this freqently and does pretty well.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Contributor

Re: Regions.Compare with Masks

Hi, @ezzmonem 

 

Is it an option to use the Picture.Compare method?

Picture.Compare allows a mask to be used

 

https://support.smartbear.com/testcomplete/docs/reference/program-objects/picture/compare.html

 

In my scripts I use a combination of the picture.compare and region.compare method

===========================

if (!pic_1.Compare(pic_2, ............., maskImg))
{

 

Regions.Compare(pic_1, pic_2)


}

===========================

Regards,

Daniel

3 REPLIES 3
Community Hero

Re: Regions.Compare with Masks

Well,first of all, I don't like having "Stop on error" set to true... I like to have more granular control over when my automation stops.  So, if turn that off, then Regions.Check would work for you.

 

You could go the route of Picture.Compare (https://support.smartbear.com/testcomplete/docs/reference/program-objects/picture/compare.html?q=Pic...)

 

It's a bit different than Region compare... you wouldn't have a stored region in the system, you'd be using an external picture file loaded in.  I use this freqently and does pretty well.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Contributor

Re: Regions.Compare with Masks

Hi, @ezzmonem 

 

Is it an option to use the Picture.Compare method?

Picture.Compare allows a mask to be used

 

https://support.smartbear.com/testcomplete/docs/reference/program-objects/picture/compare.html

 

In my scripts I use a combination of the picture.compare and region.compare method

===========================

if (!pic_1.Compare(pic_2, ............., maskImg))
{

 

Regions.Compare(pic_1, pic_2)


}

===========================

Regards,

Daniel

New Contributor

Re: Regions.Compare with Masks

daniel_dewinter

 

Thank you for your help!

PictureObject.Compare worked fine with masks.

I implemented it this way:


var appRegion = Regions.CreateRegionInfo(
AObject, 0, 0, width, height, false);

var baselinePicture= Regions.GetPicture("baseline_1");
var baselineMask= Regions.GetPicture("baseline_1_Mask");

 

if(baselinePicture.Compare(appRegion .Picture(), false, 0, false, 0, baselineMask)){

....

}

 

New Here?
Join us and watch the welcome video:
SmartBear + Cucumber
Top Kudoed Authors