Add role-specific welcome wallpapers
This commit is contained in:
1 parent
c7c0f941d4
commit
fd051dee80
17 files changed
+345
-35
No files matched your search
@@ -18,7 +18,8 @@ function Invoke-WelcomeFixture {
|
||||
[string]$DirectoryLocation = 'Sala de pruebas',
|
||||
[string]$DirectoryOu = 'Laboratorio',
|
||||
[string]$MachineLocation,
|
||||
[string]$MachineOu
|
||||
[string]$MachineOu,
|
||||
[string]$InstitutionalRole
|
||||
)
|
||||
|
||||
# Replace only the external directory lookup. Execute the actual script,
|
||||
@@ -37,6 +38,8 @@ function Invoke-WelcomeFixture {
|
||||
[IO.File]::WriteAllText($testScript, $fixtureSource, [Text.UTF8Encoding]::new($false))
|
||||
$parameters = @{
|
||||
BaseImagePath = Join-Path $repositoryRoot 'assets\branding\darkblue.jpg'
|
||||
AdministrativeBaseImagePath = Join-Path $repositoryRoot 'assets\branding\darkgray-administrative.png'
|
||||
ProfessorBaseImagePath = Join-Path $repositoryRoot 'assets\branding\darkred-professor.png'
|
||||
FontsPath = Join-Path $repositoryRoot 'assets\branding\fonts'
|
||||
OutputPath = Join-Path $TestDrive ([IO.Path]::GetFileNameWithoutExtension($testScript) + '.jpg')
|
||||
CanvasWidth = 640
|
||||
@@ -44,6 +47,7 @@ function Invoke-WelcomeFixture {
|
||||
SkipApply = $true
|
||||
}
|
||||
if ($ExplicitGender) { $parameters.Gender = $ExplicitGender }
|
||||
if ($InstitutionalRole) { $parameters.InstitutionalRole = $InstitutionalRole }
|
||||
$previousLocalAppData = $env:LOCALAPPDATA
|
||||
$previousMachineLocation = $env:SGU_WELCOME_LOCATION
|
||||
$previousMachineOu = $env:SGU_WELCOME_ORGANIZATIONAL_UNIT
|
||||
@@ -81,6 +85,18 @@ Describe 'Welcome wallpaper with AD metadata' {
|
||||
(Invoke-WelcomeFixture -DirectoryGender 'Male').WelcomeHeading | Should Be 'Bienvenido,'
|
||||
}
|
||||
|
||||
It 'uses role-specific desktop bases while keeping unclassified users blue' {
|
||||
$administrative = Invoke-WelcomeFixture -DirectoryGender $null -InstitutionalRole 'Administrative'
|
||||
$professor = Invoke-WelcomeFixture -DirectoryGender $null -InstitutionalRole 'Professor'
|
||||
$unclassified = Invoke-WelcomeFixture -DirectoryGender $null
|
||||
|
||||
$administrative.BaseImagePath | Should Be (Join-Path $repositoryRoot 'assets\branding\darkgray-administrative.png')
|
||||
$administrative.InstitutionalRole | Should Be 'Administrative'
|
||||
$professor.BaseImagePath | Should Be (Join-Path $repositoryRoot 'assets\branding\darkred-professor.png')
|
||||
$professor.InstitutionalRole | Should Be 'Professor'
|
||||
$unclassified.BaseImagePath | Should Be (Join-Path $repositoryRoot 'assets\branding\darkblue.jpg')
|
||||
}
|
||||
|
||||
It 'honors an explicit gender over directory metadata' {
|
||||
(Invoke-WelcomeFixture -DirectoryGender 'Female' -ExplicitGender 'Male').WelcomeHeading | Should Be 'Bienvenido,'
|
||||
}
|
||||
@@ -153,6 +169,33 @@ Describe 'Welcome wallpaper with AD metadata' {
|
||||
}
|
||||
}
|
||||
|
||||
It 'ships the administrative gray and professor red branded bases' {
|
||||
foreach ($assetName in 'darkgray-administrative.png','darkred-professor.png') {
|
||||
$assetPath = Join-Path $repositoryRoot "assets\branding\$assetName"
|
||||
Test-Path -LiteralPath $assetPath -PathType Leaf | Should Be $true
|
||||
$bitmap = [Drawing.Bitmap]::FromFile($assetPath)
|
||||
try {
|
||||
# Image generation may preserve the 16:10 composition with a
|
||||
# slightly different absolute raster size. The renderer crops
|
||||
# to the active display, so the invariant is the aspect ratio.
|
||||
([Math]::Round($bitmap.Width / $bitmap.Height, 2)) | Should Be 1.6
|
||||
$lowerRightWhitePixels = 0
|
||||
for ($x = 1260; $x -lt 1510; $x += 2) {
|
||||
for ($y = 740; $y -lt 860; $y += 2) {
|
||||
$pixel = $bitmap.GetPixel($x, $y)
|
||||
if ($pixel.R -gt 220 -and $pixel.G -gt 220 -and $pixel.B -gt 220) {
|
||||
$lowerRightWhitePixels++
|
||||
}
|
||||
}
|
||||
}
|
||||
($lowerRightWhitePixels -gt 250) | Should Be $true
|
||||
}
|
||||
finally { $bitmap.Dispose() }
|
||||
}
|
||||
$source | Should Match 'SGU-Administrativos'
|
||||
$source | Should Match 'SGU-Docentes'
|
||||
}
|
||||
|
||||
It 'keeps the lock screen base free of the desktop logo' {
|
||||
$bitmap = [Drawing.Bitmap]::FromFile((Join-Path $repositoryRoot 'assets\branding\darkblue-lockscreen.jpg'))
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user