[1.1.4] Java API: Pattern(missingFile) does not work as expected (throws FindFailed)

Asked by Paul Chambre on 2018-09-18

I'm trying to create some test automation for a plotting utility. Basically, I'd like Sikuli to drive the UI of the app to produce some charts, and I'd then like it to match the charts to some expected screen shots to verify that they are rendered correctly.

For small pngs, like buttons and menu items, things work well, but for large pngs I am having a hard time matching.

One example is a plot 1469x372 on a 1920x1080 display. I have just taken a fresh screen shot from the app, saved as a PNG, but when I use wait(myPattern, 10) to try to verify that the plot is actually displayed, I get FindFailed. This is all using the Java API.

So far, I had been trying this with three plots in three tabs of the application. I had taken screen shots from one version of the app and verified functionality; then switched to a different version and tried again.

With the new version, the first plot image matched, but the second one failed. The png opened in a viewer looked identical to me when lined up next to the application itself, but it would consistently fail with the new version... so I took another screen shot and tried to match that, and it succeeded... OK...

The third plot also failed to match against the new version, so I added a loop and tried reducing similarity until I got a match. I got a match at similiarity 0.68. OK. However, when I deliberately altered the plot by multiplying its values by 1.2, I still got a match at 0.68., so that's no good.

Then I took a fresh screen shot of the new version's 3rd chart and tried to match that with exact(). It failed to match. Then I tried to match it with default (0.70). That failed. Then I tried my loop... I got no match, even down to 0.01, it still failed to match. And yet it is a screen shot of the exact same version with the exact same chart and exact same data.

Is there a problem using PNG? Should I use some other format for the pattern files?

This is on OSX, BTW, with a Java 1.8 Swing app.

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Solved by:
Paul Chambre
Last query:
Last reply:
Paul Chambre (pchambredh) said : #1

Turns out that, apparently, the Pattern creator doesn't throw an exception if you pass the name of a file that doesn't exist.

I had a typo in my file name, so I was getting some sort of null or empty Pattern that, of course, wouldn't match at any similarity.

RaiMan (raimund-hocke) said : #2

--- the Pattern creator doesn't throw an exception if you pass the name of a file that doesn't exist.
thanks for the info - I have to check