← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #288480]: Using observe() for region created via default argument

 

Question #288480 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/288480

    Status: Answered => Open

Evgen is still having a problem:
Thanks for answers, 
At first ive tried to stop observer using
observe_region.onChange(100, observe_region.stopObserver)
this doesnt work at all, observer is not react on any screen changes

Then ive tried to created real handler, but this was not helpful, both
of tests still reported as passed, event if no changes where made during
second test

Maybe some other ideas?


Lates code sample below:

import unittest

def someHadler(event):
    event.stopObserver()

def wait_load(observe_region=Region(399,25,1040,406)):
    observe_region.onChange(100, someHadler)
    observe_region.observe(20)

class SampleTest(unittest.TestCase):

    def test_one(self):
        wait(5)
        print('1st start')
        wait_load()
        assert True

    def test_two(self):
        wait(5)
        print('2nd start')
        wait_load()
        assert True

if __name__ == '__main__':
    runner = unittest.TextTestRunner(verbosity=2)
    SampleTestSuite = unittest.TestSuite(unittest.TestLoader().loadTestsFromTestCase(SampleTest))
    runner.run(SampleTestSuite)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.