[TechCorner Challenge #12] Compare images using the Region Checkpoint
Hi TestComplete Community!
Dare to take the challenge?🙂
By completing the tasks, you can practice your skills of working with TestComplete features and also get into the TechCorner Leaderboard!
Task: Compare the two images below using TC Region Checkpoint ...and reveal a secret message! Post the message and the script to the comments.
Difficulty:
Steps to do this:
1. Add the images below to the Regions collection.
2. Perform a pixel-by-pixel comparison using the Check method.
3. Click the “View Comparison Result” button in the log to reveal the secret message and post it along with your script to the comments!
Images to compare:
Have fun and good luck😊
Task: Compare the two images below using TC Region Checkpoint ...and reveal a secret message! Post the message and the script to the comments.
This is a solution created for [TechCorner Challenge #12]
Secret message:
function Test()
{
var pic2 = Utils.Picture;
pic2.LoadFromFile('D:\\img2.png');
Regions.img1_png.Check(pic2, false, false, 1, 1);
}
Result:
Click here to show or modify data of the checkpoint "img1_png".
The images are not equal.
The pixel difference is 1 %.
The color difference is 20 %.
There is a slight difference between the compared images. If you want the checkpoint to report them as equal, set its Pixel Tolerance parameter to 277.
Update the "img1_png" checkpoint data.Task: Compare the two images below using TC Region Checkpoint ...and reveal a secret message! Post the message and the script to the comments.
This is a solution created for [TechCorner Challenge #12]
[DelphiScript]
procedure comparingPictures();
begin
if Not Regions.img1_png.Check('img2_png') then
Log.Message('Differ')
end;
Project Explorer:
Workspace
Results