Validate.CompareImage cropped?
Validate.CompareImage cropped?
Hi, I'm trying to validate an Element with an existing screenshot which is cropped. This results in that I have to crop the result image Validate.CompareImage takes. Currently I take a temporary snapshot and compare with that and then delete it, but I want to use Validate.CompareImage so it gets into the Report log. Got any ideas? Thanks.
Re: Validate.CompareImage cropped?
I don't really understand quite what you're asking here. Are you trying to log the uncropped image? You can use Report.LogData() to log any image you like:
Code: Select all
Report.LogData(ReportLevel.Info, "Image", bitmap);
Re: Validate.CompareImage cropped?
You can also specify the crop rect in the FindOptions:
Code: Select all
Rectangle clipping = new Rectangle(0, 0, width, height);
Ranorex.Imaging.FindOptions find_options = new Imaging.FindOptions(clipping);
Ranorex.Validate.CompareImage(some_repo_item, expected_bitmap_image, find_options);
Re: Validate.CompareImage cropped?
Thanks, didn't know about the FindOptions!