mirror of
https://github.com/reactos/ahk_tests.git
synced 2024-11-23 11:39:42 +00:00
[AHK_LMarbles_1.0.6]
Improve the script that removes old versions of application, reduce waiting time, remove unnecessary sleep calls. The install test works fine in win2k3 sp2. svn path=/trunk/ahk_tests/; revision=1781
This commit is contained in:
parent
6a6c53c349
commit
602d9bc2c3
@ -40,50 +40,68 @@ else
|
||||
; That probably means we have not installed this app before.
|
||||
; Check in default directory to be extra sure
|
||||
bHardcoded := true ; To know if we got path from registry or not
|
||||
IfNotExist, %A_ProgramFiles%\lmarbles
|
||||
bContinue := true ; No previous versions detected in hardcoded path
|
||||
else
|
||||
szDefaultDir = %A_ProgramFiles%\lmarbles
|
||||
IfNotExist, %szDefaultDir%
|
||||
{
|
||||
IfExist, %A_ProgramFiles%\lmarbles\unins000.exe
|
||||
TestsInfo("No previous versions detected in hardcoded path: '" szDefaultDir "'.")
|
||||
bContinue := true
|
||||
}
|
||||
else
|
||||
{
|
||||
UninstallerPath = %szDefaultDir%\unins000.exe /silent
|
||||
WaitUninstallDone(UninstallerPath, 3)
|
||||
if bContinue
|
||||
{
|
||||
RunWait, %A_ProgramFiles%\lmarbles\unins000.exe /silent ; Silently uninstall it
|
||||
Sleep, 7000
|
||||
}
|
||||
|
||||
IfNotExist, %A_ProgramFiles%\lmarbles ; Uninstaller might delete the dir
|
||||
bContinue := true
|
||||
{
|
||||
FileRemoveDir, %A_ProgramFiles%\lmarbles, 1
|
||||
if ErrorLevel
|
||||
TestsFailed("Unable to delete hardcoded path '" A_ProgramFiles "\lmarbles' ('" MainAppFile "' process is reported as terminated).'")
|
||||
else
|
||||
IfNotExist, %szDefaultDir% ; Uninstaller might delete the dir
|
||||
{
|
||||
TestsInfo("Uninstaller deleted hardcoded path: '" szDefaultDir "'.")
|
||||
bContinue := true
|
||||
}
|
||||
else
|
||||
{
|
||||
FileRemoveDir, %szDefaultDir%, 1
|
||||
if ErrorLevel
|
||||
TestsFailed("Unable to delete hardcoded path '" szDefaultDir "' ('" MainAppFile "' process is reported as terminated).'")
|
||||
else
|
||||
{
|
||||
TestsInfo("Succeeded deleting hardcoded path, because uninstaller did not: '" szDefaultDir "'.")
|
||||
bContinue := true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StringReplace, UninstallerPath, UninstallerPath, `",, All
|
||||
UninstallerPath := ExeFilePathNoParam(UninstallerPath)
|
||||
SplitPath, UninstallerPath,, InstalledDir
|
||||
IfNotExist, %InstalledDir%
|
||||
{
|
||||
TestsInfo("Got '" InstalledDir "' from registry and such path does not exist.")
|
||||
bContinue := true
|
||||
}
|
||||
else
|
||||
{
|
||||
IfExist, %UninstallerPath%
|
||||
UninstallerPath = %UninstallerPath% /silent
|
||||
WaitUninstallDone(UninstallerPath, 3) ; Reported child name is '_iu14D2N.tmp'
|
||||
if bContinue
|
||||
{
|
||||
RunWait, %UninstallerPath% /silent ; Silently uninstall it
|
||||
Sleep, 7000
|
||||
}
|
||||
|
||||
IfNotExist, %InstalledDir%
|
||||
bContinue := true
|
||||
else
|
||||
{
|
||||
FileRemoveDir, %InstalledDir%, 1 ; Delete just in case
|
||||
if ErrorLevel
|
||||
TestsFailed("Unable to delete existing '" InstalledDir "' ('" MainAppFile "' process is reported as terminated).")
|
||||
else
|
||||
IfNotExist, %InstalledDir%
|
||||
{
|
||||
TestsInfo("Uninstaller deleted path (registry data): '" InstalledDir "'.")
|
||||
bContinue := true
|
||||
}
|
||||
else
|
||||
{
|
||||
FileRemoveDir, %InstalledDir%, 1 ; Uninstaller leaved the path for us to delete, so, do it
|
||||
if ErrorLevel
|
||||
TestsFailed("Unable to delete existing '" InstalledDir "' ('" MainAppFile "' process is reported as terminated).")
|
||||
else
|
||||
{
|
||||
TestsInfo("Succeeded deleting path (registry data), because uninstaller did not: '" InstalledDir "'.")
|
||||
bContinue := true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -109,18 +127,17 @@ else
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Setup, This will, 15
|
||||
WinWaitActive, Setup, This will, 5
|
||||
if ErrorLevel
|
||||
TestsFailed("'Setup (This will)' window failed to appear.")
|
||||
else
|
||||
{
|
||||
Sleep, 700
|
||||
ControlClick, Button1, Setup, This will ; Hit 'Yes' button
|
||||
if ErrorLevel
|
||||
TestsFailed("Unable to hit 'Yes' button in 'Setup (This will)' window.")
|
||||
else
|
||||
{
|
||||
WinWaitClose, Setup, This will, 5
|
||||
WinWaitClose, Setup, This will, 3
|
||||
if ErrorLevel
|
||||
TestsFailed("'Setup (This will)' window failed to close despite 'Yes' button being clicked.")
|
||||
else
|
||||
@ -134,12 +151,11 @@ if bContinue
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Setup - LMarbles, Welcome, 15
|
||||
WinWaitActive, Setup - LMarbles, Welcome, 5
|
||||
if ErrorLevel
|
||||
TestsFailed("'Setup - LMarbles (Welcome)' window failed to appear.")
|
||||
else
|
||||
{
|
||||
Sleep, 700
|
||||
ControlClick, TButton2, Setup - LMarbles, Welcome ; Hit 'Next' button
|
||||
if ErrorLevel
|
||||
TestsFailed("Unable to hit 'Next' button in 'Setup - LMarbles (Welcome)' window.")
|
||||
@ -153,12 +169,11 @@ if bContinue
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Setup - LMarbles, SelectDir, 7
|
||||
WinWaitActive, Setup - LMarbles, SelectDir, 3
|
||||
if ErrorLevel
|
||||
TestsFailed("'Setup - LMarbles (SelectDir)' window failed to appear.")
|
||||
else
|
||||
{
|
||||
Sleep, 700
|
||||
ControlClick, TButton2, Setup - LMarbles, SelectDir ; Hit 'Next' button
|
||||
if ErrorLevel
|
||||
TestsFailed("Unable to hit 'Next' button in 'Setup - LMarbles (SelectDir)' window.")
|
||||
@ -172,12 +187,11 @@ if bContinue
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Setup - LMarbles, SelectProgramGroup, 7
|
||||
WinWaitActive, Setup - LMarbles, SelectProgramGroup, 3
|
||||
if ErrorLevel
|
||||
TestsFailed("'Setup - LMarbles (SelectProgramGroup)' window failed to appear.")
|
||||
else
|
||||
{
|
||||
Sleep, 700
|
||||
ControlClick, TButton2, Setup - LMarbles, SelectProgramGroup ; Hit 'Next' button
|
||||
if ErrorLevel
|
||||
TestsFailed("Unable to hit 'Next' button in 'Setup - LMarbles (SelectProgramGroup)' window.")
|
||||
@ -191,12 +205,11 @@ if bContinue
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Setup - LMarbles, SelectTasks, 7
|
||||
WinWaitActive, Setup - LMarbles, SelectTasks, 3
|
||||
if ErrorLevel
|
||||
TestsFailed("'Setup - LMarbles (SelectTasks)' window failed to appear.")
|
||||
else
|
||||
{
|
||||
Sleep, 700
|
||||
ControlClick, TButton2, Setup - LMarbles, SelectTasks ; Hit 'Next' button
|
||||
if ErrorLevel
|
||||
TestsFailed("Unable to hit 'Next' button in 'Setup - LMarbles (SelectTasks)' window.")
|
||||
@ -210,12 +223,11 @@ if bContinue
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Setup - LMarbles, Ready, 7
|
||||
WinWaitActive, Setup - LMarbles, Ready, 3
|
||||
if ErrorLevel
|
||||
TestsFailed("'Setup - LMarbles (Ready)' window failed to appear.")
|
||||
else
|
||||
{
|
||||
Sleep, 700
|
||||
ControlClick, TButton2, Setup - LMarbles, Ready ; Hit 'Install' button
|
||||
if ErrorLevel
|
||||
TestsFailed("Unable to hit 'Install' button in 'Setup - LMarbles (Ready)' window.")
|
||||
@ -232,34 +244,31 @@ if bContinue
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Setup - LMarbles, Finished, 30 ; Wait longer, because we skipped one window
|
||||
WinWaitActive, Setup - LMarbles, Finished, 5 ; Wait longer, because we skipped one window
|
||||
if ErrorLevel
|
||||
TestsFailed("'Setup - LMarbles (Finished)' window failed to appear.")
|
||||
else
|
||||
{
|
||||
Sleep, 700
|
||||
Control, Uncheck, , TCheckBox1, Setup - LMarbles, Finished ; uncheck 'Launch LBreakout2' checkbox
|
||||
Control, Uncheck, , TCheckBox1, Setup - LMarbles, Finished ; uncheck 'Launch LMarbles' checkbox
|
||||
if ErrorLevel
|
||||
TestsFailed("Unable to uncheck 'Launch LBreakout2' checkbox in 'Setup - LMarbles (Finished)' window.")
|
||||
TestsFailed("Unable to uncheck 'Launch LMarbles' checkbox in 'Setup - LMarbles (Finished)' window.")
|
||||
else
|
||||
{
|
||||
Sleep, 700
|
||||
ControlClick, TButton2, Setup - LMarbles, Finished ; Hit 'Finish' button
|
||||
if ErrorLevel
|
||||
TestsFailed("Unable to hit 'Finish' button in 'Setup - LMarbles (Finished)' window.")
|
||||
ControlGet, bChecked, Checked, TCheckBox1
|
||||
if bChecked = 1
|
||||
TestsFailed("'Launch LMarbles' checkbox in 'Setup - LMarbles (Finished)' window reported as unchecked, but further inspection proves that it was still checked.")
|
||||
else
|
||||
{
|
||||
WinWaitClose, Setup - LMarbles, Finished, 7
|
||||
ControlClick, TButton2, Setup - LMarbles, Finished ; Hit 'Finish' button
|
||||
if ErrorLevel
|
||||
TestsFailed("'Setup - LMarbles (Finished)' window failed to close despite 'Finish' button being clicked.")
|
||||
TestsFailed("Unable to hit 'Finish' button in 'Setup - LMarbles (Finished)' window.")
|
||||
else
|
||||
{
|
||||
Process, Wait, %MainAppFile%, 4
|
||||
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
|
||||
if NewPID <> 0
|
||||
TestsFailed("'" MainAppFile "' process appeared despite 'Launch LBreakout2' checkbox being unchecked in 'Setup - LMarbles (Finished)' window.")
|
||||
WinWaitClose, Setup - LMarbles, Finished, 3
|
||||
if ErrorLevel
|
||||
TestsFailed("'Setup - LMarbles (Finished)' window failed to close despite 'Finish' button being clicked.")
|
||||
else
|
||||
TestsOK("'Setup - LMarbles (Finished)' window appeared, 'Launch LBreakout2' checkbox unchecked, 'Finish' button clicked and window closed.")
|
||||
TestsOK("'Setup - LMarbles (Finished)' window appeared, 'Launch LMarbles' checkbox unchecked, 'Finish' button clicked and window closed.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user