mirror of
https://github.com/reactos/ahk_tests.git
synced 2024-11-30 15:00:36 +00:00
[AHK_Total_Commander_8.0]
Add prepare.ahk and test to find 'calc.exe' in WinDir. Tested and works fine in win2k3 sp2. svn path=/trunk/ahk_tests/; revision=1534
This commit is contained in:
parent
156146e9fe
commit
23fab11a1d
117
Total Commander/8.0/find_files.ahk
Normal file
117
Total Commander/8.0/find_files.ahk
Normal file
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Designed for Total Commander 8.0
|
||||
* 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 = 2.find_files
|
||||
|
||||
; Check if can find calc.exe in WinDir\..
|
||||
TestsTotal++
|
||||
RunApplication()
|
||||
if bContinue
|
||||
{
|
||||
IfWinActive, Total Commander 8.0 - NOT REGISTERED
|
||||
{
|
||||
WinMenuSelectItem, Total Commander 8.0 - NOT REGISTERED, , Commands, Search
|
||||
if not ErrorLevel
|
||||
{
|
||||
WinWaitActive, Find Files, &Start search, 5
|
||||
if not ErrorLevel
|
||||
{
|
||||
ControlSetText, Edit3, calc.exe, Find Files, &Start search ; Search for
|
||||
if not ErrorLevel
|
||||
{
|
||||
SendInput, {ALTDOWN}i{ALTUP} ; Focus 'Search in' field, ControlSetText will cause problems
|
||||
SendInput, %A_WinDir%
|
||||
Sleep, 1000
|
||||
ControlClick, TButton16, Find Files, &Start search ; Hit 'Start search' button
|
||||
if not ErrorLevel
|
||||
{
|
||||
ControlText := " [1 files and 0 directories found]"
|
||||
ControlGetText, OutputVar, TMyPanel1, Find Files
|
||||
if not ErrorLevel
|
||||
{
|
||||
TimeOut := 0
|
||||
while (OutputVar <> ControlText) and (TimeOut < 40)
|
||||
{
|
||||
Sleep, 500
|
||||
ControlGetText, OutputVar, TMyPanel1, Find Files
|
||||
TimeOut++
|
||||
}
|
||||
|
||||
if (OutputVar == ControlText)
|
||||
{
|
||||
TestsOK()
|
||||
OutputDebug, %TestName%:%A_LineNumber%: OK: 'Find Files' executed by 'Commands -> Search' successfully.`n
|
||||
Sleep, 1000
|
||||
Process, Close, TOTALCMD.EXE ; Teminate process
|
||||
}
|
||||
else
|
||||
{
|
||||
TestsFailed()
|
||||
WinGetTitle, title, A
|
||||
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Timed out, result: '%OutputVar%'. Active window caption: '%title%'.`n
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TestsFailed()
|
||||
WinGetTitle, title, A
|
||||
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Unable to get caption of 'Start search' button in 'Find Files (Start search)' window. Active window caption: '%title%'.`n
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TestsFailed()
|
||||
WinGetTitle, title, A
|
||||
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Unable to hit 'Start search' button in 'Find Files (Start search)' window. Active window caption: '%title%'.`n
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TestsFailed()
|
||||
WinGetTitle, title, A
|
||||
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Unable to set 'Search for' to 'calc.exe' in 'Find Files (Start search)' window. Active window caption: '%title%'.`n
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TestsFailed()
|
||||
WinGetTitle, title, A
|
||||
OutputDebug, %TestName%:%A_LineNumber%: Test failed: 'Find Files (Start search)' window failed to appear. Active window caption: '%title%'.`n
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TestsFailed()
|
||||
WinGetTitle, title, A
|
||||
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Unable to hit 'Commands -> Search' in 'Total Commander 8.0 - NOT REGISTERED' window. Active window caption: '%title%'.`n
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TestsFailed()
|
||||
WinGetTitle, title, A
|
||||
OutputDebug, %TestName%:%A_LineNumber%: Test failed: 'Total Commander 8.0 - NOT REGISTERED' is not active window. Active window caption: '%title%'.`n
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TestsFailed()
|
||||
WinGetTitle, title, A
|
||||
OutputDebug, %TestName%:%A_LineNumber%: Test failed: We failed somewhere in prepare.ahk. Active window caption: '%title%'`n
|
||||
}
|
116
Total Commander/8.0/prepare.ahk
Normal file
116
Total Commander/8.0/prepare.ahk
Normal file
@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Designed for Total Commander 8.0
|
||||
* 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
|
||||
*/
|
||||
|
||||
bContinue := false
|
||||
TestsTotal := 0
|
||||
TestsSkipped := 0
|
||||
TestsFailed := 0
|
||||
TestsOK := 0
|
||||
TestsExecuted := 0
|
||||
TestName = prepare
|
||||
|
||||
RegRead, UninstallerPath, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Totalcmd, UninstallString
|
||||
if not ErrorLevel
|
||||
{
|
||||
StringReplace, UninstallerPath, UninstallerPath, `",, All ; String contains quotes, replace em
|
||||
SplitPath, UninstallerPath,, InstalledDir
|
||||
ModuleExe = %InstalledDir%\TOTALCMD.EXE
|
||||
}
|
||||
else
|
||||
{
|
||||
ModuleExe = C:\totalcmd\TOTALCMD.EXE
|
||||
OutputDebug, %TestName%:%A_LineNumber%: Can NOT read data from registry. Key might not exist. Using hardcoded path.`n
|
||||
}
|
||||
|
||||
RunApplication()
|
||||
{
|
||||
global ModuleExe
|
||||
global TestName
|
||||
global bContinue
|
||||
|
||||
IfExist, %ModuleExe%
|
||||
{
|
||||
Process, Close, TOTALCMD.EXE ; Teminate process
|
||||
Sleep, 2500 ; To make sure folders are not locked
|
||||
FileRemoveDir, %A_AppData%\GHISLER, 1 ; Delete all saved settings
|
||||
Sleep, 1500
|
||||
IfNotExist, %A_AppData%\GHISLER
|
||||
{
|
||||
Run, %ModuleExe%,, Max ; Start maximized
|
||||
WinWaitActive, Total Commander, Program &information, 10
|
||||
if not ErrorLevel
|
||||
{
|
||||
ControlGetText, BtnNumber, TPanel2, Total Commander, Program &information
|
||||
if not ErrorLevel
|
||||
{
|
||||
Sleep, 1000
|
||||
SendInput, %BtnNumber% ; Click button to start program
|
||||
WinWaitActive, Configuration, Layout, 5
|
||||
if not ErrorLevel
|
||||
{
|
||||
Sleep, 1000
|
||||
ControlClick, TButton30, Configuration, Layout ; Hit 'OK' button
|
||||
if not ErrorLevel
|
||||
{
|
||||
WinWaitActive, Total Commander 8.0 - NOT REGISTERED,,5
|
||||
if not ErrorLevel
|
||||
{
|
||||
bContinue := true
|
||||
Sleep, 1000
|
||||
}
|
||||
else
|
||||
{
|
||||
WinGetTitle, title, A
|
||||
OutputDebug, %TestName%:%A_LineNumber%: Test failed: 'Total Commander 8.0 - NOT REGISTERED' window failed to appear. Active window caption: '%title%'.`n
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WinGetTitle, title, A
|
||||
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Unable to hit 'OK' button in 'Configuration (Layout)' window. Active window caption: '%title%'.`n
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WinGetTitle, title, A
|
||||
OutputDebug, %TestName%:%A_LineNumber%: Test failed: 'Configuration (Layout)' window failed to appear. Active window caption: '%title%'.`n
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WinGetTitle, title, A
|
||||
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Unable to get button number needed to hit in 'Total Commander (Program information)' window. Active window caption: '%title%'.`n
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WinGetTitle, title, A
|
||||
OutputDebug, %TestName%:%A_LineNumber%: Test failed: 'Total Commander (Program information)' window failed to appear. Active window caption: '%title%'.`n
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Seems like we failed to delete '%A_AppData%\GHISLER'.`n
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Can NOT find '%ModuleExe%'.`n
|
||||
}
|
||||
}
|
@ -36,6 +36,13 @@ else if 1 = 1.install
|
||||
}
|
||||
else
|
||||
{
|
||||
#include prepare.ahk
|
||||
|
||||
if 1 = 2.find_files
|
||||
{
|
||||
#include find_files.ahk
|
||||
}
|
||||
else
|
||||
OutputDebug, Bad parameters: '%1%'!`r`n
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user