Update the changelog
[opencv] / tests / python / highgui / cvGetWindowHandleName.py
1 #! /usr/bin/env python
2 """
3 This script will test highgui's window handle/name functionality
4 """
5
6 # name of this test and it's requirements
7 TESTNAME = "cvGetWindowHandleName"
8 REQUIRED = ["cvNamedWindow"]
9
10  
11 # needed for sys.exit(int) and .works file handling
12 import sys
13 import works
14
15 # check requirements and delete old flag file, if it exists
16 if not works.check_files(REQUIRED,TESTNAME):
17         sys.exit(77)
18
19 # import the necessary things for OpenCV
20 import python
21 from python.highgui import *
22 from python.cv import *
23
24
25 # some definitions
26 win_name = "testing..."
27
28 # create a window ( 'cvNamedWindow.works' says: "Ok, go for it!" )
29 cvNamedWindow(win_name,CV_WINDOW_AUTOSIZE)
30
31 # check if the window handle and the according name are correct
32 win_name_2 = cvGetWindowName( cvGetWindowHandle(win_name) )
33 if win_name_2!=win_name:
34 #       print "(ERROR) Incorrect window handle/name."
35         sys.exit(1)
36
37 # destroy the window
38 cvDestroyWindow( win_name )
39
40 # create flag file for following tests
41 works.set_file(TESTNAME)
42
43 # return 0 ('PASS')
44 sys.exit(0)