1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 '* Copyright 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: w_spellcheck1.inc,v $
13 '* last change: $Author: vg $ $Date: 2008-08-18 12:36:27 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/************************************************************************
34 '* owner : helge.delfs@sun.com
36 '* short description : Spellcheck-Testing. Functional-Test.
38 '\***********************************************************************
44 '-------------------------------------------------------------------------
46 testcase tLanguage_Guess
49 DIM iStringPosition AS integer 'Position of string in context menu for word, paragraph
50 DIM iLanguageCount AS integer 'variable for counting through languages in test doc
51 DIM WordPreSet AS string 'given string for comparison from w_locale_strings2.inc
52 DIM WordLanguage AS string '"word is..."entry in context menu
53 DIM ParagraphLanguage AS string '"paragraph is..."entry in context menu
54 DIM ParagraphPreSet AS string 'given string for comparison of paragraphs from w_locale_strings2.inc
55 DIM WordLanguageTemp AS string 'variable for checking if Office language is already covered in w_locale_strings2.inc
57 '///Load test document///
58 call hFileOpen (ConvertPath ( gTesttoolPath + "writer\optional\input\spellcheck\Language_Guessing_Sample_Texts.odt")) 'loading Test-Doc
59 Call sMakeReadOnlyDocumentEditable
61 '----------------------------------------------------------------
62 '///Enable auto spellcheck///
64 if AutoSpellcheck.GetState(2) <> 1 then 'cheking if auto-spellcheck is checked
65 printlog "Autospellcheck not checked, checking Autospellcheck now"
67 printlog "Autospellcheck checked"
69 printlog "Autospellcheck is already checked"
71 '----------------------------------------------------------------
72 ViewNavigator 'opening navigator and selecting table
74 Call wNavigatorAuswahl(2,1)
75 DocumentWriter.TypeKeys "<MOD1 UP>"
76 ViewNavigator 'closing navigator
77 printlog "-----------------"
78 '----------------------------------------------------------------
79 '///Put the cursor in the first wrong word///
81 for iLanguageCount = 1 to 11 'running through the languages
82 'checking the word proposal
83 printlog "CHECKING WORD:"
84 DocumentWriter.TypeKeys "<MOD1 DOWN>"
85 DocumentWriter.TypeKeys "<MOD1 DOWN>"
86 '///Call context menu///
87 DocumentWriter.TypeKeys "<SHIFT F10>" 'calling context menu
88 'selecting 'word is... position
89 iStringPosition = hMenuItemGetCount - 1 'calculating last but one entry
91 'getting string from position
92 WordLanguage = hMenuItemGetText(iStringPosition) 'gets text from entry
93 'printing out string for having a look at the values.
94 printlog "WordLanguage is " + WordLanguage
95 '///Verify that the language proposal "word is..." is correct///
96 WordLanguageTemp = wGetLanguageGuessString("WordPreSet", iLanguageCount) 'comparing reality against the string in w_locale_strings2.inc
97 if WordLanguageTemp > "" then 'checking if the language has really an entry in w_locale_strings2.inc
98 if WordLanguage = WordLanguageTemp then
99 printlog "Word language proposal is correct" 'all ok
101 warnlog "Word language proposal is not correct!" 'problem!
104 Call MenuSelect(0) 'closing menu when language is not yet covered
105 Call hCloseDocument ''closing doc when language is not yet covered
109 '///Apply the language for this word ///
110 call hMenuItemCheck (iStringPosition) 'clicking on menu entry, closing context. Word looses redline.
112 '///Verifiy that the language is set correctly for this word ///
113 DocumentWriter.TypeKeys "<SHIFT F10>" 'calling context menu
114 iStringPosition = hMenuItemGetCount - 1 'calculating last but one entry
115 WordLanguage = hMenuItemGetText(iStringPosition) 'gets text from entry
116 if WordLanguage = WordPreSet then ' checking if context menu ahs changed
117 warnlog "Word language not applied correctly!" 'Problem!
119 printlog "Word language applied correctly" ''all ok
121 Call MenuSelect(0) 'closing menu
123 '----------------------------------------------------------------
124 printlog "CHECKING PARAGRAPH:"
125 EditUndo 'undoing hMenuItemCheck from Check-word-part
126 DocumentWriter.TypeKeys "<MOD1 LEFT>"
128 '///Call context menu///
129 DocumentWriter.TypeKeys "<SHIFT F10>" 'calling context menu
130 'selecting 'paragraph is... position
131 iStringPosition = hMenuItemGetCount 'calculating last entry
132 'getting string from position
133 ParagraphLanguage = hMenuItemGetText(iStringPosition) 'gets text from entry
135 printlog ParagraphLanguage
136 '///Verify that the language proposal "paragraph is..." is correct///
137 if ParagraphLanguage = wGetLanguageGuessString("ParagraphPreSet", iLanguageCount) then 'comparing reality against the string in w_locale_strings2.inc
138 printlog "Paragraph language proposal is correct" 'all ok
140 warnlog "Paragraph language proposal is not correct!" 'Problem!
144 '///Apply the language for this paragraph ///
145 call hMenuItemCheck (iStringPosition) 'clicking on last menu entry, closing context. Paragraph looses redline.
147 '///Verify that the language is set correctly for this paragraph ///
148 DocumentWriter.TypeKeys "<SHIFT F10>" 'calling context menu
149 iStringPosition = hMenuItemGetCount 'calculating last entry
150 ParagraphLanguage = hMenuItemGetText(iStringPosition) 'gets text from entry
151 '///Verify that the language is set correctly for this paragraph ///
152 if ParagraphLanguage = ParagraphPreSet then
153 warnlog "Paragraph language not applied correctly!" 'Problem
155 printlog "Paragraph language applied correctly" 'all ok
157 Call MenuSelect(0) 'closing menu
158 printlog "-----------------"
159 '///Go to the next text sample ///
160 '///Repeat for all western languages ///
163 call hCloseDocument 'engl. Test-Doc closed
164 '----------------------------------------------------------------