Evan's Blog
EvanZhu0721 / 公开仓库

SBMS

镜像已同步

SBMS complete the calculation rules for the default logical desktop topology relationship and the physical dimensions of the displays in the Windows multi-screen collaboration system.

上游 GitHub
READ-ONLY MIRROR

README、源码与 Release 已保存到本站;源码视图固定到 commit bd87fa1e。

main/ root / installer/tests
bd87fa1e· 固定源码快照
installer/tests/inno-user-state.Tests.ps12.3 KB
1$ErrorActionPreference = 'Stop'
2Set-StrictMode -Version Latest
3
4$installerScript = [IO.Path]::GetFullPath(
5 (Join-Path $PSScriptRoot '..\SBMS.iss')
6)
7
8function Get-InnoSection {
9 param(
10 [Parameter(Mandatory)]
11 [string]$Source,
12
13 [Parameter(Mandatory)]
14 [string]$Name
15 )
16
17 $match = [regex]::Match(
18 $Source,
19 "(?ms)^\[$([regex]::Escape($Name))\]\s*(?<body>.*?)(?=^\[|\z)"
20 )
21 if (-not $match.Success) {
22 throw "Inno Setup section [$Name] was not found."
23 }
24 $match.Groups['body'].Value
25}
26
27Describe 'Inno Setup user-state lifecycle contract' {
28 BeforeAll {
29 $script:source = [IO.File]::ReadAllText(
30 $installerScript,
31 [Text.Encoding]::UTF8
32 )
33 }
34
35 It 'does not delete LocalAppData SBMS state during install or upgrade' {
36 $installDelete = Get-InnoSection `
37 -Source $script:source `
38 -Name 'InstallDelete'
39 $activeEntries = @(
40 $installDelete -split "`r?`n" |
41 Where-Object { $_ -notmatch '^\s*;' }
42 ) -join "`n"
43
44 $activeEntries | Should Not Match '(?i)\{localappdata\}\\SBMS'
45 }
46
47 It 'deletes the complete LocalAppData SBMS state on deliberate uninstall' {
48 $uninstallDelete = Get-InnoSection `
49 -Source $script:source `
50 -Name 'UninstallDelete'
51 $stateDeletes = @(
52 [regex]::Matches(
53 $uninstallDelete,
54 '(?im)^\s*Type:\s*filesandordirs;\s*Name:\s*"\{localappdata\}\\SBMS"\s*$'
55 )
56 )
57
58 $stateDeletes.Count | Should Be 1
59 }
60
61 It 'prepares an existing installation before setup overwrites files' {
62 $code = Get-InnoSection -Source $script:source -Name 'Code'
63
64 $code | Should Match '(?s)function\s+PrepareToInstall\b.*?DirExists\(ExpandConstant\(''\{app\}''\)\).*?ExtractTemporaryFile\(''sbms-maintenance\.ps1''\).*?''PrepareUpgrade'''
65 }
66
67 It 'gates uninstall before changes and runs external cleanup at usUninstall' {
68 $code = Get-InnoSection -Source $script:source -Name 'Code'
69
70 $code | Should Match '(?s)function\s+InitializeUninstall\b.*?RunMaintenance\(''PreflightUninstall'''
71 $code | Should Match '(?s)procedure\s+CurUninstallStepChanged\b.*?CurUninstallStep\s*=\s*usUninstall.*?RunMaintenance\(''Uninstall'''
72 }
73}
74