[AHK_Notepad++_6.1.2]

Check if can continue before actually continuing. 
All tests succeeds in 2k3 SP1.

svn path=/trunk/ahk_tests/; revision=2035
This commit is contained in:
Edijs Kolesnikovičs 2013-05-26 04:22:27 +00:00
parent 89d81dfa82
commit 99fb15fa07
5 changed files with 80 additions and 65 deletions

View File

@ -18,45 +18,48 @@
*/
; Test Ctrl-F 'Find' dialog
TestsTotal++
TestName = 4.Ctrl-F.FindDialog
szDocument = C:\NotepadTestFile.ini ; Case sensitive!
FileDelete, %szDocument%
FileAppend, This text`nwill contain some`nlines. We will use`nit to test dialogs., %szDocument%
if ErrorLevel
TestsFailed("Failed to create '" szDocument "'.")
else
TestsTotal++
if bContinue
{
RunNotepad(szDocument)
IfWinNotActive, %szDocument% - Notepad++
TestsFailed("Window '" szDocument " - Notepad++' is not active.")
FileDelete, %szDocument%
FileAppend, This text`nwill contain some`nlines. We will use`nit to test dialogs., %szDocument%
if ErrorLevel
TestsFailed("Failed to create '" szDocument "'.")
else
{
SendInput, {CTRLDOWN}f{CTRLUP} ; Call dialog using Ctrl+F
WinWaitActive, Find,, 3
if ErrorLevel
TestsFailed("Window 'Find' failed to appear, so Ctrl+F doesn't work, bug #CORE-6112.")
RunNotepad(szDocument)
IfWinNotActive, %szDocument% - Notepad++
TestsFailed("Window '" szDocument " - Notepad++' is not active.")
else
{
TestFindDialog()
if bContinue
TestsOK("Ctrl+F works, found a match.")
}
SendInput, {CTRLDOWN}f{CTRLUP} ; Call dialog using Ctrl+F
WinWaitActive, Find,, 3
if ErrorLevel
TestsFailed("Window 'Find' failed to appear, so Ctrl+F doesn't work, bug #CORE-6112.")
else
{
TestFindDialog()
if bContinue
TestsOK("Ctrl+F works, found a match.")
}
; The window we need is still active, so, check if we can open 'Find' thru main menu
TestsTotal++
SendInput, {ALTDOWN}s ; Hit 'Search'
SendInput, f ; Hit 'Find'
WinWaitActive, Find,,3
if ErrorLevel
TestsFailed("Can't open 'Find' from main menu")
else
{
TestFindDialog()
if bContinue
TestsOK("Alt+S -> F works, found a match.")
; The window we need is still active, so, check if we can open 'Find' thru main menu
TestsTotal++
SendInput, {ALTDOWN}s ; Hit 'Search'
SendInput, f ; Hit 'Find'
WinWaitActive, Find,,3
if ErrorLevel
TestsFailed("Can't open 'Find' from main menu")
else
{
TestFindDialog()
if bContinue
TestsOK("Alt+S -> F works, found a match.")
}
}
}
}

View File

@ -18,48 +18,52 @@
*/
; Test if can create document, open it with Notepad++, delete text, write new one, save and exit
TestsTotal++
TestName = 3.OpenDocument
szDocument = %A_Desktop%\Notepad++Test.txt ; Case sensitive!
FileAppend, One line.`nLine two`nLine 3, %szDocument%
if ErrorLevel
TestsFailed("Failed to create '" szDocument "'.")
else
TestsTotal++
if bContinue
{
RunNotepad(szDocument)
if not bContinue
TestsFailed("We failed somewhere in prepare.ahk.")
FileAppend, One line.`nLine two`nLine 3, %szDocument%
if ErrorLevel
TestsFailed("Failed to create '" szDocument "'.")
else
{
IfWinNotActive, %szDocument% - Notepad++
TestsFailed("Window '" szDocument " - Notepad++' is not active.")
RunNotepad(szDocument)
if not bContinue
TestsFailed("We failed somewhere in prepare.ahk.")
else
{
SendInput, {CTRLDOWN}a{CTRLUP}{BACKSPACE}New text.
WinWaitActive, *%szDocument% - Notepad++,, 3 ; We were able to change text
if ErrorLevel
TestsFailed("Failed to change text.")
IfWinNotActive, %szDocument% - Notepad++
TestsFailed("Window '" szDocument " - Notepad++' is not active.")
else
{
SendInput, {CTRLDOWN}s{CTRLUP}
WinWaitActive, %szDocument% - Notepad++,, 3 ; We were able to save
SendInput, {CTRLDOWN}a{CTRLUP}{BACKSPACE}New text.
WinWaitActive, *%szDocument% - Notepad++,, 3 ; We were able to change text
if ErrorLevel
TestsFailed("Failed to save.")
TestsFailed("Failed to change text.")
else
{
WinClose, %szDocument% - Notepad++,, 3
SendInput, {CTRLDOWN}s{CTRLUP}
WinWaitActive, %szDocument% - Notepad++,, 3 ; We were able to save
if ErrorLevel
TestsFailed("Failed to close '" szDocument " - Notepad++' window.")
TestsFailed("Failed to save.")
else
{
iLines := FileCountLines(szDocument)
if iLines <> 1
TestsFailed("For some reason number of lines is wrong! Is '" iLines "' and should be '1'.")
WinClose, %szDocument% - Notepad++,, 3
if ErrorLevel
TestsFailed("Failed to close '" szDocument " - Notepad++' window.")
else
{
TestsOK("Created a document, opened it with Notepad++, entered some text, saved the doc, closed Notepad++.")
FileDelete, %szDocument%
iLines := FileCountLines(szDocument)
if iLines <> 1
TestsFailed("For some reason number of lines is wrong! Is '" iLines "' and should be '1'.")
else
{
TestsOK("Created a document, opened it with Notepad++, entered some text, saved the doc, closed Notepad++.")
FileDelete, %szDocument%
}
}
}
}

View File

@ -18,14 +18,18 @@
*/
; Type some text and test if 'Save As' dialog can appear
TestsTotal++
TestName = 2.SaveAsDesktop
szDocument = ; Case sensitive! [No file to open]
RunNotepad(szDocument)
if not bContinue
TestsFailed("We failed somewhere in prepare.ahk.")
else
if bContinue
{
RunNotepad(szDocument)
}
TestsTotal++
if bContinue
{
IfWinNotActive, new 1 - Notepad++
TestsFailed("Window 'new 1 - Notepad++' is not active.")

View File

@ -18,17 +18,21 @@
*/
; Type some text and test if 'Save As' dialog can appear
TestsTotal++
TestName = 5.Send_Input
szDocument = ; Case sensitive! [No file to open]
CharList1 = 0123456789
CharList2 = abcdefghijklmnopqrstuvwxyz
CharList3 := "|\,.~$%&*()_[];:'@?/<>"
RunNotepad(szDocument)
if not bContinue
TestsFailed("We failed somewhere in prepare.ahk.")
else
if bContinue
{
RunNotepad(szDocument)
}
TestsTotal++
if bContinue
{
IfWinNotActive, new 1 - Notepad++
TestsFailed("Window 'new 1 - Notepad++' is not active.")

View File

@ -18,7 +18,6 @@
*/
; Test if can create and save new document
TestsTotal++
TestName = 6.new_document
szDocument = C:\Notepad_New_Doc.txt ; Case sensitive!
@ -28,6 +27,7 @@ if bContinue
RunNotepad("")
}
TestsTotal++
if bContinue
{