I am testing a CAD application. Here I am facing problem in recognizing the state of a pin button. Refer attached images for pin button and two state of this button ( Pin button is used to pin dialog so that it does not close on clicking on OK and reappears with initial state. )
Test complete does not give state of this Pin button. i.e. if button is in pin or unpin.
So thought will compare images of both these state to know if button is pinned or unpinned.
I cannot directly compare image of state with either pin or unpin image as test will be running on different machines with different resolutions, on each machine image of respective state will vary slightly.
Requirement is to compare current state of button on a particular machine with already saved pin and unpin image. Get how much current state image differs from saved pin and unpin images. One which gives minimum difference will indicate state of button.
Retrieving the amount of red is a similar process. You're going to loop through each pixel in the image and if the pixel color is red, increment a red counter. It's not elegant, but it'll get the job done.
I think your best bet is to test for blue or gray.