Closes #11620: Fix support for SND_MEMORY in winsound.PlaySound.

Based on a patch by Tim Lesher.
This commit is contained in:
Zachary Ware 2016-09-05 16:31:21 -05:00
parent 0e76e67246
commit ae8298bfb7
5 changed files with 63 additions and 16 deletions

View file

@ -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 = [