[AHK_mIRC_6.35]

Add prepare.ahk that connects to irc.freenode.net #reactos-testers channel and test that writes some text in channel and closes application.
Tested and works on WinXP SP3.

svn path=/trunk/ahk_tests/; revision=1505
This commit is contained in:
Edijs Kolesnikovičs 2012-08-15 21:48:06 +00:00
parent 4351bdf8a7
commit 37d12684fe
4 changed files with 230 additions and 0 deletions

105
mIRC/6.35/ChatTest.ahk Normal file
View File

@ -0,0 +1,105 @@
/*
* 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
*/
bContinue := false
TestsTotal := 0
TestsSkipped := 0
TestsFailed := 0
TestsOK := 0
TestsExecuted := 0
TestName = 2.ChatTest
; Test if can type some text in chat window (IRC channel) and exit application correctly
TestsTotal++
WinWaitActive, mIRC,,7
if not ErrorLevel
{
TimeOut := 0
ControlGet, OutputVar, Visible,, Static2, mIRC ; Wait until chat window appears
while OutputVar <> 1
{
ControlGet, OutputVar, Visible,, Static2, mIRC
TimeOut++
Sleep, 1000
bContinue := true
if TimeOut > 35
{
TestsFailed()
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Timed out.`n
Process, Close, mirc.exe
Sleep, 1500
Break ; exit loop
}
}
if bContinue
{
Sleep, 1500
ControlSetText, RichEdit20A1, I confirm that mIRC 6.35 is working on ReactOS, mIRC
if not ErrorLevel
{
SendInput, {ENTER} ; Send text to IRC channel
WinClose, mIRC
WinWaitActive, Confirm Exit, Are you sure,7
if not ErrorLevel
{
ControlClick, Button1, Confirm Exit, Are you sure ; Hit 'Yes' button
if not ErrorLevel
{
WinWaitClose, mIRC,,7
if not ErrorLevel
{
TestsOK()
OutputDebug, %TestName%:%A_LineNumber%: OK: Connected to IRC server, entered some text in channel and closed application successfully.`n
}
else
{
TestsFailed()
WinGetTitle, title, A
OutputDebug, %TestName%:%A_LineNumber%: Test failed: 'mIRC' window failed to disappear after exit was confirmed. Active window caption: '%title%'`n
}
}
else
{
TestsFailed()
WinGetTitle, title, A
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Unable to hit 'Yes' button in 'Confirm Exit (Are you sure)' window. Active window caption: '%title%'`n
}
}
else
{
TestsFailed()
WinGetTitle, title, A
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Window 'Confirm Exit (Are you sure)' failed to appear. Active window caption: '%title%'`n
}
}
else
{
TestsFailed()
WinGetTitle, title, A
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Unable to set chat text in 'mIRC' window. Active window caption: '%title%'`n
}
}
}
else
{
TestsFailed()
WinGetTitle, title, A
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Window 'mIRC' failed to appear. Active window caption: '%title%'`n
}

View File

@ -83,6 +83,7 @@ IfExist, %ModuleExe%
}
if bContinue
{
FileRemoveDir, %A_AppData%\mIRC, 1
Run %ModuleExe%
}
}

117
mIRC/6.35/prepare.ahk Normal file
View File

@ -0,0 +1,117 @@
/*
* 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
*/
bContinue := false
TestsTotal := 0
TestsSkipped := 0
TestsFailed := 0
TestsOK := 0
TestsExecuted := 0
TestName = prepare
; Disable some windows, configure, start mirc, connect to irc.freenode.net, #ReactOS_Test channel
Process, Close, mirc.exe
Sleep, 1500
RegRead, InstallLocation, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\mIRC, InstallLocation
if not ErrorLevel
{
StringReplace, InstallLocation, InstallLocation, `",, All ; String contains quotes, replace em
ModuleExe = %InstallLocation%\mirc.exe
}
else
{
ModuleExe = %A_ProgramFiles%\mIRC\mirc.exe
OutputDebug, %TestName%:%A_LineNumber%: Can NOT read data from registry. Key might not exist. Using hardcoded path.`n
}
IfExist, %ModuleExe%
{
FileRemoveDir, %A_AppData%\mIRC, 1 ; Delete saved settings
FileCreateDir, %A_AppData%\mIRC
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 not ErrorLevel
{
Run, %ModuleExe%,, Max
WinWaitActive, About mIRC,,10
if not ErrorLevel
{
Sleep, 1000
ControlClick, Button3, About mIRC ; Click 'Continue' button
if not ErrorLevel
{
WinWaitActive, mIRC Options, Category, 7
if not ErrorLevel
{
Sleep, 2000
ControlClick, Button6, mIRC Options, Category ; Hit 'Connect'
if not ErrorLevel
{
WinWaitactive, mIRC,,20
if not ErrorLevel
{
bContinue := true
}
else
{
WinGetTitle, title, A
OutputDebug, %TestName%:%A_LineNumber%: Test failed: 'mIRC' is not active window. Active window caption: '%title%'`n
}
}
else
{
WinGetTitle, title, A
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Unable to hit 'Connect' in 'mIRC Options (Category)' window. Active window caption: '%title%'`n
}
}
else
{
WinGetTitle, title, A
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Window 'mIRC Options (Category)' failed to appear. Active window caption: '%title%'`n
}
}
else
{
WinGetTitle, title, A
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Unable to hit 'Continue' button in 'About mIRC' window. Active window caption: '%title%'`n
}
}
else
{
WinGetTitle, title, A
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Window 'About mIRC' failed to appear. Active window caption: '%title%'`n
}
}
else
{
WinGetTitle, title, A
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Can NOT create and edit '%A_AppData%\mIRC\mirc.ini'. Active window caption: '%title%'`n
}
}
else
{
OutputDebug, %TestName%:%A_LineNumber%: Test failed: Can NOT find '%ModuleExe%'.`n
}

View File

@ -36,6 +36,13 @@ else if 1 = 1.install
}
else
{
#include prepare.ahk
if 1 = 2.ChatTest
{
#include ChatTest.ahk ; Type some text in chat window (IRC channel) and exit application correctly
}
else
OutputDebug, Bad parameters!`r`n
}