Update the trunk to the OpenCV's CVS (2008-07-14)
[opencv] / tests / python / highgui / cvNamedWindow.py
1 #! /usr/bin/env python
2 """
3 This script will test highgui's window functionality
4 """
5
6 # name of this test and it's requirements
7 TESTNAME = "cvNamedWindow"
8 REQUIRED = []
9
10 # needed for sys.exit(int) and .works file handling
11 import sys
12 import works
13
14 # check requirements and delete flag file if it exists
15 if not works.check_files( REQUIRED, TESTNAME ):
16         sys.exit(77)
17
18
19 # import the necessary things for OpenCV
20 import python
21 from python.highgui import *
22 from python.cv import *
23
24 # some definitions
25 win_name = "testing..."
26
27 # create a window and save return code
28 res = cvNamedWindow(win_name,CV_WINDOW_AUTOSIZE)
29
30 # if returncode is ok, window creation was sucessful
31 if res == 0:
32         # something went wrong, so return an errorcode
33         sys.exit(1)
34
35 # destroy the window
36 cvDestroyWindow( win_name )
37
38 # create flag file for following tests
39 works.set_file(TESTNAME)
40
41 # return 0 ('PASS')
42 sys.exit(0)