Release v0.6.11: show branded update progress and completion
This commit is contained in:
@@ -55,6 +55,14 @@ int main(int argc, char **argv) {
|
||||
// Message-only window: no hooks, synthetic input, clipboard changes or visible editor.
|
||||
app.window=CreateWindowExW(0,L"STATIC",L"Input tests",0,0,0,0,0,HWND_MESSAGE,nullptr,nullptr,nullptr);
|
||||
require(app.window!=nullptr,"message-only test window");
|
||||
require(!ks::confirmUpdatedStartup(L""),"normal startup does not report update success");
|
||||
require(!ks::confirmUpdatedStartup(L"Local.Other.Event"),"unrelated event cannot report update success");
|
||||
auto startedName=L"Local\\KSwitcher.Update.Started.Test."+std::to_wstring(GetCurrentProcessId());
|
||||
require(!ks::confirmUpdatedStartup(startedName),"missing updater handshake does not report success");
|
||||
auto started=CreateEventW(nullptr,TRUE,FALSE,startedName.c_str());
|
||||
require(started&&ks::confirmUpdatedStartup(startedName)&&WaitForSingleObject(started,0)==WAIT_OBJECT_0,
|
||||
"successful startup signals the updater before reporting completion");
|
||||
CloseHandle(started);
|
||||
require(ks::UpdateCheckIntervalMs==21600000,"automatic update interval is six hours");
|
||||
require(ks::InputRegressionAccess::updateTimer(app),"update timer rearms and avoids overlapping checks");
|
||||
require(ks::InputRegressionAccess::updateResult(app,L"available",L"99.0.0")==L"99.0.0","background update records announced version");
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
param([string]$PreviewDirectory = (Join-Path $PSScriptRoot '../build/update-preview'), [switch]$Network)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
. (Join-Path $PSScriptRoot '../resources/update.ps1') -Library
|
||||
[IO.Directory]::CreateDirectory($PreviewDirectory) | Out-Null
|
||||
Start-UpdateProgress
|
||||
try {
|
||||
if ($script:progressWindow.Status -ne 'Checking for updates') { throw 'Initial progress stage missing' }
|
||||
Show-UpdateProgress 'Downloading update' '42% - 1.6 / 3.9 MB' 42
|
||||
if ($script:progressWindow.Percent -ne 42) { throw 'Determinate download progress missing' }
|
||||
$script:progressWindow.SavePreview((Join-Path $PreviewDirectory 'download.png'))
|
||||
if ($Network) {
|
||||
Receive-File 'https://gitea.hrynco.com/api/v1/repos/hrynco/hrynco-kswitcher/releases?limit=100' (Join-Path $PreviewDirectory 'releases.json') 2MB 'Downloading update'
|
||||
if ($script:progressWindow.Percent -ne 100) { throw 'Real download did not finish at 100 percent' }
|
||||
}
|
||||
foreach ($stage in @('Verifying download','Preparing installation','Closing KSwitcher','Installing update','Restarting KSwitcher','Restoring previous version')) {
|
||||
Show-UpdateProgress $stage 'Update stage under test'
|
||||
if ($script:progressWindow.Status -ne $stage -or $script:progressWindow.Percent -ne -1) { throw "Invalid progress stage: $stage" }
|
||||
}
|
||||
$script:progressWindow.SavePreview((Join-Path $PreviewDirectory 'rollback.png'))
|
||||
$script:progressWindow.Finish('Update completed','KSwitcher 0.6.11 is now running.',$true)
|
||||
if ($script:progressWindow.Status -ne 'Update completed' -or $script:progressWindow.Percent -ne 100) { throw 'Completion state missing' }
|
||||
Start-Sleep -Milliseconds 800 # Let the native progress-bar animation finish before capturing it.
|
||||
$script:progressWindow.SavePreview((Join-Path $PreviewDirectory 'complete.png'))
|
||||
$script:progressWindow.Finish('Update failed',"The updated application did not confirm startup.`r`nThe previous version has been restored and restarted.",$false)
|
||||
if ($script:progressWindow.Status -ne 'Update failed' -or $script:progressWindow.Percent -ne 0) { throw 'Failure state missing' }
|
||||
$script:progressWindow.SavePreview((Join-Path $PreviewDirectory 'failed.png'))
|
||||
'Passed updater progress UI checks'
|
||||
} finally {
|
||||
$script:progressWindow.Dispose()
|
||||
$script:progressWindow = $null
|
||||
}
|
||||
Reference in New Issue
Block a user