update dev300-m58
[ooovba.git] / testautomation / graphics / optional / includes / global / g_paragraph.inc
blob882134573390aba50e978cf4100fd8eba56bb254
1 'encoding UTF-8  Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 '*
5 '* Copyright 2008 by Sun Microsystems, Inc.
6 '*
7 '* OpenOffice.org - a multi-platform office productivity suite
8 '*
9 '* $RCSfile: g_paragraph.inc,v $
11 '* $Revision: 1.1 $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 10:42:40 $
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 : wolfram.garten@sun.com
36 '* short description :
38 '\***********************************************************************************
40 testcase tdFormatParagraph
41     Dim Zaehler as integer
42     Dim a as integer
43     dim iCount as integer '3 out of 6 have to be able to change a value!
44     dim sIndent as string
45     dim sIndentValue
46     dim sTemp(5) as string
47     dim iTemp as integer
49     iCount = 0
50     Call hNewDocument
52     ToolsOptions
53     hToolsOptions (gApplication,"General")
54     iTemp = Masseinheit.GetSelIndex
55     Masseinheit.TypeKeys= "<HOME>" '(first entry)
56     Kontext "ExtrasOptionenDlg"
57     ExtrasOptionenDlg.OK
59     FormatParagraph
60     Kontext
61     Active.SetPage TabEinzuegeUndAbstaende
62     Kontext "TabEinzuegeUndAbstaende"
63     VonLinks.SetText "2"
64     sleep (1)
65     VonLinks.Typekeys "<TAB>"
66     ErsteZeile.SetText "2"
67     sleep (1)
68     ErsteZeile.Typekeys "<TAB>"
69     VonRechts.SetText "2"
70     sleep (1)
71     VonRechts.Typekeys "<TAB>"
72     Oben.SetText "2"
73     sleep (1)
74     Oben.Typekeys "<TAB>"
75     Unten.SetText "2"
76     sleep (1)
77     Unten.Typekeys "<TAB>"
78     Zeilenabstand.TypeKeys "<DOWN>"
79     Zeilenabstand.TypeKeys "<UP>"
80     printlog "linespacing count: "+Zeilenabstand.GetItemCount
81     sTemp(1) = VonLinks.getText
82     sTemp(2) = ErsteZeile.getText
83     sTemp(3) = VonRechts.getText
84     sTemp(4) = Oben.getText
85     sTemp(5) = Unten.getText
86     TabEinzuegeUndAbstaende.OK
87     FormatParagraph
88     Kontext
89     Active.SetPage TabEinzuegeUndAbstaende
90     Kontext "TabEinzuegeUndAbstaende"
91     if LiberalMeasurement(VonLinks.GetText, sTemp(1)) <> TRUE Then WarnLog "Value changed VonLinks   is: '" + VonLinks.GetText +   "' should: '" + sTemp(1) +"'"
92         if LiberalMeasurement(VonRechts.GetText, sTemp(2)) <> TRUE Then WarnLog "Value changed VonRechts  is: '" + VonRechts.GetText +  "' should: '" + sTemp(2) +"'"
93             if LiberalMeasurement(ErsteZeile.GetText, sTemp(3)) <> TRUE Then WarnLog "Value changed ErsteZeile is: '" + ErsteZeile.GetText + "' should: '" + sTemp(3) +"'"
94                 if LiberalMeasurement(Oben.GetText, sTemp(4)) <> TRUE Then WarnLog "Value changed Oben       is: '" + Oben.GetText +       "' should: '" + sTemp(4) +"'"
95                     if LiberalMeasurement(Unten.GetText, sTemp(5)) <> TRUE Then WarnLog "Value changed Unten      is: '" + Unten.GetText +      "' should: '" + sTemp(5) +"'"
97                         Zaehler=Zeilenabstand.GetItemCount
98                         for a=1 to Zaehler
99                             Zeilenabstand.Select a
100                             sIndent = Zeilenabstand.GetSelText
101                             sleep 1
102                             try
103                                 '           if um.IsEnabled then printlog  "## UM##"
104                                 '           if von.IsEnabled then printlog "##VON##"
105                                 if (von.IsEnabled and um.IsEnabled)  then printlog "##VON#### UM## !!!!! :-("
106                                     if von.IsEnabled then
107                                         sIndentValue = von.GetText
108                                         von.More
109                                         sleep 1
110                                         if sIndentValue = von.GetText then
111                                             warnlog "value didn't change :-( : '"+sIndent +"'"
112                                         else
113                                             printlog "value changed :-) '"+sIndent +"'"
114                                         endif
115                                         iCount = iCount+1
116                                     else
117                                         if um.IsEnabled then
118                                             sIndentValue = Um.GetText
119                                             Um.More
120                                             sleep 1
121                                             if sIndentValue = Um.GetText then
122                                                 warnlog "value didn't change :-( : '"+sIndent +"'"
123                                             else
124                                                 printlog "value changed :-) '"+sIndent +"'"
125                                             endif
126                                             iCount = iCount+1
127                                         else
128                                             printlog "value not changeable :-? '"+sIndent +"'"
129                                         endif
130                                     endif
131                                 catch
132                                     warnLog "BIGERROR :-("
133                                 endcatch
134                                 printlog "----------------------------------------------------------------------------------------"
135                                 sleep 1
136                                 TabEinzuegeUndAbstaende.OK
137                                 sleep 1
138                                 FormatParagraph
139                                 Kontext
140                                 Active.SetPage TabEinzuegeUndAbstaende
141                                 Kontext "TabEinzuegeUndAbstaende"
142                             next a
143                             if iCount <> 3 then warnlog "Could only activate "+ iCount + " out of "+Zaehler +" vlauefields :-("
144                                 TabeinzuegeUndAbstaende.OK
146                                 FormatParagraph
147                                 Kontext
148                                 Active.SetPage TabAusrichtungAbsatz
149                                 Kontext "TabAusrichtungAbsatz"
151                                 Links.Check
152                                 TabAusrichtungAbsatz.OK
153                                 FormatParagraph
154                                 Kontext
155                                 Active.SetPage TabAusrichtungAbsatz
156                                 Kontext "TabAusrichtungAbsatz"
157                                 if Links.IsChecked=False Then WarnLog " Button 'left' is not activated"
159                                     Rechts.Check
160                                     TabAusrichtungAbsatz.OK
161                                     FormatParagraph
162                                     Kontext
163                                     Active.SetPage TabAusrichtungAbsatz
164                                     Kontext "TabAusrichtungAbsatz"
165                                     if Rechts.IsChecked=False Then WarnLog " Button 'right' is not activated"
167                                         Zentriert.Check
168                                         TabAusrichtungAbsatz.OK
169                                         FormatParagraph
170                                         Kontext
171                                         Active.SetPage TabAusrichtungAbsatz
172                                         Kontext "TabAusrichtungAbsatz"
173                                         if Zentriert.IsChecked=False Then WarnLog " Button 'center' is not activated"
175                                             Blocksatz.Check
176                                             TabAusrichtungAbsatz.OK
177                                             FormatParagraph
178                                             Kontext
179                                             Active.SetPage TabAusrichtungAbsatz
180                                             Kontext "TabAusrichtungAbsatz"
181                                             if Blocksatz.IsChecked=False Then WarnLog " Button 'justified' is not activated"
182                                                 TabAusrichtungAbsatz.OK
184                                                 FormatParagraph
185                                                 Kontext
186                                                 Active.SetPage TabTabulator
187                                                 Kontext "TabTabulator"
188                                                 SetClipboard Position.GetItemCount
189                                                 Position.SetText "1"
190                                                 Neu.Click
191                                                 Position.SetText "2"
192                                                 Neu.Click
193                                                 Position.SetText "3"
194                                                 Neu.Click
195                                                 TabTabulator.OK
196                                                 FormatParagraph
197                                                 Kontext
198                                                 Active.SetPage TabTabulator
199                                                 Kontext "TabTabulator"
200                                                 if GetClipboardText + 3 = Position.GetItemCount Then PrintLog " positions added"
201                                                     Loeschen.Click
202                                                     if Position.GetItemCount="3" Then
203                                                         WarnLog " Delete does not work"
204                                                     else
205                                                         Printlog " TAll ran well in TabTabulator"
206                                                     end if
207                                                     TabTabulator.OK
209                                                     ToolsOptions
210                                                     hToolsOptions (gApplication,"General")
211                                                     Masseinheit.Select iTemp
212                                                     if ( Masseinheit.GetSelIndex <> iTemp ) then WarnLog "Unit of Measurement state were NOT changed back"
213                                                         Kontext "ExtrasOptionenDlg"
214                                                         ExtrasOptionenDlg.OK
216                                                         Call hCloseDocument
217 endcase