[1.1.0] Images with same name but in different tab are wrong
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SikuliX |
Opinion
|
High
|
RaiMan |
Bug Description
Using SikuliX 2014 1.1.0 nightly build 2014-12-09 on Windows 8.1 x64 with Java 1.7.0_72.
If you have two test drectories, e.g.:
- test_1.sikuli
- test_2.sikuli
and both tests contains an image with the same name, e.g. "test.png" and 0.99 similarity,
opening both tests with the Sikuli IDE, the image of the first loaded test will dominate in the IDE,
this means the image of the first test will also be shown in the second test tab.
Assume the first test "test_1.sikuli" fails, because it can not match the image on the screen,
running the second loaded test "test_2.sikuli" from the IDE will also fail,
although the image should be found on the screen.
I also noticed another strange behavior which might be affected by the same bug:
capturing and replacing an existing image in the current test won't be found on screen
(assume the image won't be found before capturing).
Here an example code for capturing and replacing an image:
import os, shutil
f = capture(Region(0, 0, 500, 400))
shutil.copy(f, os.path.
find(Pattern(
I hope my description was clear enough.
Changed in sikuli: | |
status: | New → Opinion |
importance: | Undecided → Medium |
importance: | Medium → High |
assignee: | nobody → RaiMan (raimund-hocke) |
summary: |
- [1.1.0-nightly] Images with same name but in different tab are wrong + [1.1.0] Images with same name but in different tab are wrong |
Changed in sikuli: | |
milestone: | none → 1.1.0 |
--- first case (same image name in different scripts)
I cannot reproduce this behaviour (at least on OS X 10.10) with the latest nightly (should not matter though):
# script 1 "test.png" ).exact( ) .highlight( 1)
img = Pattern(
find(img)
# script 2 "test.png" ).exact( ) .highlight( 1)
img = Pattern(
find(img)
- both opened in the IDE
- both test.png have different content
- image thumbs show correct content in each script
works as expected for me.
So please more details / concrete example.
--- second case (inline replace of existing image)
this is clear:
In version 1.1.0 we have an image cache, so when using an image again, it is loaded from memory and not again from file.
Since your approach is hidden to SikuliX (I do not check for external changes of the image file), after the replace of the file, the old memory content is still taken.
To avoid this effect, you either have to switch off image caching from the beginning setImageCache( 0) # is 64 MB otherwise
Settings.
or say
Image.reset()
after your external replace (which will clear the cache, so caching starts all over again after that)
I am sorry, but I have not yet textually documented all aspects of version 1.1.0 at sikulix- 2014.readthedoc s.org/en/ latest/ index.html
http://
... but to get information about classes like Image and their methods you might have a look into the nightly javadocs: nightly. sikuli. de/docs/ index.html
http://
For version 1.2, I will revise the Image handling again and will allow, to replace a cached image with captured content including save to an image file.