[pywin32-checkins] pywin32/com/win32comext/directsound/test ds_test.py, 1.4.4.2, 1.4.4.3
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
|
From: Mark H. <mha...@us...> - 2009-01-14 13:03:02
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/directsound/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4460/com/win32comext/directsound/test Modified Files: Tag: py3k ds_test.py Log Message: merge lots of changes from the trunk Index: ds_test.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/directsound/test/ds_test.py,v retrieving revision 1.4.4.2 retrieving revision 1.4.4.3 diff -C2 -d -r1.4.4.2 -r1.4.4.3 *** ds_test.py 13 Sep 2008 16:14:24 -0000 1.4.4.2 --- ds_test.py 14 Jan 2009 12:42:03 -0000 1.4.4.3 *************** *** 6,9 **** --- 6,10 ---- import win32event, win32api import os + from pywin32_testutil import str2bytes, TestSkipped import win32com.directsound.directsound as ds # next two lines are for for debugging: *************** *** 19,26 **** = struct.unpack('<4sl4s4slhhllhh4sl', data) ! if riff != b'RIFF': raise ValueError('invalid wav header') ! if fmtsize != 16 or fmt != b'fmt ' or data != b'data': # fmt chuck is not first chunk, directly followed by data chuck # It is nowhere required that they are, it is just very common --- 20,27 ---- = struct.unpack('<4sl4s4slhhllhh4sl', data) ! if riff != str2bytes('RIFF'): raise ValueError('invalid wav header') ! if fmtsize != 16 or fmt != str2bytes('fmt ') or str2bytes(data) != 'data': # fmt chuck is not first chunk, directly followed by data chuck # It is nowhere required that they are, it is just very common *************** *** 262,266 **** def testPlay(self): '''Mesdames et Messieurs, la cour de Devin Dazzle''' ! fname=os.path.join(os.path.dirname(sys.argv[0]), "01-Intro.wav") f = open(fname, 'rb') hdr = f.read(WAV_HEADER_SIZE) --- 263,282 ---- def testPlay(self): '''Mesdames et Messieurs, la cour de Devin Dazzle''' ! # look for the test file in various places ! candidates = [ ! os.path.dirname(__file__), ! os.path.dirname(sys.argv[0]), ! # relative to 'testall.py' in the win32com test suite. ! os.path.join(os.path.dirname(sys.argv[0]), ! '../../win32comext/directsound/test'), ! '.', ! ] ! for candidate in candidates: ! fname=os.path.join(candidate, "01-Intro.wav") ! if os.path.isfile(fname): ! break ! else: ! raise TestSkipped("Can't find test .wav file to play") ! f = open(fname, 'rb') hdr = f.read(WAV_HEADER_SIZE) |