~ubuntu-branches/ubuntu/utopic/sikuli/utopic

« back to all changes in this revision

Viewing changes to sikuli-script/src/test/python/test_find.py

  • Committer: Bazaar Package Importer
  • Author(s): Gilles Filippini
  • Date: 2011-10-04 23:32:13 UTC
  • mfrom: (4.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20111004233213-36fm78hx0z53tkuw
Tags: 1.0~x~rc3-dfsg1-2
* New patch fix-cmake-sikuli-ide.patch:
  + Fix random FTBFS due to missing inter target dependency

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import unittest
 
2
from sikuli import *
 
3
from org.sikuli.script import JButtons
 
4
 
 
5
class TestFind(unittest.TestCase):
 
6
 
 
7
   @classmethod
 
8
   def setUpClass(cls):
 
9
      cls.btns = JButtons()
 
10
 
 
11
   @classmethod
 
12
   def tearDownClass(cls):
 
13
      cls.btns.dispose() 
 
14
 
 
15
   def _tryFindWrongPath(self):
 
16
      setThrowException(True)
 
17
      setAutoWaitTimeout(0.1)
 
18
      try:
 
19
         find("network.png")
 
20
         self.fail("the image shouldn't exist")
 
21
      except FindFailed,e:
 
22
         assert e != None
 
23
 
 
24
   def testBundlePath(self):
 
25
      self._tryFindWrongPath()
 
26
      setBundlePath("test-res/")
 
27
      assert find("network.png") != None
 
28
 
 
29
   def testSikuliImagePath(self):
 
30
      from java.lang import System
 
31
      setBundlePath("/")
 
32
      self._tryFindWrongPath()
 
33
      System.setProperty("SIKULI_IMAGE_PATH", "test-res")
 
34
      assert find("network.png") != None
 
35
 
 
36