mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
Fix Test accidentally closing focused window if focus not switched to Out-GridView.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -61,5 +61,6 @@ testCCFMT.ps1
|
||||
testHide.ps1
|
||||
ImportExcel.zip
|
||||
.vscode/launch.json
|
||||
.vscode/settings.json
|
||||
|
||||
~$*
|
||||
|
||||
@@ -51,8 +51,15 @@ Describe "Compare Worksheet" {
|
||||
Context "Setting the background to highlight different rows, use of grid view." {
|
||||
BeforeAll {
|
||||
$useGrid = ($PSVersionTable.PSVersion.Major -LE 5)
|
||||
$null = Compare-WorkSheet "$env:temp\Server1.xlsx" "$env:temp\Server2.xlsx" -BackgroundColor ([System.Drawing.Color]::LightGreen) -GridView:$useGrid
|
||||
if ($useGrid) {Start-Sleep -sec 5; [System.Windows.Forms.SendKeys]::Sendwait("%{F4}") }
|
||||
if ($useGrid) {
|
||||
$ModulePath = (Get-Command -Name 'Compare-WorkSheet').Module.Path
|
||||
$PowerShellExec = if ($PSEdition -eq 'Core') {'pwsh.exe'} else {'powershell.exe'}
|
||||
$PowerShellPath = Join-Path -Path $PSHOME -ChildPath $PowerShellExec
|
||||
. $PowerShellPath -Command ("Import-Module $ModulePath; " + '$null = Compare-WorkSheet "$env:temp\Server1.xlsx" "$env:temp\Server2.xlsx" -BackgroundColor ([System.Drawing.Color]::LightGreen) -GridView; Start-Sleep -sec 5')
|
||||
}
|
||||
else {
|
||||
$null = Compare-WorkSheet "$env:temp\Server1.xlsx" "$env:temp\Server2.xlsx" -BackgroundColor ([System.Drawing.Color]::LightGreen) -GridView:$useGrid
|
||||
}
|
||||
$xl1 = Open-ExcelPackage -Path "$env:temp\Server1.xlsx"
|
||||
$xl2 = Open-ExcelPackage -Path "$env:temp\Server2.xlsx"
|
||||
$s1Sheet = $xl1.Workbook.Worksheets[1]
|
||||
|
||||
Reference in New Issue
Block a user