[AHK_mIRC_7.25]

Add a test to see if application can connect to IRC.
Tested and works in win2k3 sp2.

svn path=/trunk/ahk_tests/; revision=1836
This commit is contained in:
Edijs Kolesnikovičs 2012-10-12 09:09:41 +00:00
parent 681cad2778
commit 8d2f30a758
3 changed files with 236 additions and 0 deletions

86
mIRC/7.25/ChatTest.ahk Normal file
View File

@ -0,0 +1,86 @@
/*
* Designed for mIRC 6.35
* 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.ChatTest
; Test if can type some text in chat window (IRC channel) and exit application correctly
TestsTotal++
if not bContinue
TestsFailed("We failed somwehere in 'prepare.ahk'.")
else
{
WinWaitActive, mIRC,,3
if ErrorLevel
TestsFailed("Window 'mIRC' failed to appear.")
else
{
iTimeOut := 45
while iTimeOut > 0
{
IfWinActive, mIRC
{
ControlGet, OutputVar, Visible,, Static2, mIRC ; Wait until chat window appears
if OutputVar = 1
break
else
{
Sleep, 1000
iTimeOut--
}
}
else
break ; exit the loop if something poped-up
}
if OutputVar <> 1
{
ControlGetText, szStatus, mIRC_Status1, mIRC
TestsFailed("Chat window failed to appear. Status: '" szStatus "'. (iTimeOut=" iTimeOut ")")
}
else
{
ControlSetText, RichEdit20W1, I confirm that mIRC 7.25 is working on ReactOS, mIRC
if ErrorLevel
TestsFailed("Unable to set chat text in 'mIRC' window.")
else
{
SendInput, {ENTER} ; Send text to IRC channel
WinClose, mIRC
WinWaitActive, Confirm Exit, Are you sure,7
if ErrorLevel
TestsFailed("Window 'Confirm Exit (Are you sure)' failed to appear.")
else
{
SendInput, !y ; Hit 'Yes' button
WinWaitClose, Confirm Exit, Are you sure, 3
if ErrorLevel
TestsFailed("'Confirm Exit (Are you sure)' window failed to close despite Alt+Y was sent.")
else
{
WinWaitClose, mIRC,,3
if ErrorLevel
TestsFailed("'mIRC' window failed to disappear after exit was confirmed.")
else
TestsOK("Connected to IRC server, entered some text in channel and closed application successfully.")
}
}
}
}
}
}

140
mIRC/7.25/prepare.ahk Normal file
View File

@ -0,0 +1,140 @@
/*
* Designed for mIRC 6.35
* 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
; Disable some windows, configure, start mirc, connect to irc.freenode.net, #ReactOS_Test channel
; Test if the app is installed
TestsTotal++
RegRead, InstallLocation, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\mIRC, InstallLocation
if ErrorLevel
TestsFailed("Either registry key does not exist or we failed to read it.")
else
{
ModuleExe = %InstallLocation%\mirc.exe
TestsOK("")
}
; Test if connected to the Internet
TestsTotal++
if bContinue
{
if not bIsConnectedToInternet()
TestsFailed("No internet connection detected.")
else
TestsOK("Internet connection detected.")
}
; Terminate application
TestsTotal++
if bContinue
{
SplitPath, ModuleExe, ProcessExe
Process, Close, %ProcessExe%
Process, WaitClose, %ProcessExe%, 4
if ErrorLevel
TestsFailed("Process '" ProcessExe "' failed to close.")
else
TestsOK("")
}
; Delete settings separately from RunApplication()
TestsTotal++
if bContinue
{
IfExist, %A_AppData%\mIRC
FileRemoveDir, %A_AppData%\mIRC, 1 ; Delete saved settings
IfExist, %A_AppData%\mIRC
TestsFailed("Unable to delete '" A_AppData "\mIRC'.")
else
{
FileCreateDir, %A_AppData%\mIRC
if ErrorLevel
TestsFailed("Unable to create '" A_AppData "\mIRC'.")
else
{
szNoUpdate := "[Update]`nCheck=0`n" ; Disable update check
szUserInfo := "[mirc]`nuser=Edijs Kole`nemail=fake_email@yahoo.com`nnick=mIRC_Test`nanick=ROS_mIRC`n" ; Enter user information
szServerAndChan := "host=FreenodeSERVER:irc.freenode.net:6667`n[chanfolder]`nn0=#ReactOS-testers`,`,`,`,1`n"
szNoConError := "[wizard]`nwarning=2`n" ; Disable connection error window
szNoFavourites1 := "[options]`nn1=5`,100`,1`,1`,0`,2`,6`,2`,0`,1`,0`,1`,1`,1`,1`,1`,1`,1`,0`,0`,1`,1`,1`,0`,5`,0`,1`,0`,0`,0`,1`,0`,0`,0`,1`,10`n"
szNoFavourites2 := "n4=1`,1`,1`,0`,0`,3`,9999`,0`,0`,1`,1`,0`,1024`,1`,1`,99`,60`,0`,0`,0`,1`,1`,1`,0`,0`,5000`,1`,5`,0`,0`,3`,0`,1`,1`,0`,0`,1`n"
FileAppend, %szNoUpdate%%szUserInfo%%szServerAndChan%%szNoConError%%szNoFavourites1%%szNoFavourites2%, %A_AppData%\mIRC\mirc.ini
if ErrorLevel
TestsFailed("Can NOT create and edit '" A_AppData "\mIRC\mirc.ini'.")
else
TestsOK("")
}
}
}
TestsTotal++
if bContinue
{
IfNotExist, %ModuleExe%
TestsFailed("Can NOT find '" ModuleExe "'.")
else
{
Run, %ModuleExe%,, Max
WinWaitActive, About mIRC,,10
if ErrorLevel
{
Process, Exist, %ProcessExe%
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
if NewPID = 0
TestsFailed("Window 'About mIRC' failed to appear. No '" ProcessExe "' process detected.")
else
TestsFailed("Window 'About mIRC' failed to appear. '" ProcessExe "' process detected.")
}
else
{
SendInput, {TAB} ; Focus 'Continue' button
Sleep, 200
SendInput, {ENTER} ; Hit 'Continue' button
WinWaitClose, About mIRC,,3
if ErrorLevel
TestsFailed("'About mIRC' window failed to close despite TAB, ENTER was sent.")
else
{
WinWaitActive, mIRC Options, Category, 3
if ErrorLevel
TestsFailed("Window 'mIRC Options (Category)' failed to appear.")
else
{
SendInput, !c ; Hit 'Connect' button
WinWaitClose, mIRC Options, Category, 3
if ErrorLevel
TestsFailed("'mIRC Options (Category)' window failed to close despite Alt+C was sent.")
else
{
WinWaitactive, mIRC,,20
if ErrorLevel
TestsFailed("'mIRC' is not active window.")
else
TestsOK("")
}
}
}
}
}
}

View File

@ -24,6 +24,7 @@ params =
(
1.install
2.ChatTest
)
@ -34,6 +35,15 @@ if CheckParam()
{
#include install_test.ahk
}
else
{
#include prepare.ahk
if 1 = 2.ChatTest
{
#include ChatTest.ahk
}
}
}
ShowTestResults()