audio: fix GetDefault???Device API call

This commit is contained in:
Roman Zeyde
2015-01-10 11:55:12 +02:00
parent fd8dc1d8b7
commit 2bb4956439
2 changed files with 11 additions and 2 deletions

View File

@@ -10,7 +10,8 @@ def test():
with mock.patch('ctypes.CDLL') as cdll:
lib = mock.Mock()
lib.Pa_GetErrorText = lambda code: 'Error' if code else 'Success'
lib.Pa_GetDefaultInputDevice.return_value = 1
lib.Pa_GetDefaultOutputDevice.return_value = 1
lib.Pa_GetDefaultInputDevice.return_value = 2
lib.Pa_OpenStream.return_value = 0
cdll.return_value = lib
interface = audio.Interface(
@@ -18,12 +19,14 @@ def test():
)
with interface:
s = interface.player()
assert s.params.device == 1
s.stream = 1 # simulate non-zero output stream handle
s.write(data=data)
s.close()
with interface:
s = interface.recorder()
assert s.params.device == 2
s.stream = 2 # simulate non-zero input stream handle
s.read(len(data))
s.close()