mirror of
https://github.com/reactos/ahk_tests.git
synced 2024-11-27 05:20:25 +00:00
[AHK_TuxPaint_0.9.21c]
Match new design, add few more checks. The install test works fine in clean snapshot of win2k3 sp2. svn path=/trunk/ahk_tests/; revision=1639
This commit is contained in:
parent
0175394c10
commit
d58254afad
@ -17,42 +17,97 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
SetupExe = %A_WorkingDir%\Apps\TuxPaint 0.9.21c Setup.exe
|
||||
bContinue := false
|
||||
ModuleExe = %A_WorkingDir%\Apps\TuxPaint 0.9.21c Setup.exe
|
||||
TestName = 1.install
|
||||
|
||||
TestsFailed := 0
|
||||
TestsOK := 0
|
||||
TestsTotal := 0
|
||||
MainAppFile = tuxpaint.exe ; Mostly this is going to be process we need to look for
|
||||
|
||||
; Test if Setup file exists, if so, delete installed files, and run Setup
|
||||
IfExist, %SetupExe%
|
||||
{
|
||||
; Get rid of other versions
|
||||
IfExist, %A_ProgramFiles%\TuxPaint\unins000.exe
|
||||
{
|
||||
Process, Close, tuxpaint.exe ; Teminate process
|
||||
RunWait, %A_ProgramFiles%\TuxPaint\unins000.exe /silent ; Silently uninstall it
|
||||
Sleep, 2500
|
||||
RegDelete, HKEY_LOCAL_MACHINE, SOFTWARE\TuxPaint
|
||||
RegDelete, HKEY_LOCAL_MACHINE, SOFTWARE\MicroSoft\Windows\CurrentVersion\Uninstall\Tux Paint_is1
|
||||
FileRemoveDir, %A_ProgramFiles%\TuxPaint, 1
|
||||
FileRemoveDir, %A_AppData%\TuxPaint, 1
|
||||
Sleep, 1000
|
||||
IfExist, %A_ProgramFiles%\TuxPaint
|
||||
{
|
||||
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Failed to delete '%A_ProgramFiles%\TuxPaint'.`n
|
||||
bContinue := false
|
||||
}
|
||||
}
|
||||
Run %SetupExe%
|
||||
bContinue := true
|
||||
|
||||
}
|
||||
TestsTotal++
|
||||
IfNotExist, %ModuleExe%
|
||||
TestsFailed("'" ModuleExe "' not found.")
|
||||
else
|
||||
{
|
||||
OutputDebug, %TestName%:%A_LineNumber%: Test failed: '%SetupExe%' not found.`n
|
||||
bContinue := false
|
||||
Process, Close, %MainAppFile% ; Teminate process
|
||||
Process, WaitClose, %MainAppFile%, 4
|
||||
if ErrorLevel ; The PID still exists.
|
||||
TestsFailed("Unable to terminate '" MainAppFile "' process.") ; So, process still exists
|
||||
else
|
||||
{
|
||||
RegRead, UninstallerPath, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Tux Paint_is1, UninstallString
|
||||
if ErrorLevel
|
||||
{
|
||||
; There was a problem (such as a nonexistent key or value).
|
||||
; That probably means we have not installed this app before.
|
||||
; Check in default directory to be extra sure
|
||||
IfNotExist, %A_ProgramFiles%\TuxPaint
|
||||
bContinue := true ; No previous versions detected in hardcoded path
|
||||
else
|
||||
{
|
||||
bHardcoded := true ; To know if we got path from registry or not
|
||||
IfExist, %A_ProgramFiles%\TuxPaint\unins000.exe
|
||||
{
|
||||
RunWait, %A_ProgramFiles%\TuxPaint\unins000.exe /silent ; Silently uninstall it
|
||||
Sleep, 7000
|
||||
}
|
||||
|
||||
IfNotExist, %A_ProgramFiles%\TuxPaint ; Uninstaller might delete the dir
|
||||
bContinue := true
|
||||
{
|
||||
FileRemoveDir, %A_ProgramFiles%\TuxPaint, 1
|
||||
if ErrorLevel
|
||||
TestsFailed("Unable to delete hardcoded path '" A_ProgramFiles "\TuxPaint' ('" MainAppFile "' process is reported as terminated).'")
|
||||
else
|
||||
bContinue := true
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StringReplace, UninstallerPath, UninstallerPath, `",, All ; TuxPaint data is quoted
|
||||
SplitPath, UninstallerPath,, InstalledDir
|
||||
IfNotExist, %InstalledDir%
|
||||
bContinue := true
|
||||
else
|
||||
{
|
||||
IfExist, %UninstallerPath%
|
||||
{
|
||||
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
|
||||
bContinue := true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if bContinue
|
||||
{
|
||||
RegDelete, HKEY_LOCAL_MACHINE, SOFTWARE\MicroSoft\Windows\CurrentVersion\Uninstall\Tux Paint_is1
|
||||
IfExist, %A_AppData%\TuxPaint
|
||||
{
|
||||
FileRemoveDir, %A_AppData%\TuxPaint, 1
|
||||
if ErrorLevel
|
||||
TestsFailed("Unable to delete '" A_AppData "\TuxPaint'.")
|
||||
}
|
||||
|
||||
if bContinue
|
||||
{
|
||||
if bHardcoded
|
||||
TestsOK("Either there was no previous versions or we succeeded removing it using hardcoded path.")
|
||||
else
|
||||
TestsOK("Either there was no previous versions or we succeeded removing it using data from registry.")
|
||||
Run %ModuleExe%
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -61,29 +116,34 @@ TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Select Setup Language, Select the language, 15
|
||||
if not ErrorLevel
|
||||
{
|
||||
Sleep, 250
|
||||
SendInput, {ENTER} ; Hit 'OK' button
|
||||
TestsOK("'Select Setup Language (Select the language')' window appeared and 'ENTER' was sent.")
|
||||
}
|
||||
else
|
||||
if ErrorLevel
|
||||
TestsFailed("'Select Setup Language (Select the language')' window failed to appear.")
|
||||
else
|
||||
{
|
||||
Sleep, 700
|
||||
SendInput, {ENTER} ; Hit 'OK' button
|
||||
WinWaitClose, Select Setup Language, Select the language, 5
|
||||
if ErrorLevel
|
||||
TestsFailed("'Select Setup Language (Select the language')' window failed to close despite 'ENTER' was sent to it.")
|
||||
else
|
||||
TestsOK("'Select Setup Language (Select the language')' window appeared and 'ENTER' was sent.")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
; Test if 'Welcome to the Tux Paint' window appeared
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Setup - Tux Paint, Welcome to the Tux Paint, 15
|
||||
if not ErrorLevel
|
||||
if ErrorLevel
|
||||
TestsFailed("'Setup - Tux Paint (Welcome to the Tux Paint)' window failed to appear.")
|
||||
else
|
||||
{
|
||||
Sleep, 250
|
||||
Sleep, 700
|
||||
SendInput, !n ; Hit 'Next' button
|
||||
TestsOK("'Setup - Tux Paint (Welcome to the Tux Paint)' window appeared, Alt+N was sent.")
|
||||
}
|
||||
else
|
||||
TestsFailed("'Setup - Tux Paint (Welcome to the Tux Paint)' window failed to appear.")
|
||||
}
|
||||
|
||||
|
||||
@ -92,16 +152,16 @@ TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Setup - Tux Paint, License Agreement, 7
|
||||
if not ErrorLevel
|
||||
if ErrorLevel
|
||||
TestsFailed("'Setup - Tux Paint (License Agreement)' window failed to appear.")
|
||||
else
|
||||
{
|
||||
Sleep, 250
|
||||
Sleep, 700
|
||||
SendInput, !a ; Check 'I accept' radiobutton (Fails to check? Bug 7215)
|
||||
Sleep, 1000 ; Wait until 'Next' button is enabled
|
||||
SendInput, !n ; Hit 'Next' button
|
||||
TestsOK("'Setup - Tux Paint (License Agreement)' window appeared, Alt+A and Alt+N were sent.")
|
||||
}
|
||||
else
|
||||
TestsFailed("'Setup - Tux Paint (License Agreement)' window failed to appear.")
|
||||
}
|
||||
|
||||
|
||||
@ -110,14 +170,14 @@ TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Setup - Tux Paint, Choose Installation Type, 7
|
||||
if not ErrorLevel
|
||||
if ErrorLevel
|
||||
TestsFailed("'Setup - Tux Paint (Choose Installation Type)' window failed to appear (bug 7215?).")
|
||||
else
|
||||
{
|
||||
Sleep, 250
|
||||
Sleep, 700
|
||||
SendInput, !n ; Hit 'Next' button
|
||||
TestsOK("'Setup - Tux Paint (Choose Installation Type)' window appeared, Alt+N was sent.")
|
||||
}
|
||||
else
|
||||
TestsFailed("'Setup - Tux Paint (Choose Installation Type)' window failed to appear (bug 7215?).")
|
||||
}
|
||||
|
||||
|
||||
@ -126,14 +186,14 @@ TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Setup - Tux Paint, Select Destination Location, 7
|
||||
if not ErrorLevel
|
||||
if ErrorLevel
|
||||
TestsFailed("'Setup - Tux Paint (Select Destination Location)' window failed to appear.")
|
||||
else
|
||||
{
|
||||
Sleep, 250
|
||||
Sleep, 700
|
||||
SendInput, !n ; Hit 'Next' button
|
||||
TestsOK("'Setup - Tux Paint (Select Destination Location)' window appeared, Alt+N was sent.")
|
||||
}
|
||||
else
|
||||
TestsFailed("'Setup - Tux Paint (Select Destination Location)' window failed to appear.")
|
||||
}
|
||||
|
||||
|
||||
@ -142,14 +202,14 @@ TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Setup - Tux Paint, Select Start Menu Folder, 7
|
||||
if not ErrorLevel
|
||||
if ErrorLevel
|
||||
TestsFailed("'Setup - Tux Paint (Select Start Menu Folder)' window failed to appear.")
|
||||
else
|
||||
{
|
||||
Sleep, 250
|
||||
Sleep, 700
|
||||
SendInput, !n ; Hit 'Next' button
|
||||
TestsOK("'Setup - Tux Paint (Select Start Menu Folder)' window appeared, Alt+N was sent.")
|
||||
}
|
||||
else
|
||||
TestsFailed("'Setup - Tux Paint (Select Start Menu Folder)' window failed to appear.")
|
||||
}
|
||||
|
||||
|
||||
@ -158,14 +218,14 @@ TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Setup - Tux Paint, Select Additional Tasks, 7
|
||||
if not ErrorLevel
|
||||
if ErrorLevel
|
||||
TestsFailed("'Setup - Tux Paint (Select Additional Tasks)' window failed to appear.")
|
||||
else
|
||||
{
|
||||
Sleep, 250
|
||||
Sleep, 700
|
||||
SendInput, !n ; Hit 'Next' button
|
||||
TestsOK("'Setup - Tux Paint (Select Additional Tasks)' window appeared, Alt+N was sent.")
|
||||
}
|
||||
else
|
||||
TestsFailed("'Setup - Tux Paint (Select Additional Tasks)' window failed to appear.")
|
||||
}
|
||||
|
||||
|
||||
@ -174,14 +234,14 @@ TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Setup - Tux Paint, Ready to Install, 7
|
||||
if not ErrorLevel
|
||||
if ErrorLevel
|
||||
TestsFailed("'Setup - Tux Paint (Ready to Install)' window failed to appear.")
|
||||
else
|
||||
{
|
||||
Sleep, 250
|
||||
Sleep, 700
|
||||
SendInput, !i ; Hit 'Install' button
|
||||
TestsOK("'Setup - Tux Paint (Ready to Install)' window appeared, Alt+I was sent.")
|
||||
}
|
||||
else
|
||||
TestsFailed("'Setup - Tux Paint (Ready to Install)' window failed to appear.")
|
||||
}
|
||||
|
||||
|
||||
@ -190,55 +250,72 @@ TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Setup - Tux Paint, Installing, 7
|
||||
if not ErrorLevel
|
||||
if ErrorLevel
|
||||
TestsFailed("'Setup - Tux Paint (Installing)' window failed to appear.")
|
||||
else
|
||||
{
|
||||
Sleep, 250
|
||||
Sleep, 700
|
||||
OutputDebug, OK: %TestName%:%A_LineNumber%: 'Setup - Tux Paint (Installing)' window appeared, waiting for it to close.`n
|
||||
WinWaitClose, Setup - Tux Paint, Installing, 25
|
||||
if not ErrorLevel
|
||||
TestsOK("'Setup - Tux Paint (Installing)' window went away.")
|
||||
else
|
||||
if ErrorLevel
|
||||
TestsFailed("'Setup - Tux Paint (Installing)' window failed to close.")
|
||||
else
|
||||
TestsOK("'Setup - Tux Paint (Installing)' window went away.")
|
||||
}
|
||||
else
|
||||
TestsFailed("'Setup - Tux Paint (Installing)' window failed to appear.")
|
||||
}
|
||||
|
||||
|
||||
; Test if 'Completing' window appeared and all checkboxes were unchecked correctly
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
WinWaitActive, Setup - Tux Paint, Completing, 7
|
||||
if not ErrorLevel
|
||||
if ErrorLevel
|
||||
TestsFailed("'Setup - Tux Paint (Completing)' window failed to appear.")
|
||||
else
|
||||
{
|
||||
Sleep, 250
|
||||
Sleep, 700
|
||||
SendInput, {SPACE}{DOWN}{SPACE} ; FIXME: Find better solution. AHK 'Control, Uncheck' won't work here!
|
||||
Sleep, 500
|
||||
SendInput, !f ; Hit 'Finish' button
|
||||
Sleep, 2000
|
||||
|
||||
Process, Exist, tuxpaint-config.exe
|
||||
if not ErrorLevel
|
||||
TestsOK("'Setup - Tux Paint (Completing)' window appeared, checkbox 'Launch Tux Paint Config' unchecked, 'Finish' button clicked.")
|
||||
WinWaitClose, Setup - Tux Paint, Completing, 5
|
||||
if ErrorLevel
|
||||
TestsFailed("'Setup - Tux Paint (Completing)' window failed to close despite Alt+F was sent.")
|
||||
else
|
||||
{
|
||||
TestsFailed("Process 'tuxpaint-config.exe' detected, so failed to uncheck checkboxes in 'Setup - Tux Paint (Completing)' window.")
|
||||
Process, Close, tuxpaint-config.exe
|
||||
Process, wait, tuxpaint-config.exe, 4
|
||||
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
|
||||
if NewPID <> 0
|
||||
{
|
||||
Process, Close, tuxpaint-config.exe
|
||||
Process, WaitClose, tuxpaint-config.exe, 4
|
||||
if ErrorLevel
|
||||
TestsFailed("Process 'tuxpaint-config.exe' detected (failed to terminate it), so failed to uncheck checkboxes in 'Setup - Tux Paint (Completing)' window.")
|
||||
else
|
||||
TestsFailed("Process 'tuxpaint-config.exe' detected, so failed to uncheck checkboxes in 'Setup - Tux Paint (Completing)' window.")
|
||||
}
|
||||
else
|
||||
TestsOK("'Setup - Tux Paint (Completing)' window appeared, checkbox 'Launch Tux Paint Config' unchecked, 'Finish' button clicked.")
|
||||
}
|
||||
}
|
||||
else
|
||||
TestsFailed("'Setup - Tux Paint (Completing)' window failed to appear.")
|
||||
}
|
||||
|
||||
|
||||
;Check if program exists in program files
|
||||
; Check if program exists
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
Sleep, 250
|
||||
AppExe = %A_ProgramFiles%\TuxPaint\tuxpaint.exe
|
||||
IfExist, %AppExe%
|
||||
TestsOK("Should be installed, because '" AppExe "' was found.")
|
||||
Sleep, 2000
|
||||
RegRead, UninstallerPath, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Tux Paint_is1, UninstallString
|
||||
if ErrorLevel
|
||||
TestsFailed("Either we can't read from registry or data doesn't exist.")
|
||||
else
|
||||
TestsFailed("Can NOT find '" AppExe "'.")
|
||||
{
|
||||
StringReplace, UninstallerPath, UninstallerPath, `",, All ; TuxPaint data is quoted
|
||||
SplitPath, UninstallerPath,, InstalledDir
|
||||
IfNotExist, %InstalledDir%\%MainAppFile%
|
||||
TestsFailed("Something went wrong, can't find '" InstalledDir "\" MainAppFile "'.")
|
||||
else
|
||||
TestsOK("The application has been installed, because '" InstalledDir "\" MainAppFile "' was found.")
|
||||
}
|
||||
}
|
||||
|
@ -18,44 +18,22 @@
|
||||
*/
|
||||
|
||||
#Include ..\..\helper_functions.ahk
|
||||
InitalizeCounters()
|
||||
|
||||
|
||||
if 1 = --list
|
||||
{
|
||||
params =
|
||||
(
|
||||
|
||||
1.install
|
||||
|
||||
)
|
||||
FileAppend, %params%, *
|
||||
}
|
||||
else if 1 = 1.install
|
||||
{
|
||||
#include install_test.ahk
|
||||
}
|
||||
else
|
||||
{
|
||||
OutputDebug, Bad parameters: '%1%'!`r`n
|
||||
}
|
||||
|
||||
if 1 != --list
|
||||
if CheckParam()
|
||||
{
|
||||
if not bContinue
|
||||
; Those brackets are required!
|
||||
if 1 = 1.install
|
||||
{
|
||||
SplitPath, SetupExe, fName ; Extract filename from given path
|
||||
WindowCleanUp(fName)
|
||||
SplitPath, ModuleExe, fName
|
||||
WindowCleanUp(fName)
|
||||
#include install_test.ahk
|
||||
}
|
||||
|
||||
; Delete saved settings
|
||||
Sleep, 1500
|
||||
FileRemoveDir, %A_AppData%\TuxPaint, 1
|
||||
|
||||
TestsSkipped := TestsTotal - TestsOK - TestsFailed
|
||||
TestsExecuted := TestsOK + TestsFailed
|
||||
if (TestsSkipped < 0 or TestsExecuted < 0)
|
||||
OutputDebug, %TestName%: Check TestsTotal, TestsOK and TestsFailed, because results returns less than 0.`n
|
||||
OutputDebug, %TestName%: %TestsExecuted% tests executed (0 marked as todo, %TestsFailed% failures), %TestsSkipped% skipped.`n
|
||||
}
|
||||
|
||||
ShowTestResults()
|
||||
|
Loading…
Reference in New Issue
Block a user