Regions.Compare with Masks
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Solved! Go to Solution.
- Labels:
-
Checkpoints
-
Scripting
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
[Hall of Fame]
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
Vegas Thrill Rider
Extensions available
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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)){
....
}
