reset, save

- removed 'lock' test, corrected README example
- can now test 'save', 'reset', 'load'

prelim test for potato passes
This commit is contained in:
pblivingston 2025-12-03 15:07:25 -05:00
parent b5546aa56c
commit cfa7de9b11
4 changed files with 55 additions and 8 deletions

View File

@ -39,6 +39,8 @@ Recorder.FileType changed from method to write-only property
- Recorder.Prefix - Recorder.Prefix
- Recorder.Eject() references 'Command.Eject' - Recorder.Eject() references 'Command.Eject'
- Recorder.State - Recorder.State
- Command.Reset()
- Command.Save($filepath)
### Changed ### Changed

View File

@ -428,6 +428,8 @@ The following methods are available:
- HideVBANChat() - HideVBANChat()
- Restart() - Restart()
- Shutdown() - Shutdown()
- Reset(): Reset all config
- Save($filepath): string
- Load($filepath): string - Load($filepath): string
- RunMacrobuttons(): Launches the macrobuttons app - RunMacrobuttons(): Launches the macrobuttons app
- CloseMacrobuttons(): Closes the macrobuttons app - CloseMacrobuttons(): Closes the macrobuttons app
@ -437,7 +439,7 @@ example:
```powershell ```powershell
$vmr.command.show() $vmr.command.show()
$vmr.command.lock = $true $vmr.command.lock()
$vmr.command.Load("path/to/filename.xml") $vmr.command.Load("path/to/filename.xml")

View File

@ -1,6 +1,6 @@
class Special : IRemote { class Special : IRemote {
Special ([Object]$remote) : base ($remote) { Special ([Object]$remote) : base ($remote) {
AddActionMembers -PARAMS @('restart', 'shutdown', 'show', 'lock') AddActionMembers -PARAMS @('restart', 'shutdown', 'show', 'lock', 'reset')
} }
[string] identifier () { [string] identifier () {
@ -36,6 +36,10 @@ class Special : IRemote {
[void] Load ([string]$filename) { [void] Load ([string]$filename) {
$this.Setter('load', $filename) $this.Setter('load', $filename)
} }
[void] Save ([string]$filename) {
$this.Setter('save', $filename)
}
} }
function Make_Command([Object]$remote) { function Make_Command([Object]$remote) {

View File

@ -184,12 +184,6 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' {
} }
} }
Context 'Command' {
It 'Should set command.lock' {
$vmr.command.lock = $value
}
}
Context 'Fx' -Skip:$ifNotPotato { Context 'Fx' -Skip:$ifNotPotato {
Context 'Delay' { Context 'Delay' {
It 'Should set and get Fx.delay.on' { It 'Should set and get Fx.delay.on' {
@ -948,6 +942,51 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' {
} }
} }
} }
Context 'Command' {
It 'Should save, reset, then load config' -ForEach @(
@{ Gain = -27.1; Mode = 'composite'; Bit = 24; Port = 1044 }
) {
$tmp = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), "vmrconfig-$(New-Guid).xml")
try {
# set some values
$vmr.strip[$virt_in].gain = $gain
$vmr.bus[$phys_out].mode.set($mode)
$vmr.vban.outstream[$vban_outA].bit = $bit
$vmr.vban.port = $port
# save config
$vmr.command.save($tmp)
Start-Sleep -Milliseconds 100
Test-Path $tmp | Should -BeTrue
# reset config
$vmr.command.reset()
Start-Sleep -Milliseconds 500
# verify default values
$vmr.strip[$virt_in].gain | Should -Be 0.0
$vmr.bus[$phys_out].mode.get() | Should -Be 'normal'
$vmr.vban.outstream[$vban_outA].bit | Should -Be 16
$vmr.vban.port | Should -Be 6980
# load config
$vmr.command.load($tmp)
Start-Sleep -Milliseconds 500
# verify values
$vmr.strip[$virt_in].gain | Should -Be $gain
$vmr.bus[$phys_out].mode.get() | Should -Be $mode
$vmr.vban.outstream[$vban_outA].bit | Should -Be $bit
$vmr.vban.port | Should -Be $port
}
finally {
if (Test-Path $tmp) {
Remove-Item $tmp -Force
}
}
}
}
} }
Describe 'Action Tests' -Tag 'action' { Describe 'Action Tests' -Tag 'action' {