Match for same pattern in same region passes then fails
Has anyone tried successive, identical pattern searches with Region.find() and had the first invocation pass and the next fail?
I am trying to use the Sikuli Java API to write JUnit tests.
Each test builds a simple JFrame GUI which contains a custom web browser component as its only content. The content pane is sized so that the browser component is 1000x500. The HTML in the browser does nothing but paint the background red.
A 1000x500 red rectangle is stored in a .png file and used to create a Pattern.
The first time I seek this Pattern in the Region of the application, I get an almost perfect match.
Seeking the same Pattern on the same Region again, however, throws a FindFailed exception.
I am using 64-bit Java 7 update 55 on Windows 7.
I saw this behavior first with Sikuli 1.0.1 (sikuli-ide.jar) and then again with the latest 1.1.0-Beta3 source downloaded from GitHub.
Here is the relevant code:
@Test
public void basicPatternMatch() {
Pattern p = new Pattern(
try {
Region r = app.getRegion(); // calls Region.create(x, y, w, h)
printRegi
Match m = r.find(p);
printMatc
m = r.find(p);
printMatc
} catch (FindFailed e) {
System.
junit.
}
}
Here is the console output:
-----------
Region at (300,300) is 1016 x 538
Match found at (309,331) of size 1000 x 500 with score 0.9999250173568726
can not find P(C:/Users/
-----------
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Jeff Cavill
- Solved:
- Last query:
- Last reply: