mirror of
https://github.com/reactos/ahk_tests.git
synced 2025-02-17 01:58:08 +00:00
96 lines
3.1 KiB
AutoHotkey
96 lines
3.1 KiB
AutoHotkey
/*
|
|
* Designed for WinBoard 4.2.7
|
|
* Copyright (C) 2012 Edijs Kolesnikovics
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
TestName = prepare
|
|
|
|
; Test if the app is installed. No registry information.
|
|
ModuleExe = %A_ProgramFiles%\WinBoard-4.2.7\winboard.exe
|
|
TestsTotal++
|
|
IfNotExist, %ModuleExe%
|
|
TestsFailed("Unable to find '" ModuleExe "'.")
|
|
else
|
|
TestsOK("")
|
|
|
|
|
|
; Terminate application
|
|
if bContinue
|
|
{
|
|
SplitPath, ModuleExe, ProcessExe
|
|
bTerminateProcess(ProcessExe)
|
|
}
|
|
|
|
|
|
; Delete settings separately from RunApplication() in case we want to write our own settings
|
|
TestsTotal++
|
|
if bContinue
|
|
{
|
|
FilePattern = %A_ProgramFiles%\WinBoard-4.2.7\*.ini
|
|
IfExist, %FilePattern%
|
|
{
|
|
FileDelete, %FilePattern%
|
|
if ErrorLevel
|
|
TestsFailed("Unable to delete files that match '" FilePattern "' file pattern.")
|
|
else
|
|
TestsOK("")
|
|
}
|
|
else
|
|
TestsOK("")
|
|
}
|
|
|
|
|
|
; Test if can start application
|
|
RunApplication()
|
|
{
|
|
global ModuleExe
|
|
global TestName
|
|
global TestsTotal
|
|
global bContinue
|
|
global ProcessExe
|
|
|
|
TestsTotal++
|
|
if bContinue
|
|
{
|
|
Run, %ModuleExe%
|
|
WinWaitActive, WinBoard Startup, Play against,7
|
|
if ErrorLevel
|
|
{
|
|
Process, Exist, %ProcessExe%
|
|
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
|
|
if NewPID = 0
|
|
TestsFailed("RunApplication(): Window 'WinBoard Startup (Play against)' failed to appear. No '" ProcessExe "' process detected.")
|
|
else
|
|
TestsFailed("RunApplication(): Window 'WinBoard Startup (Play against)' failed to appear. '" ProcessExe "' process detected.")
|
|
}
|
|
else
|
|
{
|
|
Control, Check,, Button1 ; Check 'Play against a chess engine or match two engines' radiobutton
|
|
if ErrorLevel
|
|
TestsFailed("RunApplication(): Unable to check 'Play against...' radiobutton in 'WinBoard Startup (Play against)' window.")
|
|
else
|
|
{
|
|
ControlGet, OutputVar, Enabled,, Button5 ; Check if 'OK' button is enabled
|
|
if not %OutputVar%
|
|
TestsFailed("RunApplication(): 'Play against...' radiobutton is checked in 'WinBoard Startup (Play against)', but 'OK' button is disabled.")
|
|
else
|
|
TestsOK("")
|
|
}
|
|
}
|
|
}
|
|
}
|