mirror of
https://github.com/reactos/ahk_tests.git
synced 2024-11-23 11:39:42 +00:00
[AHK_Fox_Audio_Player_0.9.1]
Add test to see if can play wav file. Tested on Win7 x64, because of failure to set correct VM settings for win2k3 sp2. svn path=/trunk/ahk_tests/; revision=1885
This commit is contained in:
parent
67a1499a31
commit
4f82725b1d
76
Fox Audio Player/0.9.1/play_wav.ahk
Normal file
76
Fox Audio Player/0.9.1/play_wav.ahk
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Designed for Fox Audio Player 0.9.1
|
||||
* 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.play_wav
|
||||
szDocument = %A_WorkingDir%\Media\ReactOS_LogOn.wav ; Case insensitive
|
||||
|
||||
; Test if can play wav and exit application
|
||||
TestsTotal++
|
||||
RunApplication(szDocument) ; it will check for file existence
|
||||
if not bContinue
|
||||
TestsFailed("We failed somwehere in 'prepare.ahk'.")
|
||||
else
|
||||
{
|
||||
SplitPath, szDocument,,,, name_no_ext
|
||||
IfWinNotActive, %name_no_ext%
|
||||
TestsFailed("'" name_no_ext "' window is not an active.")
|
||||
else
|
||||
{
|
||||
PosX = 115
|
||||
PosY = 82
|
||||
szColorGreen = 0x00E300 ; Green
|
||||
szColorRed = 0x0000E3
|
||||
Sleep, 1000 ; Small delay required for playing to start
|
||||
PixelGetColor, color, %PosX%, %PosY% ; red/green circle in top left side of the window
|
||||
if (color != szColorGreen)
|
||||
TestsFailed("Pixel colors doesn't match (is '" color "', should be '" szColorGreen "').")
|
||||
else
|
||||
{
|
||||
; Color is green, wait until playing stops
|
||||
iTimeOut = 8 ; wav length is 3sec, but we want to be REALLY sure
|
||||
while (color = szColorGreen)
|
||||
{
|
||||
iTimeOut--
|
||||
Sleep, 1000
|
||||
PixelGetColor, color, %PosX%, %PosY%
|
||||
if (iTimeOut = 0)
|
||||
break ; Timed out, break the loop
|
||||
}
|
||||
|
||||
PixelGetColor, color, %PosX%, %PosY%
|
||||
if (color = szColorGreen)
|
||||
TestsFailed("Pixel color is still '" szColorGreen "' (iTimeOut=" iTimeOut ").")
|
||||
else
|
||||
{
|
||||
WinClose
|
||||
WinWaitClose, %name_no_ext%,,3
|
||||
if ErrorLevel
|
||||
TestsFailed("Unable to close '" name_no_ext "' window.")
|
||||
else
|
||||
{
|
||||
Process, WaitClose, %ProcessExe%, 4
|
||||
if ErrorLevel
|
||||
TestsFailed("'" ProcessExe "' process failed to close despite '" name_no_ext "' window closed.")
|
||||
else
|
||||
TestsOK("Played wav, closed '" name_no_ext "' window, '" ProcessExe "' process closed too.")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
107
Fox Audio Player/0.9.1/prepare.ahk
Normal file
107
Fox Audio Player/0.9.1/prepare.ahk
Normal file
@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Designed for Fox Audio Player 0.9.1
|
||||
* 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
|
||||
|
||||
InstallLocation = %A_ProgramFiles%\Fox Audio Player\fap-0.9.1-win32-bin
|
||||
ModuleExe = %InstallLocation%\fap.exe
|
||||
bContinue := true
|
||||
|
||||
|
||||
; Terminate application
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
SplitPath, ModuleExe, ProcessExe
|
||||
Process, Close, %ProcessExe%
|
||||
Process, WaitClose, %ProcessExe%, 4
|
||||
if ErrorLevel
|
||||
TestsFailed("Unable to terminate '" ProcessExe "' process.")
|
||||
else
|
||||
TestsOK("")
|
||||
}
|
||||
|
||||
|
||||
; Delete settings separately from RunApplication() in case we want to write our own settings
|
||||
RegDelete, HKEY_CURRENT_USER, Software\DrFiemost
|
||||
|
||||
|
||||
; Test if can start application
|
||||
RunApplication(PathToFile)
|
||||
{
|
||||
global ModuleExe
|
||||
global TestName
|
||||
global TestsTotal
|
||||
global bContinue
|
||||
global ProcessExe
|
||||
|
||||
TestsTotal++
|
||||
if bContinue
|
||||
{
|
||||
IfNotExist, %ModuleExe%
|
||||
TestsFailed("Can NOT find '" ModuleExe "'.")
|
||||
else
|
||||
{
|
||||
if PathToFile =
|
||||
{
|
||||
Run, %ModuleExe%
|
||||
WinWaitActive, Fox Audio Player,,7
|
||||
if ErrorLevel
|
||||
{
|
||||
Process, Exist, %ProcessExe%
|
||||
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
|
||||
if NewPID = 0
|
||||
TestsFailed("Window 'Fox Audio Player' failed to appear. No '" ProcessExe "' process detected.")
|
||||
else
|
||||
TestsFailed("Window 'Fox Audio Player' failed to appear. '" ProcessExe "' process detected.")
|
||||
}
|
||||
else
|
||||
{
|
||||
WinMaximize
|
||||
TestsOK("")
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IfNotExist, %PathToFile%
|
||||
TestsFailed("Can NOT find '" PathToFile "'.")
|
||||
else
|
||||
{
|
||||
Run, %ModuleExe% "%PathToFile%"
|
||||
SplitPath, PathToFile,,,, name_no_ext
|
||||
WinWaitActive, %name_no_ext%,,7
|
||||
if ErrorLevel
|
||||
{
|
||||
Process, Exist, %ProcessExe%
|
||||
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
|
||||
if NewPID = 0
|
||||
TestsFailed("Window '" name_no_ext "' failed to appear. No '" ProcessExe "' process detected.")
|
||||
else
|
||||
TestsFailed("Window '" name_no_ext "' failed to appear. '" ProcessExe "' process detected.")
|
||||
}
|
||||
else
|
||||
{
|
||||
WinMaximize
|
||||
TestsOK("")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -24,6 +24,7 @@ params =
|
||||
(
|
||||
|
||||
1.install
|
||||
2.play_wav
|
||||
|
||||
)
|
||||
|
||||
@ -34,6 +35,15 @@ if CheckParam()
|
||||
{
|
||||
#include install_test.ahk
|
||||
}
|
||||
else
|
||||
{
|
||||
#include prepare.ahk
|
||||
|
||||
if 1 = 2.play_wav
|
||||
{
|
||||
#include play_wav.ahk
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ShowTestResults()
|
||||
|
Loading…
Reference in New Issue
Block a user