summaryrefslogtreecommitdiff
path: root/testautomation/graphics/optional/includes/global/g_spellcheck.inc
diff options
context:
space:
mode:
Diffstat (limited to 'testautomation/graphics/optional/includes/global/g_spellcheck.inc')
-rw-r--r--testautomation/graphics/optional/includes/global/g_spellcheck.inc975
1 files changed, 276 insertions, 699 deletions
diff --git a/testautomation/graphics/optional/includes/global/g_spellcheck.inc b/testautomation/graphics/optional/includes/global/g_spellcheck.inc
index 1c82bf3921c3..1684738ded35 100644
--- a/testautomation/graphics/optional/includes/global/g_spellcheck.inc
+++ b/testautomation/graphics/optional/includes/global/g_spellcheck.inc
@@ -29,113 +29,75 @@
'*
'* short description :
'*
-'*******************************************************************
-'*
-' #1 tiToolsSpellcheckCorrect
-' #1 tiToolsSpellcheckError
-' #1 tiToolsSpellcheckCheck
-' #1 tToolsSpellcheckAutoSpellcheck
-'*
'\*******************************************************************
-testcase tiToolsSpellcheckCorrect
- if iSprache = 48 then
- qaerrorlog "This test is not adapted for polish, 48."
- got endsub
+testcase tiToolsSpellcheckCheck_AlwaysIgnore
+
+ Dim sExt as string
+
+ Dim sWrongWord as String
+ Dim sRightWord as string
+
+ dim aWords(2) as string
+ aWords() = getWordsForLanguage()
+
+ sWrongWord = aWords(0)
+ sRightWord = aWords(1)
+
+ if(sWrongWord = "" OR sRightWord = "") then ' if any word is empty then the test should stop
+ qaerrorlog "no spellcheck test for the langauges " + iSprache + " available."
+ goto endsub
endif
- Dim DieDatei as String
- dim lFiles(100) as string
- dim i as integer
- dim iFiles as integer
+ delete_word_from_dictionary(sWrongWord,"IgnoreAllList")
- lFiles(0)=0
- Printlog "- Checking Dictionary-Files" ' borrowed from w_106.inc
- select case iSprache
- case 01 : DieDatei = "01-44-hyph.dat"
- case else : DieDatei = "" & iSprache & "-hyph.dat"
- end select
- DieDatei = Convertpath(gNetzOfficePath + "share\dict\" + DieDatei)
- if gPlatGroup <> "unx" then
- if (Dir(DieDatei) = "") then
- if bAsianLan then
- printlog "Dictionary not found : " + DieDatei + ", but is AsianLan, so OK :-)"
- else
- if gNetzInst then
- printlog "Dictionary not found : " + DieDatei
- else
- warnlog "Dictionary not found : " + DieDatei
- end if
- end if
- else
- Printlog " Dictionary has been installed : " + DieDatei
- end if
- end if
- iFiles = GetFileList (Convertpath (gNetzOfficePath + "share\dict\"), "*.dat" ,lFiles())
- for i = 1 to iFiles
- printlog " " + i + ": " + DateiExtract(lFiles(i))
- next i
+ if Ucase(gApplication) = "DRAW" then
+ sExt = ".odg"
+ else
+ sExt = ".odp"
+ endif
- Call hNewDocument
- ' sleep 2
- ToolsSpellcheck
- Kontext "Active"
- if Active.Exists(5) then
- try
- printlog "Message: Finished: Want to continue at the beginning? '" + active.gettext + "'"
- Active.No
- catch
- Warnlog "The Active-dialoge didn't have a No-button, tries with OK instead."
- Active.Ok
- endcatch
+ Call hFileOpenLocally (gTesttoolpath + "graphics\required\input\recht_"+iSprache+sExt)
+
+ sleep(1)
+
+ ' Perform the test now:
+ printlog "Call Tools->Spellcheck"
+ ToolsSpellcheck
+ sleep(2)
+ Kontext "Spellcheck"
+ printlog "Click button 'Always ignore' on dialog."
+ IgnoreAll.Click
+ Sleep 2
+
+ ToolsOptions
+ printlog "Select in category 'Languagesettings' entry 'Writing Aids.'"
+ hToolsOptions ("LANGUAGESETTINGS","WRITINGAIDS")
+
+ fSelectWithString(Benutzerwoerterbuch,"IgnoreAllList")
+
+ Bearbeiten.Click
+
+ Kontext "BenutzerwoerterbuchBearbeiten"
+ if(Inhalt.getText <> sWrongWord) then
+ warnlog " added word is not in dictionary: '" + Buch.getSelText + "'"
else
- Warnlog "No 'Spellcheck finished, do you wish to continue?' message appeared"
+ printlog " added word is in dictionary: '" + Buch.getSelText + "'"
end if
sleep 2
- PrintLog "- Spellcheck with correct text"
- select case iSprache
- case 01 : hTextrahmenErstellen ("This is a text without any error.<Return>",10,10,50,20)
- case 33 : hTextrahmenErstellen ("Il nous faut donc un de temps pour examiner avec soin tous les dossiers.<Return>",10,10,70,20)
- case 34 : hTextrahmenErstellen ("Este es un chico muy importante.",10,10,50,20)
- case 36 : hTextrahmenErstellen ("akit a b�r�s�g vagy a szab�lys�rt�si hat�s�g a eltiltott",10,10,70,20)
- case 39 : hTextrahmenErstellen ("La ringraziamo per l'interesse mostrato a collaborare con la firma.<Return>",10,10,70,20)
- case 46 : hTextrahmenErstellen ("Det varierar vad som behandlas och ur vilket perspektiv.<Return>",10,10,50,20)
- case 49 : hTextrahmenErstellen ("Dies ist ein Text ohne Fehler.<Return>",10,10,50,20)
- case 50 : hTextrahmenErstellen ("To je besedilo brez napake.<Return>",10,10,50,20)
- case 55 : hTextrahmenErstellen ("Esta poderia ser a resposta para suas preces?<Return>",10,10,50,20)
- case else :
- if bAsianLan then
- printlog "For the language " + iSprache +" nothing is prepared yet, but is AsianLan, so OK :-) will use english instaed"
- ' there was smth wrong, try to find out :
- kontext
- if active.exists then
- printlog "ERROR: active: '"+active.gettext+"'"
- active.ok
- end if
- hTextrahmenErstellen ("This is a text without any error.<Return>",10,10,50,20)
- else
- Warnlog "For the language " + iSprache +" nothing is prepared yet: insert text here"
- hTextrahmenErstellen ("This is a text without any error.<Return>",10,10,50,20)
- end if
- end select
- ToolsSpellcheck
- WaitSlot (2000)
- Kontext "Active"
- if active.exists(5) then
- printlog "Message: spellchecking has finished?: '" + active.gettext + "'"
- Active.OK
- else
- errorLog "Spellcheck started :"
- Kontext "Spellcheck"
- if Spellcheck.exists then
- errorlog " - spellcheck came up and will be closed now"
- Spellcheck.Close
- else
- printlog "spellcheck didn't come up"
- end if
- end if
- WaitSlot (2000)
+ printlog "Close dialog 'Edit Custom Dictionary'."
+ BenutzerwoerterbuchBearbeiten.Close
+ Kontext "ExtrasOptionenDlg"
+ printlog "Close the Option dialog."
+ ExtrasOptionenDlg.OK
+
+ printlog "Close document"
Call hCloseDocument
+
+ ' remove the word again from the dictionary
+ delete_word_from_dictionary(sWrongWord,"IgnoreAllList")
+
+ kill (convertPath(gOfficePath+"user/work/"+"recht_"+iSprache+sExt))
endcase 'tiToolsSpellcheckCorrect
'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -161,7 +123,7 @@ testcase tiToolsSpellcheckError
case 39 : FehlerText$ = "Ringrarziamo per l'interessa mostrato a collaborare con la firma." : Fehler$ = "Ringrarziamo" : Sprachenname$ = "Italienisch"
case 46 : FehlerText$ = "Detd varierar vad som behandlas och ur vilket perspektiv." : Fehler$ = "Detd" : Sprachenname$ = "Schwedisch"
case 49 : FehlerText$ = "Diees ist ein Fehler." : Fehler$ = "Diees" : Sprachenname$ = "Deutsch"
- case 50 : FehlerText$ = "Toje napaka, ker manjka presledek." : Fehler$ = "Toje" : Sprachenname$ = "Slovenščina"
+ case 50 : FehlerText$ = "Toje napaka, ker manjka presledek." : Fehler$ = "Toje" : Sprachenname$ = "Slovenš�?ina"
case 55 : FehlerText$ = "Eesta poderia ser a resposta para suas preces?": Fehler$ = "Eesta" : Sprachenname$ = "Portugiesisch"
case else :
if bAsianLan then
@@ -250,180 +212,139 @@ testcase tiToolsSpellcheckError
end if
end if
- printlog "delete textbox"
- EditSelectAll
- hTypeKeys "<DELETE>"
- sleep 1
+ printlog "Close document"
+ Call hCloseDocument
- printlog "Create same textbox again (test IGNORE function)."
- Printlog "Check function Ignore"
- hTextrahmenErstellen (FehlerText$,30,30,80,40)
- printlog "All 'Tools->Spellcheck->Check'."
-
- 'printlog "Setting Text to english"
- 'sleep 1
- 'EditSelectAll
- 'FormatCharacter
- 'sleep 1
- 'Kontext
- 'Messagebox.SetPage TabFont
- 'Kontext "TabFont"
- 'Language.Select 41
- 'TabFont.OK
+endcase 'tiToolsSpellcheckCorrect
- ToolsSpellcheck
- Kontext "Spellcheck"
- printlog "press button 'Ignore'"
- IgnoreOnce.Click
- printlog "spellcheck dialog has to disappear and "
- printlog " There has to come up only one active: 'Spellcheck of entire document has been completed [OK]'."
- Kontext "Active"
- if Active.Exists(5) Then
- Printlog " Spellcheck ended because of only 1 defined error. And Ignore worked.'" + active.gettext + "'"
- Active.OK
+'-------------------------------------------------------------------------------
+testcase tiToolsSpellcheckCheck_Change
+
+ Dim sExt as string
+ Dim sWrongWord as String
+ Dim sRightWord as string
+
+ dim aWords(2) as string
+ aWords() = getWordsForLanguage()
+
+ sWrongWord = aWords(0)
+ sRightWord = aWords(1)
+
+ if(sWrongWord = "" OR sRightWord = "") then ' if any word is empty then the test should stop
+ qaerrorlog "no spellcheck test for the langauges " + iSprache + " available."
+ goto endsub
+ endif
+
+ if Ucase(gApplication) = "DRAW" then
+ sExt = ".odg"
else
- Printlog " 'Ignore Once' seems to work correctly."
- Kontext "Spellcheck"
- Spellcheck.Close
- Kontext "Active"
- if active.exists(5) then
- Printlog " Spellcheck dialog closed'" + active.gettext + "'"
- Active.OK
- else
- Printlog " Spellcheck dialog closed'"
- end if
- end if
+ sExt = ".odp"
+ endif
- printlog "Call 'Tools->Spellcheck->Check."
+ Call hFileOpenLocally (gTesttoolpath + "graphics\required\input\recht_"+iSprache+sExt)
+
+ ' Perform the test now:
+ printlog "Call Tools->Spellcheck"
ToolsSpellcheck
+ sleep(2)
Kontext "Spellcheck"
- if Spellcheck.Exists Then
- Printlog " Ignore worked"
- Spellcheck.Close
- Kontext "Active"
- if active.exists(5) then
- Printlog " " + active.gettext + "'"
- Active.OK
- else
- Printlog " Spellcheck dialog closed'"
- end if
+ printlog "Click button 'Change' on dialog."
+ Change.Click
+ sleep(10)
+ SpellcheckClose.click
+
+ if Ucase(gApplication) = "DRAW" then
+ Kontext "DocumentDraw"
+ DocumentDraw.TypeKeys("<TAB>",true)
+ DocumentDraw.TypeKeys("<SPACE>",true)
else
- Warnlog " Spellcheck ended even we only ignored the error"
- end if
+ Kontext "DocumentImpress"
+ DocumentImpress.TypeKeys("<TAB>",true)
+ DocumentImpress.TypeKeys("<SPACE>",true)
+ endif
- printlog "delete textbox."
EditSelectAll
- hTypeKeys "<DELETE>"
- sleep 1
+ EditCopy
+
+ dim s as string
+ s = getClipBoard()
- printlog "create same textbox again (test ALWAYS IGNORE function)."
- hTextrahmenErstellen (FehlerText$,30,30,60,40)
-
- 'printlog "Setting Text to english"
- 'sleep 1
- 'EditSelectAll
- 'FormatCharacter
- 'sleep 1
- 'Kontext
- 'Messagebox.SetPage TabFont
- 'Kontext "TabFont"
- 'Language.Select 41
- 'TabFont.OK
-
- printlog "Call 'Tools->Spellcheck->Check'."
- ToolsSpellcheck
- Kontext "Spellcheck"
- printlog "click button 'Always Ignore."
- IgnoreAll.Click
- printlog "spellcheck dialog has to disappear and"
- printlog "There has to come up only one active: 'Spellcheck of entire document has been completed [OK]'."
- Kontext "Active"
- if active.exists(5) then
- Printlog " Spellcheck ended because of only 1 defined error. And Ignore worked.'" + active.gettext + "'"
- Active.OK
+ printlog s
+
+ if(Instr(s,sWrongWord) <> 0) then
+ warnlog "word not changed. '" + s + "' contains still wrong word '" + sWrongWord + "'"
else
- Printlog " 'Ignore All' seems to work."
- Kontext "Spellcheck"
- Spellcheck.Close
- Kontext "Active"
- if active.exists(5) then
- Printlog " Spellcheck dialog closed'" + active.gettext + "'"
- Active.OK
- else
- Printlog " Spellcheck dialog closed'"
- end if
- end if
+ printlog "word changed."
+ endif
- Printlog "- Delete ignore list"
- sleep 1
- printlog "Delete ignore word list."
- if (not wIgnorierenlisteLoeschen) then
- qaErrorLog "Can't get into Dictionary lists"
- goto endsub
- end if
+ if(Instr(s,sRightWord) <> 0) then
+ printlog "word changed."
+ else
+ warnlog "word not changed."
+ endif
+
+ printlog "Close document"
Call hCloseDocument
-endcase 'tiToolsSpellcheckError
+ kill (convertPath(gOfficePath+"user/work/"+"recht_"+iSprache+sExt))
+
+endcase 'tiToolsSpellcheckCheck_Change
+'-------------------------------------------------------------------------------
+testcase tiToolsSpellcheckCheck_ChangeAll
-'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-testcase tiToolsSpellcheckCheck
- if iSprache = 48 then
- qaerrorlog "This test is not adapted for polish, 48."
- got endsub
- endif
- Dim Datei$
- Dim sWord(2) as string
- Dim i as integer
- Dim j as integer
- Dim s as integer
- Dim AlleBuecher as integer
Dim sExt as string
- Dim sWordOne as string
- Dim sWordTwo as string
- Dim iBooks as integer
- Dim bWordFound(2) as boolean
- Dim iSuggestions as integer
- Dim iWord(2) as integer
- Dim bFound as boolean
-
- Select Case Ucase(gApplication)
- case "DRAW" : sExt = ".odg"
- case "IMPRESS" : sExt = ".odp"
- end select
+ Dim sRightWord as String
+ Dim sWrongWord as string
+
+ dim aWords(2) as string
+ aWords() = getWordsForLanguage()
- printlog "Load prepared document containing 4 errors : graphics\\required\\input\\recht_" & iSprache & sExt
- if (not bAsianLan) then
- printlog "Check if the document is writable."
- Call hFileOpen (gTesttoolpath + "graphics\required\input\recht_"+iSprache+sExt)
+ sWrongWord = aWords(0)
+ sRightWord = aWords(1)
+
+ if(sWrongWord = "" OR sRightWord = "") then ' if any word is empty then the test should stop
+ qaerrorlog "no spellcheck test for the langauges " + iSprache + " available."
+ goto endsub
+ endif
+
+ 'delete_word_from_dictionary(sWord,"IgnoreListAll")
+
+ if Ucase(gApplication) = "DRAW" then
+ sExt = ".odg"
else
- Call hFileOpen (gTesttoolpath + "graphics\required\input\recht_1"+sExt)
- end if
- if fIsDocumentWritable = false then
- printlog "Make the document writable and check if it's succesfull."
- if fMakeDocumentWritable = false then
- warnlog "The document can't be make writeable. Test stopped."
- goto endsub
- end if
- end if
- select case iSprache ' sWord(1)=red : sWord(2)=turquoise
- case 01 : sWord(1) = "documente" : sWord(2) = "expriss"
- case 33 : sWord(1) = "intercu" : sWord(2) = "Lees"
- case 34 : sWord(1) = "afekto" : sWord(2) = "fratternal"
- case 36 : sWord(1) = "szeerint" : sWord(2) = "tervvezi"
- case 39 : sWord(1) = "Millano" : sWord(2) = "tarrget"
- case 46 : sWord(1) = "desa" : sWord(2) = "occh"
- case 49 : sWord(1) = "Texxt" : sWord(2) = "reichtt"
- case 50 : sWord(1) = "Bsedilo" : sWord(2) = "zadosča"
- case 55 : sWord(1) = "esktava" : sWord(2) = "noitee"
- case else :
- if bAsianLan then
- sWord(1) = "documente" : sWord(2) = "expriss"
- else
- Warnlog "For the language " + iSprache +" nothing is prepared yet: insert text here and create the file"
- end if
- end select
- sleep 2
+ sExt = ".odp"
+ endif
+
+ Call hFileOpenLocally (gTesttoolpath + "graphics\required\input\recht_"+iSprache+sExt)
+
+ ' Perform the test now:
+ printlog "Call Tools->Spellcheck"
+ ToolsSpellcheck
+ sleep(2)
+ Kontext "Spellcheck"
+ printlog "Click button 'Change' on dialog."
+ ChangeAll.Click
+ 'TODO: check result beware of issue 110688
+ Sleep 2
+
+ SpellCheckClose.click
+
+ printlog "Close document"
+ Call hCloseDocument
+ kill (convertPath(gOfficePath+"user/work/"+"recht_"+iSprache+sExt))
+
+endcase 'tiToolsSpellcheckCheck_ChangeAll
+
+'-------------------------------------------------------------------------------
- Printlog "Delete all added words from dictionaries."
+function delete_all_added_words(aWords)
+
+ 'this function delete the words in sWords in all user dictionaries
+
+ Dim iBookCounter as integer
+ Dim iWordCounter as integer
+ Dim iBooks as integer
+
+ Printlog "Delete the given words from dictionaries."
printlog "Call Tools->Options."
ToolsOptions
printlog "Select in category 'Languagesettings' entry 'Writing Aids.'"
@@ -431,487 +352,143 @@ testcase tiToolsSpellcheckCheck
sleep 1
Kontext "WRITINGAIDS"
sleep 1
- printlog "Click on button 'edit' in section 'User-defined dictionaries.'"
- if (fGetIntoDictionary) then
- qaErrorLog "wTSC"
- goto endsub
- end if
+ printlog "select the first User-defined dictionaries and click EDIT"
+ Benutzerwoerterbuch.select 1
+ Bearbeiten.Click
+
Kontext "BenutzerwoerterbuchBearbeiten"
sleep 1
- printlog "Check every book, if it contains the words that will be added in this test."
+ printlog "Check every book, if it contains the words."
iBooks = Buch.getItemCount
- bWordFound(1) = false
- bWordFound(2) = false
- for i = 1 to iBooks
- Buch.select(i)
+ for iBookCounter = 1 to iBooks
+ Buch.select(iBookCounter)
printlog "Items in Booklist: " & WordList.getItemCount
- for j = 1 to 2
- Wort.setText sWord(j)
+ for iWordCounter = 1 to uBound(aWords)
+ Wort.setText aWords(iWordCounter)
sleep 1
if ((not neu.isEnabled) and Loeschen.isEnabled) then
printlog "If it contains the word, press button 'delete'."
Loeschen.click
- bWordFound(j) = true
- printlog "Added word WAS in dictionary: '" + Buch.getSelText + "' - '" + sWord(j) + "'"
+ printlog "Added word WAS in dictionary: '" + Buch.getSelText + "' - '" + aWords(iWordCounter) + "'"
end if
- next j
- next i
- if (bWordFound(1) OR bWordFound(2))then
- qaErrorLog "Word was found in dictionary - check why it was there. '" + sWord(1) + "': " + bWordFound(1) + " '" + sWord(2) + "': " + bWordFound(2)
- end if
+ next iWordCounter
+ next iBookCounter
printlog "Close dialog 'Edit Custom Dictionary.'"
BenutzerwoerterbuchBearbeiten.Close
sleep 1
Kontext "ExtrasOptionenDlg"
printlog "Press button 'OK' on dialog 'Writing Aids'."
ExtrasOptionenDlg.OK
- printlog "Call dialog again and delete all remaining words from dictionary 'IgnoreAllList'."
- if (not wIgnorierenlisteLoeschen) then
- qaErrorLog "Can't get into Dictionary lists"
- goto endsub
- end if
-
- printlog "Test if spellcheck dialog comes up and check/set direction of spellcheck."
- printlog "Call 'Tools->Spellcheck->Check'."
- ToolsSpellcheck
- Kontext "Spellcheck"
- WaitSlot (1000)
- printlog "If no dictionary for the language is available, a messagebox comes up:"
- printlog ". . . 'Error executing the spellcheck.: Language is not supported by spellchecker funtion."
- kontext "active"
- if active.exists(5) then
- warnlog "$Language is not supported by spellchecker funtion: '" + active.gettext + "'"
- Active.OK
- printlog ". . . exiting testcase."
- goto endsub
- end if
- Kontext "Spellcheck"
- printlog "Close dialog 'Spellcheck'."
- Spellcheck.Close
- Kontext "Active"
- if active.exists(5) then
- Warnlog " Should not be any message here: " + active.gettext + "'"
- Active.OK
- else
- printlog "Spellcheck ended, dialog closed"
- end if
- printlog "Select all."
- hTypeKeys "<MOD1 A>"
- printlog "Check presupposition: 12 Words have to be complained about."
- printlog "All 'Tools->Spellcheck->Check'."
- ToolsSpellcheck
- WaitSlot (2000)
- Kontext "Spellcheck"
- printlog "Click button 'Ignore' 12 times."
-
- for i = 1 to 11
- Kontext "Spellcheck"
- IgnoreOnce.Click
- Kontext "Active"
- if active.exists(5) then
- warnlog "Presupposition not met: there are less than 12 errors in the document! " + i
- Active.OK
- printlog "If errors < 12 -> exiting testcase."
- goto endsub
- end if
- next i
- Kontext "Spellcheck"
- IgnoreOnce.Click
- printlog "Spellcheck dialog has to disapear and messagebox with OK has to come up."
- Kontext "Active"
- if active.exists(5) then
- printlog "Active dialog said: " + active.gettext + "'"
- Active.OK
- end if
- Kontext "Spellcheck"
- if Spellcheck.Exists(5) then
- warnlog "Presupposition not met: there are more than 12 errors in the document!"
- Spellcheck.Close
- kontext "Active"
- if active.exists(5) then
- Active.OK
- else
- printlog "bug fixed #111972# "
- end if
- printlog "If errors > 12 -> exiting testcase."
- goto endsub
- else
- Kontext "Active"
- if active.exists(5) then
- warnlog "There was a Message where none was supposed to be: '" + active.gettext + "'"
- Active.NO
- end if
- printlog "Presupposition met: there are 12 errors in the document!"
- end if
-
- printlog "Perform the test now:"
- printlog "Call 'Tools->Spellcheck->Check'"
- ToolsSpellcheck
- WaitSlot (2000)
- Kontext "Spellcheck"
- Printlog "----------------------------------------------------------------------------"
- Printlog "1st Test: - Ignore now"
- printlog "1st error: ignore : 1st pink word in 1st Paragraph."
- printlog "Backwards: last green word in 3rd Paragraph."
- sWordOne = Suggestions.GetSelText
- printlog "********* Suggestion word found: '" + sWordOne + "'"
- printlog "##### suggestions: "+Suggestions.GetItemCount+"; Language: "+DictionaryLanguage.getSelText '+" ; dictionary: "+woerterbuch.getSelText
- if (Suggestions.GetItemCount > 0) then
- printlog "----- "+i+": "+Suggestions.GetSelText (1)
- end if
- printlog "Click button 'Ignore'."
- IgnoreOnce.Click
- Sleep 2
+
+end function 'delete_all_added_words
- Printlog "----------------------------------------------------------------------------"
- Printlog "2nd Test: - Add"
- printlog "2nd error: add : 1st red word in 1st Paragraph -> hasn't to show up anymore from now on."
- printlog "Backwards: last turquoise word in 3rd Paragraph -> hasn't to show up anymore from now on."
- printlog "Check if word in textfield 'Word' changed."
- printlog "(Check if it is the expected next error - you have to look into the source code for the right word!)."
- sWordTwo = Suggestions.GetSelText
- if (sWordOne = sWordTwo) then
- warnlog "Ignore didn't work? Spellcheck didn't go on"
- end if
- if (sWord(iWord(1)) <> sWordTwo) then
- Printlog "The errornous word '" + sWord(iWord(1)) + "' would be replaced with: '" + sWordTwo + "'"
- end if
- printlog "********* word found: '" + sWordTwo + "'"
- printlog "##### suggestions: "+Suggestions.GetItemCount+"; Language: "+DictionaryLanguage.getSelText ' +" ; dictionary: "+woerterbuch.getSelText
- if (Suggestions.GetItemCount > 0) then
- printlog "----- "+i+": "+Suggestions.GetSelText (1)
- end if
- Sleep 1
- printlog "Click button 'Add' on dialog '"
- AddToDictionary.Click
- Sleep 2
- printlog "The menu has: " + MenuGetItemCount + " entries."
- hMenuSelectNr(1) 'Default
- Kontext "Active"
- if Active.Exists(5) Then
- Warnlog " - Word could not be added to dictionary: '" + active.getText + "'"
- Active.OK
- Sleep 1
- end if
- printlog "Check in options, if word exists in word list."
- printlog "Click button 'Options' on dialog 'Spellcheck'."
- Kontext "Spellcheck"
- SpellcheckOptions.Click
- Kontext "TabLinguistik"
- printlog "Click button 'Edit ...' on dialog 'Writing Aids' in section 'User-defined dictionaries'."
- if TabLinguistik.exists(5) then
- sleep 3
- if (fGetIntoDictionary) then
- qaErrorLog "wTSC"
- goto endsub
- end if
- else
- qaerrorlog "baeh"
- end if
- Kontext "BenutzerwoerterbuchBearbeiten"
- printlog "Check every book, if it contains the added word."
- if not BenutzerwoerterbuchBearbeiten.exists(5) then
- sleep 5
- qaerrorlog "baeh"
- end if
- iBooks = Buch.getItemCount
- bWordFound(1) = false
- for i = 1 to iBooks
- Buch.select(i)
- printlog "Book number selected: " & i
- Wort.setText sWord(iWord(1))
- sleep 1
- if ((not neu.isEnabled) and Loeschen.isEnabled) then
- bWordFound(1) = true
- printlog "Added word is in dictionary: '" + Buch.getSelText + "'"
- end if
- next i
- if (not bWordFound(1)) then
- warnlog "Word was not added to dictionary"
- end if
- printlog "Cancel dialog 'Edit Custom Dictionary'."
- BenutzerwoerterbuchBearbeiten.Close
- Kontext "TabLinguistik"
- printlog "Cancel dialog 'Writing Aids'."
- TabLinguistik.Close
- Kontext "Spellcheck"
-
- Printlog "----------------------------------------------------------------------------"
- Printlog " 3rd Test: - Always Ignore"
- printlog "3rd error: always ignore : 1st turquoise word in 1st Paragraph -> hasn't to show up anymore from now on."
- printlog "Check if word in textfield 'Word' changed."
- printlog "(check if it is the expected next error - you have to look into the source code for the right word!)"
- sWordOne = sWordTwo
- sWordTwo = Suggestions.GetSelText 'wort.getText
- if (sWordOne = sWordTwo) then
- warnlog "Add didn't work? Spellcheck didn't go on."
- end if
- if (sWord(iWord(2)) <> sWordTwo) then
- Printlog "The erroneous word '" + sWord(iWord(2)) + "' would be replaced with: '" + sWordTwo + "'"
- else
- warnlog "ERROR: SAME WORD in the dictionary as in the text??? Must be wrong."
- end if
- printlog "********* word found: '" + sWordTwo + "'"
- printlog "##### suggestions: "+Suggestions.GetItemCount+"; Language: "+DictionaryLanguage.getSelText ' +" ; dictionary: "+DictionaryLanguage.getSelText 'Wort.GetItemCount 'Woerterbuch.GetSelText
- if (Suggestions.GetItemCount > 0) then 'Wort.GetItemCount > 0) then
- printlog "----- "+i+": "+Suggestions.GetItemText (1) 'Wort.GetItemText (1)
- end if
- Sleep 1
- printlog "Click button 'Always ignore' on dialog."
- IgnoreAll.Click
- Sleep 2
- printlog "Check in options, if word exists in word list."
- printlog "Click button 'Options' on dialog 'Spellcheck'."
- SpellcheckOptions.Click
- Kontext "TabLinguistik"
- printlog "Click button 'Edit ...' on dialog 'Writing Aids' in section 'User-defined dictionaries."
- if TabLinguistik.exists(5) then
- sleep 3 'culprint swedish windows; wait until butrton exists?
- if (fGetIntoDictionary) then
- qaErrorLog "wTSC"
- goto endsub
- end if
- else
- qaerrorlog "baeh"
- end if
- Kontext "BenutzerwoerterbuchBearbeiten"
- if not BenutzerwoerterbuchBearbeiten.exists(5) then
- sleep 3
- qaerrorlog "baeh"
- end if
- printlog "Check every book, if it contains the added word."
- iBooks = Buch.getItemCount
- bWordFound(2) = false
- for i = 1 to iBooks
- Kontext "BenutzerwoerterbuchBearbeiten"
- Buch.select(i)
- Inhalt.setText sWord(iWord(2)) 'Wort.setText sWord(iWord(2))
- sleep 1
- if ((not neu.isEnabled) and Loeschen.isEnabled) then
- bWordFound(2) = true
- printlog " added word is in dictionary: '" + Buch.getSelText + "'"
- end if
- next i
- if (not bWordFound(2)) then
- warnlog "Word was not added to dictionary, #ixxxxxx"
- end if
- printlog "Cancel dialog 'Edit Custom Dictionary'."
- BenutzerwoerterbuchBearbeiten.Close
- Kontext "TabLinguistik"
- printlog "Cancel dialog 'Writing Aids'."
- TabLinguistik.Close
- kontext "Spellcheck"
-
- Printlog "----------------------------------------------------------------------------"
- Printlog "4th test: - Replace"
- printlog "4th error: replace : 1st green word in 1st Paragraph."
- printlog "Check if word in textfield 'Word' changed."
- printlog "(check if it is the expected next error - you have to look into the source code for the right word!)."
- sWordOne = sWordTwo
- sWordTwo = Suggestions.GetSelText
- if (sWordOne = sWordTwo) then
- warnlog "Always ignore didn't work? Spellcheck didn't go on."
- end if
- printlog "********* word found: '" + sWordTwo + "'"
- iSuggestions = Suggestions.GetItemCount
- printlog "##### suggestions: " + iSuggestions + "; Language: "+DictionaryLanguage.getSelText '+"; dictionary: "+woerterbuch.getSelText
- if (Suggestions.GetItemCount > 0) then
- printlog "----- "+i+": "+Suggestions.GetItemText (1)
- end if
- Sleep 1
- printlog "Click button 'Replace'."
- if (iSuggestions > 0) then
- Change.click
- else
- qaerrorlog "Please change the text in the file, so the spellchecker can make a suggestion for the word: '" + sWordTwo + "'"
- IgnoreOnce.Click
- end if
+'-------------------------------------------------------------------------------
- Printlog "----------------------------------------------------------------------------"
- Printlog "5th Test: - Always Replace"
- printlog "5th error: always replace : 1st pink word in 2nd Paragraph -> hasn't to show up anymore from now on."
- printlog "backwards: 1st green word in 2nd Paragraph -> hasn't to show up anymore from now on."
- printlog "check if word in textfield 'Word' changed."
- printlog "(check if it is the expected next error - you have to look into the source code for the right word!)."
- sWordOne = sWordTwo
- sWordTwo = Suggestions.GetSelText
- if (sWordOne = sWordTwo) then
- warnlog "Replace didn't work? Spellcheck didn't go on"
- end if
- printlog "********* word found: '" + sWordTwo + "'"
- iSuggestions = Suggestions.GetItemCount
- printlog "##### suggestions: " + iSuggestions + "; Language: "+DictionaryLanguage.getSelText ' +" ; dictionary: "+woerterbuch.getSelText
- if (Suggestions.GetItemCount > 0) then
- printlog "----- "+i+": "+Suggestions.GetItemText (1)
- end if
- Sleep 1
- printlog "click button 'Always Replace'."
- if (iSuggestions > 0) then
- ChangeAll.click
- else
- qaErrorLog "Please change the text in the file, so the spellchecker can make a suggestion for the word: '" + sWordTwo + "'"
- IgnoreOnce.Click
- end if
+function delete_word_from_dictionary(sWord as String, sDictionary as String)
- printlog "2 errors are left: 4th word (green) in 2nd and 3rd paragraph."
- printlog "backwards: 1st word (pink) in 2nd and 1st paragraph."
- Kontext "Spellcheck"
- sWordOne = sWordTwo
- sWordTwo = Suggestions.GetSelText
- if (sWordOne <> sWordTwo) then
- printlog sWordTwo
- else
- warnlog "there is anopther word left, that wasn't expected!. '" + sWordTwo +"'"
- end if
- printlog "Click button 'Ignore' 2 times."
- IgnoreOnce.Click
+ 'this function delete the words in sWords in all user dictionaries
- Kontext "Spellcheck"
- sWordOne = sWordTwo
- sWordTwo = Suggestions.GetSelText
- if (sWordOne <> sWordTwo) then
- warnlog "there is anopther word left, that wasn't expected!. '" + sWordTwo +"'"
- else
- printlog sWordTwo
- end if
- printlog "Click button 'Ignore' 2 times."
- IgnoreOnce.Click
- Kontext "Active"
- if active.exists(5) then
- printlog "Spellcheck works :-) '" + active.gettext + "'"
- Active.No
- else
- warnlog "Spellcheck didn't work :-(! there are still errors in the document."
- Kontext "Spellcheck"
- Spellcheck.Close
- Kontext "Active"
- if active.exists(5) then
- qaErrorLog " Spellcheck dialog closed'" + active.gettext + "'"
- Active.No
- end if
- end if
- sleep 2
+ Dim iBookCounter as integer
+ Dim iWordCounter as integer
+ Dim iBooks as integer
- Printlog "Delete all added words from dictionaries."
+ Printlog "Delete the given word from dictionaries."
printlog "Call Tools->Options."
ToolsOptions
- printlog "Select in category 'Languagesettings' entry 'Writing Aids'."
+ printlog "Select in category 'Languagesettings' entry 'Writing Aids.'"
hToolsOptions ("LANGUAGESETTINGS","WRITINGAIDS")
sleep 1
Kontext "WRITINGAIDS"
- printlog "Click on button 'edit' in section 'User-defined dictionaries'."
- if (fGetIntoDictionary) then
- qaErrorLog "wTSC"
- goto endsub
- end if
+ sleep 1
+ printlog "select the dictionary and click EDIT"
+
+ fSelectWithString(Benutzerwoerterbuch,sDictionary)
+
+ Bearbeiten.Click
+
Kontext "BenutzerwoerterbuchBearbeiten"
- printlog "Check every book, if it contains the added word."
- iBooks = Buch.getItemCount
- bWordFound(1) = false
- bWordFound(2) = false
- for i = 1 to iBooks
- Buch.select(i)
- for j = 1 to 2
- Wort.setText sWord(j)
- sleep 1
- if ((not neu.isEnabled) and Loeschen.isEnabled) then
- printlog "If it contains the word, press button 'delete'."
- Loeschen.click
- bWordFound(j) = true
- printlog " added word is in dictionary: '" + Buch.getSelText + "' - '" + sWord(j) + "'"
- end if
- next j
- next i
- if ((not bWordFound(1)) AND (not bWordFound(2)))then
- warnlog "Word was not found in dictionary. '" + sWord(1) + "': " + bWordFound(1) + " '" + sWord(2) + "': " + bWordFound(2)
+
+ Wort.setText sWord
+ sleep 1
+ if ((not neu.isEnabled) and Loeschen.isEnabled) then
+ printlog "If it contains the word, press button 'delete'."
+ Loeschen.click
+ printlog "Added word WAS in dictionary: '" + Buch.getSelText + "' - '" + sWord + "'"
end if
- printlog "Close dialog 'Edit Custom Dictionary'."
+
+ printlog "Close dialog 'Edit Custom Dictionary.'"
BenutzerwoerterbuchBearbeiten.Close
sleep 1
Kontext "ExtrasOptionenDlg"
- printlog "press button 'OK' on dialog 'Writing Aids'."
+ printlog "Press button 'OK' on dialog 'Writing Aids'."
ExtrasOptionenDlg.OK
- printlog "Call dialog again and delete all remaining words from dictionary 'IgnoreAllList'."
- if (not wIgnorierenlisteLoeschen) then
- qaErrorLog "Can't get into Dictionary lists"
- goto endsub
- end if
- printlog "Close document"
- Call hCloseDocument
-endcase 'tiToolsSpellcheckCheck
+end function 'delete_word_from_dictionary
'-------------------------------------------------------------------------------
-testcase tToolsSpellcheckAutoSpellcheck
-
- QaErrorLog "#i81928# - outcommented tToolsSpellcheckAutoSpellcheck due to bug."
- goto endsub
- dim i as integer
- dim x as integer
- dim y as integer
- dim q as integer
- dim z as integer
- dim iResult as long
- dim iTemp as long
- dim iTemp2 as long
- dim sTemp as string
- dim sCompare as string
- dim iCompare as long
- dim iError as long
- dim sError as string
-
- call hNewDocument
-
- call hTextrahmenErstellen ("Ein Tipp: Schiffahrt schreibt man nun mit 3f Tunfisch Amboss a", 10, 10, 90, 50)
- EditSelectAll
- setCharacterLanguage(glLocale(4))
- sleep 10
- printlog "## check ENGLISH auto spellchecking"
- iError = 0
- ' Get underlined words / wrong recognized words by spellchecker
- iResult = sAnalyseContextMenu(11, iError)
- sTemp = sLongToBinary(iResult, 11)
- sError = sLongToBinary(iError, 11)
- ' reference of words, which should be underlined
- sCompare = "11011001011"
- iCompare = sBinaryToLong(sCompare)
- ' compare result with reference -> get the difference
- iTemp = not (iResult EQV iCompare)
- ' eliminate errors from open bugs -> get the real errors
- iTemp2 = iTemp AND NOT iError
- if (iTemp2 > 0) then
- warnlog "wrong words are not underlined? Should be: " + sCompare
- warnlog "Is: " + sTemp
- warnlog "Differences: " + sLongToBinary(iTemp, 11)
- warnlog "Wrong after merging errors from bugs " + sLongToBinary(iTemp2, 11)
- end if
+function fSelectWithString(oControl as Object,sText as String)
- sleep 1
- ' call hTypeKeys "<F2>"
- call hTypeKeys "<mod1 end> <Shift mod1 home>"
- setCharacterLanguage(glLocale(6))
- sleep 10
- printlog "## check GERMAN auto spellchecking"
- iError = 0
- iResult = sAnalyseContextMenu(11, iError)
- sTemp = sLongToBinary(iResult, 11)
- sError = sLongToBinary(iError, 11)
- sCompare = "00010000000"
- iCompare = sBinaryToLong(sCompare)
- ' compare result with reference -> get the difference
- iTemp = not (iResult EQV iCompare)
- ' eliminate errors from open bugs -> get the real errors
- iTemp2 = iTemp AND NOT iError
- if (iTemp2 > 0) then
- warnlog "wrong words are not underlined? Should be: " + sCompare
- warnlog "Is: " + sTemp
- warnlog "Differences: " + sLongToBinary(iTemp, 11)
- warnlog "Wrong after merging errors from bugs " + sLongToBinary(iTemp2, 11)
- end if
- printlog "-----------------------------------"
+ dim iCounter as Integer
+ dim iNumberOfItems as Integer
+ iNumberOfItems = oControl.getItemCount()
+
+ for iCounter = 1 to iNumberOfItems
+ oControl.select iCounter
+ if( Instr(oControl.getSelText,sText) <> 0 ) then ' the correct entry is selected
+ iCounter = iNumberOfItems ' stop the loop
+ endif
+ next
- hCloseDocument()
-endcase 'tToolsSpellcheckAutoSpellcheck
+end function 'fSelectWithString
'-------------------------------------------------------------------------------
+
+function getWordsForLanguage()
+
+ dim sWrongWord as String
+ dim sRightWord as String
+ dim aWords(2) as String
+
+ select case iSprache
+ case 1 :
+ sWrongWord = "documente"
+ sRightWord = "document"
+ case 31 :
+ sWrongWord = "miejn"
+ sRightWord = "mijn"
+ case 33 :
+ sWrongWord = "projjet"
+ sRightWord = "projet"
+ case 34 :
+ sWrongWord = "lazsos"
+ sRightWord = "lazos"
+ case 36 :
+ sWrongWord = "Bozniai"
+ sRightWord = "Boszniai"
+ case 39 :
+ sWrongWord = "borrdo"
+ sRightWord = "borro"
+ case 46 :
+ sWrongWord = "desa"
+ sRightWord = "edas"
+ case 48 :
+ sWrongWord = "werrsji"
+ sRightWord = "wersji"
+ case 49 :
+ sWrongWord = "Feehlern"
+ sRightWord = "Fehlern"
+ case 55 :
+ sWrongWord = "Elle"
+ sRightWord = "Elze"
+ case else :
+ sWrongWord = ""
+ sRightWord = ""
+ end select
+
+ aWords(0) = sWrongWord
+ aWords(1) = sRightWord
+
+ getWordsForLanguage = aWords
+
+end function 'getWordsForLanguage