ahk_tests/SciTE/1.77/prepare.ahk
Edijs Kolesnikovičs c8bc71fa05 [AHK_SciTE_1.77]
Match new design, add few more checks.
Both tests works fine in win2k3 sp2.

svn path=/trunk/ahk_tests/; revision=1628
2012-09-09 18:57:35 +00:00

97 lines
3.3 KiB
AutoHotkey

/*
* Designed for SciTE 1.77
* 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
ModuleExe = %A_ProgramFiles%\SciTE\SciTE.exe
; Terminate application
TestsTotal++
SplitPath, ModuleExe, ProcessExe
Process, Close, %ProcessExe%
Process, WaitClose, %ProcessExe%, 4
if ErrorLevel
TestsFailed("Unable to terminate '" ProcessExe "' process.")
else
TestsOK("")
; Test if can start application
RunApplication(PathToFile)
{
global ModuleExe
global TestName
global bContinue
global TestsTotal
global ProcessExe
TestsTotal++
IfNotExist, %ModuleExe%
TestsFailed("Can NOT find '" ModuleExe "'.")
else
{
if PathToFile =
{
Run, %ModuleExe% ; Max does not work here
Sleep, 1000
WinWaitActive, (Untitled) - SciTE,, 10
if ErrorLevel
{
Process, Exist, %ProcessExe%
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
if NewPID = 0
TestsFailed("Window '(Untitled) - SciTE' failed to appear. No '" ProcessExe "' process detected.")
else
TestsFailed("Window '(Untitled) - SciTE' failed to appear. '" ProcessExe "' process detected.")
}
else
{
TestsOK("")
WinMaximize, (Untitled) - SciTE
Sleep, 1000
}
}
else
{
IfNotExist, %PathToFile%
TestsFailed("Can NOT find '" PathToFile "'.")
else
{
Run, %ModuleExe% "%PathToFile%" ; Max does not work here
Sleep, 1000
SplitPath, PathToFile, NameExt
WinWaitActive, %NameExt% - SciTE,,10
if ErrorLevel
{
Process, Exist, %ProcessExe%
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
if NewPID = 0
TestsFailed("Window '" NameExt " - SciTE' failed to appear. No '" ProcessExe "' process detected.")
else
TestsFailed("Window '" NameExt " - SciTE' failed to appear. '" ProcessExe "' process detected.")
}
else
{
TestsOK("")
WinMaximize, %NameExt% - SciTE
Sleep, 1000
}
}
}
}
}