3 This script will test highgui's cvWaitKey(int) function
6 # name of this test and it's requirements
8 REQUIRED = ["cvShowImage"]
10 # needed for sys.exit(int) and .works file handling
15 # path to imagefiles we need
16 PREFIX=os.path.join(os.environ["srcdir"],"../../opencv_extra/testdata/python/images/")
18 # check requirements and delete old flag file, if it exists
19 if not works.check_files(REQUIRED, TESTNAME):
23 # import the necessary things for OpenCV
26 # request some user input
27 print "(INFO) Press anykey within the next 20 seconds to 'PASS' this test."
29 # create a dummy window which reacts on cvWaitKey()
30 cvNamedWindow(TESTNAME, CV_WINDOW_AUTOSIZE)
33 cvShowImage(TESTNAME, cvLoadImage(PREFIX+"cvWaitKey.jpg"))
35 # wait 20 seconds using cvWaitKey(20000),
36 # return 'FAIL' if no key has been pressed.
37 if cvWaitKey(20000) == -1:
38 print "(ERROR) No key pressed, remarking as 'FAIL'."
41 #create flag file for the following tests
42 works.set_file(TESTNAME)