mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2025-12-05 05:07:47 +00:00
add string test
- can now test recorder.load($filename) - prelim test passes for potato
This commit is contained in:
parent
0564dce7b6
commit
e42862c32d
@ -875,31 +875,75 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Context 'Recorder' -Skip:$ifBasic {
|
||||||
|
It 'Should record a test file, eject, and load it back' -Skip:$ifCustomDir {
|
||||||
|
try {
|
||||||
|
$prefix = 'stringtest'
|
||||||
|
$filetype = 'wav'
|
||||||
|
$vmr.recorder.prefix($prefix)
|
||||||
|
$vmr.recorder.filetype($filetype)
|
||||||
|
|
||||||
|
$vmr.recorder.state = 'record'
|
||||||
|
$stamp = '{0:yyyy-MM-dd} at {0:HH}h{0:mm}m{0:ss}s' -f (Get-Date)
|
||||||
|
$vmr.recorder.state | Should -Be 'record'
|
||||||
|
Start-Sleep -Milliseconds 2000
|
||||||
|
|
||||||
|
$tmp = [System.IO.Path]::Combine($recDir, ("{0} {1}.{2}" -f $prefix, $stamp, $filetype))
|
||||||
|
|
||||||
|
$vmr.recorder.state = 'stop'
|
||||||
|
$vmr.recorder.eject()
|
||||||
|
Start-Sleep -Milliseconds 500
|
||||||
|
|
||||||
|
$vmr.recorder.state = 'play'
|
||||||
|
$vmr.recorder.state | Should -Be 'stop' # because no file is loaded
|
||||||
|
|
||||||
|
$vmr.recorder.load($tmp)
|
||||||
|
Start-Sleep -Milliseconds 500
|
||||||
|
if (-not $vmr.recorder.mode.playonload) {
|
||||||
|
$vmr.recorder.state = 'play'
|
||||||
|
}
|
||||||
|
$vmr.recorder.state | Should -Be 'play'
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
$vmr.recorder.state = 'stop'
|
||||||
|
$vmr.recorder.eject()
|
||||||
|
Start-Sleep -Milliseconds 500
|
||||||
|
|
||||||
|
if (Test-Path $tmp) {
|
||||||
|
Remove-Item -Path $tmp -Force
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw "Recording file $tmp was not found."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Describe 'Action Tests' -Tag 'action' {
|
Describe 'Action Tests' -Tag 'action' {
|
||||||
Context 'Recorder' -Skip:$ifBasic {
|
Context 'Recorder' -Skip:$ifBasic {
|
||||||
Context 'Recording/Playback' -Skip:$ifCustomDir {
|
Context 'Recording/Playback' -Skip:$ifCustomDir {
|
||||||
BeforeAll {
|
BeforeAll {
|
||||||
$prefix = 'temp'
|
$prefix = 'actiontest'
|
||||||
$filetype = 'wav'
|
$filetype = 'wav'
|
||||||
$vmr.recorder.prefix($prefix)
|
$vmr.recorder.prefix($prefix)
|
||||||
$vmr.recorder.filetype($filetype)
|
$vmr.recorder.filetype($filetype)
|
||||||
}
|
}
|
||||||
|
|
||||||
BeforeEach {
|
BeforeEach {
|
||||||
$vmr.recorder.state = 'record'
|
$vmr.recorder.record()
|
||||||
$stamp = '{0:yyyy-MM-dd} at {0:HH}h{0:mm}m{0:ss}s' -f (Get-Date)
|
$stamp = '{0:yyyy-MM-dd} at {0:HH}h{0:mm}m{0:ss}s' -f (Get-Date)
|
||||||
Start-Sleep -Milliseconds 2000
|
Start-Sleep -Milliseconds 2000
|
||||||
|
|
||||||
$tmp = [System.IO.Path]::Combine($recDir, ("{0} {1}.{2}" -f $prefix, $stamp, $filetype))
|
$tmp = [System.IO.Path]::Combine($recDir, ("{0} {1}.{2}" -f $prefix, $stamp, $filetype))
|
||||||
|
|
||||||
$vmr.recorder.state = 'pause'
|
$vmr.recorder.pause()
|
||||||
Start-Sleep -Milliseconds 500
|
Start-Sleep -Milliseconds 500
|
||||||
}
|
}
|
||||||
|
|
||||||
AfterEach {
|
AfterEach {
|
||||||
$vmr.recorder.state = 'stop'
|
$vmr.recorder.stop()
|
||||||
$vmr.recorder.eject()
|
$vmr.recorder.eject()
|
||||||
Start-Sleep -Milliseconds 500
|
Start-Sleep -Milliseconds 500
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user