[AHK_Process_Explorer_15.3]

Check if can view properties of selected process.
Test succeeds in 2k3 SP1 and WinXP SP3.

svn path=/trunk/ahk_tests/; revision=2016
This commit is contained in:
Edijs Kolesnikovičs 2013-04-15 05:35:41 +00:00
parent 3c7f0c6fba
commit f60eef925c
3 changed files with 217 additions and 0 deletions

View File

@ -0,0 +1,86 @@
/*
* Designed for Process Explorer 15.3
* Copyright (C) 2013 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
*/
ModuleExe = %A_WorkingDir%\Apps\Process_Explorer_15.3.exe
TestName = prepare
; Terminate application
SplitPath, ModuleExe, ProcessExe
bTerminateProcess(ProcessExe)
TestsTotal++
if bContinue
{
RegRead, bEulaAccepted, HKEY_CURRENT_USER, Software\Sysinternals\Process Explorer, EulaAccepted
if not ErrorLevel
{
RegDelete, HKEY_CURRENT_USER, Software\Sysinternals\Process Explorer
if ErrorLevel
TestsFailed("Unable to delete 'HKEY_CURRENT_USER\Software\Sysinternals\Process Explorer' key which exist.")
else
TestsOK("")
}
else
TestsOK("Since can NOT read 'HKEY_CURRENT_USER\Software\Sysinternals\Process Explorer, EulaAccepted' assuming no settings are stored yet.")
}
TestsTotal++
if bContinue
{
IfNotExist, %ModuleExe%
TestsFailed("Can NOT find '" ModuleExe "'.")
else
{
Run, %ModuleExe%
WinWaitActive, Process Explorer License Agreement, EULA, 3
if ErrorLevel
TestsFailed("'Process Explorer License Agreement (EULA)' window failed to appear.")
else
{
ControlClick, Button1, Process Explorer License Agreement, EULA ; Hit 'Agree' button
if ErrorLevel
TestsFailed("Unable to click 'Agree' button in 'Process Explorer License Agreement (EULA)' window.")
else
{
WinWaitClose, Process Explorer License Agreement, EULA, 3
if ErrorLevel
TestsFailed("'Process Explorer License Agreement (EULA)' window failed to close despite 'Agree' button being reported as clicked.")
else
TestsOK("Clicked 'Agree' button in 'Process Explorer License Agreement (EULA)' window and window closed.")
}
}
}
}
TestsTotal++
if bContinue
{
SetTitleMatchMode, 1 ; A window's title must start with the specified WinTitle to be a match.
WinWaitActive, Process Explorer - Sysinternals: www.sysinternals.com,, 3 ; Specifying WinText for WinWaitActive wont work
if ErrorLevel
TestsFailed("'Process Explorer - Sysinternals: www.sysinternals.com' window failed to appear (TitleMatchMode=" A_TitleMatchMode ").")
else
{
WinMaximize, Process Explorer - Sysinternals: www.sysinternals.com
TestsOK("'Process Explorer - Sysinternals: www.sysinternals.com' window appeared (TitleMatchMode=" A_TitleMatchMode ").")
}
}

View File

@ -0,0 +1,88 @@
/*
* Designed for Process Explorer 15.3
* Copyright (C) 2013 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
*/
ModuleExe = %A_WorkingDir%\Apps\Process_Explorer_15.3.exe
TestName = 1.view_properties
SetTitleMatchMode, 1 ; A window's title must start with the specified WinTitle to be a match.
; Check if can view properties of selected process
TestsTotal++
if bContinue
{
IfWinNotActive, Process Explorer - Sysinternals: www.sysinternals.com
TestsFailed("'Process Explorer - Sysinternals: www.sysinternals.com' window is NOT active.")
else
{
ControlClick, TreeListWindowClass1, Process Explorer - Sysinternals: www.sysinternals.com,, RIGHT,, NA x400 y150 ; right-click at coordinates of control
if ErrorLevel
TestsFailed("Unable to perform right-click in 'Process Explorer - Sysinternals: www.sysinternals.com' window.")
else
{
SendInput, p ; Choose 'Properties' from right-click menu
SetTitleMatchMode, 2 ; A window's title can contain WinTitle anywhere inside it to be a match.
WinWaitActive, Properties, Image File, 3
if ErrorLevel
TestsFailed("Right-clicked, sent 'p' to select 'Properties' from menu, but 'Properties (Image File)' window failed to appear.")
else
{
ControlGetText, szPath, Edit2, Properties, Image File ; Get text of 'Path' field
if ErrorLevel
TestsFailed("Unable to get text of 'Path' field in 'Properties (Image File)' window.")
else
{
IfNotExist, %szPath%
TestsFailed("'path' field in 'Properties (Image File)' window contains '" szPath "' and such file does NOT exist.")
else
TestsOK("Read 'Path' fiend in 'Properties (Image File)', got '" szPath "' and such file exist.")
}
}
}
}
}
TestsTotal++
if bContinue
{
WinClose, Properties, Image File
WinWaitClose, Properties, Image File, 3
if ErrorLevel
TestsFailed("Unable to close 'Properties (Image File)' window.")
else
{
WinWaitActive, Process Explorer - Sysinternals: www.sysinternals.com,,3
if ErrorLevel
TestsFailed("Closed 'Properties (Image File)' window, but 'Process Explorer - Sysinternals: www.sysinternals.com' window failed to activate.")
else
{
WinClose, Process Explorer - Sysinternals: www.sysinternals.com
WinWaitClose, Process Explorer - Sysinternals: www.sysinternals.com,,3
if ErrorLevel
TestsFailed("Unable to close 'Process Explorer - Sysinternals: www.sysinternals.com' window.")
else
{
Process, WaitClose, %ProcessExe%, 15 ; It takes some time for process to close
if ErrorLevel
TestsFailed("'Process Explorer - Sysinternals: www.sysinternals.com' window closed, but '" ProcessExe "' process failed to.")
else
TestsOK("Closed 'Process Explorer - Sysinternals: www.sysinternals.com' window and '" ProcessExe "' process closed too.")
}
}
}
}

View File

@ -0,0 +1,43 @@
/*
* Designed for Process Explorer 15.3
* Copyright (C) 2013 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
*/
#Include ..\..\helper_functions.ahk
InitalizeCounters()
params =
(
1.view_properties
)
if CheckParam()
{
; Those brackets are required!
if 1 != --list
{
#include prepare.ahk
if 1 = 1.view_properties
{
#include view_properties.ahk
}
}
}
ShowTestResults()