diff options
author | Zachary Ware <zachary.ware@gmail.com> | 2016-09-05 21:31:21 (GMT) |
---|---|---|
committer | Zachary Ware <zachary.ware@gmail.com> | 2016-09-05 21:31:21 (GMT) |
commit | ae8298bfb78eebc6c1bf914c89ec397121640a94 (patch) | |
tree | 848b6d5390ebab9d35a64322ce585f2dbafa2096 /Lib/test/test_winsound.py | |
parent | 0e76e67246b4e6e6bb15d04748f40ed96e405d5c (diff) | |
download | cpython-ae8298bfb78eebc6c1bf914c89ec397121640a94.zip cpython-ae8298bfb78eebc6c1bf914c89ec397121640a94.tar.gz cpython-ae8298bfb78eebc6c1bf914c89ec397121640a94.tar.bz2 |
Closes #11620: Fix support for SND_MEMORY in winsound.PlaySound.
Based on a patch by Tim Lesher.
Diffstat (limited to 'Lib/test/test_winsound.py')
-rw-r--r-- | Lib/test/test_winsound.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_winsound.py b/Lib/test/test_winsound.py index 4a8ab7d..1cfef77 100644 --- a/Lib/test/test_winsound.py +++ b/Lib/test/test_winsound.py @@ -87,6 +87,22 @@ class PlaySoundTest(unittest.TestCase): winsound.PlaySound, "none", winsound.SND_ASYNC | winsound.SND_MEMORY ) + self.assertRaises(TypeError, winsound.PlaySound, b"bad", 0) + self.assertRaises(TypeError, winsound.PlaySound, "bad", + winsound.SND_MEMORY) + self.assertRaises(TypeError, winsound.PlaySound, 1, 0) + + def test_snd_memory(self): + with open(support.findfile('pluck-pcm8.wav', + subdir='audiodata'), 'rb') as f: + audio_data = f.read() + safe_PlaySound(audio_data, winsound.SND_MEMORY) + audio_data = bytearray(audio_data) + safe_PlaySound(audio_data, winsound.SND_MEMORY) + + def test_snd_filename(self): + fn = support.findfile('pluck-pcm8.wav', subdir='audiodata') + safe_PlaySound(fn, winsound.SND_FILENAME | winsound.SND_NODEFAULT) def test_aliases(self): aliases = [ |