Ask a Question

Use Image checkpoint to test for an empty region

SOLVED
DSmachineWorld
Contributor

Use Image checkpoint to test for an empty region

I have an area on my web page to test, which is basically a representation of a chart with a line overlay.

 

The curve of the line will vary, depending on the source data I am pulling into the web page, so I can't do an exact image map for the curve as a test. Really, all I care about is that there is a curve there, within a static defined rectangular region on the web page.

 

Is it possible for me to manually clean up a copy of this region with no line inside it, and do a test where, if it looks like this manually edited blank image, the test fails?

--
You might not like AI, but it doesn't care about you.
6 REPLIES 6
Marsha_R
Champion Level 2

What happened when you tried it?

I don't know how to do it...

--
You might not like AI, but it doesn't care about you.
tristaanogre
Esteemed Contributor

You're going to want to use the "Mask" feature of image comparison.  You're going to have a baseline object with a blank screen.  You're going to apply the mask.  If the result of the Compare method returns "false", then you have a curve in the region.  If it returns true, then the regions match meaning it's blank.

 

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


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

So can I add an edited picture with no curve to my project, and build the mask off that?

--
You might not like AI, but it doesn't care about you.

The picture without the curve is your "baseline".  The "mask" file is as separate image consisting only of white and black spaces, the white space being what you want to compare, the black being what you want to have ignored.


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

OK. I'll go search the help files and raise a ticket with support if necessary after I've played around with this. Thanks all.

--
You might not like AI, but it doesn't care about you.
cancel
Showing results for 
Search instead for 
Did you mean: