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: g_line.inc,v $
13 '* last change: $Author: rt $ $Date: 2008-08-28 11:42:35 $
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 '**************************************************************************************
41 '\*************************************************************************************
47 Dim i 'Variable fuer Stil (Anzahl)
48 Dim j 'Variable fur Farbe (Anzahl)
49 Dim k 'Variable fuer Transparenz (Anzahl)
53 Call hNewDocument '/// New impress document
55 Call hRechteckErstellen (10,10,60,60) '/// create rectangle
57 FormatLine '/// open Format line dialog
59 Active.SetPage TabLinie '///Open TabLine Tabpage
62 Stil.GetItemCount '/// Get item count for style ///'
63 Farbe.GetItemCount '/// Get item count for color ///'
64 Breite.More 1 '/// change value for ///'
65 ZaehlerStil = Stil.GetItemCount
66 ZaehlerFarbe = Farbe.GetItemCount
68 for i=1 to ZaehlerStil '/// Apply every style to the rectangle ///'
72 TabLinie.OK '/// Closing dialog with ok
73 ' Kontext "DocumentImpress"
74 FormatLine '///Open TabLine Tabpage
76 Active.SetPage TabLinie
80 for j=1 to ZaehlerFarbe '/// Apply every color to the rectangle///'
81 PrintLog "-- " + Farbe.GetSelText
86 ' Kontext "DocumentImpress"
89 Active.SetPage TabLinie
92 Breite.More 3 '/// change Breite ///'
95 Transparenz.More 1 '/// change tranparence///'
98 '---------------------------------------
100 EditSelectAll '/// Select all objects in document ///'
102 hTypeKeys "<DELETE>" '/// Delete objects ///'
107 Active.SetPage TabLinie '/// TabLine ///'
109 StilLinks.GetItemCount
110 ZaehlerStilLinks=StilLinks.GetItemCount
111 for l=1 to ZaehlerStilLinks '/// Apply all line end styles///'
113 if EndenSynchronisieren.IsChecked=False Then EndenSynchronisieren.Check '/// check synchronize ///'
116 if StilLinks.GetSelText<>StilRechts.GetSelText Then
117 WarnLog " Ends not synchronized. " + StilLinks.GetSelText + " Right: " + StilRechts.GetSelText '/// check if style is automatically applied for both ends ///'
119 PrintLog " Left: " + StilLinks.GetSelText + " Right: " + StilRechts.GetSelText
121 EndenSynchronisieren.UnCheck
124 if ZentriertRechts.isChecked = True Then PrintLog " Centered right does work"
125 i = CornerStyle.GetItemCount
126 if i <> 4 then warnlog "CornerStyle should contain four options, but currently has: " + i
129 if CornerStyle.GetSelIndex <> i then warnlog "Corner Styles was: " + CornerStyle.GetSelIndex + ", should have been " + i
130 Printlog "Corner Style nr: " + i + " = " + CornerStyle.GetSelText
133 '------------------------------------------
137 Active.SetPage TabLinienstile
138 Kontext "TabLinienstile"
139 Hinzufuegen.Click '/// Add new line style ///'
141 Eingabefeld.SetText "Testlinie2" '/// insert name of style (Testlinie2) ///'
145 Active.SetPage TabLinienstile
146 Kontext "TabLinienstile"
147 Loeschen.Click '/// delete created style ///'
151 Active.SetPage TabLinienstile
152 Kontext "TabLinienstile"
155 AnzahlLinks.SetText "20"
156 AnzahlRechts.SetText "5"
159 Abstand.SetText "0,1"
160 if AnLinienbreite.IsChecked = True Then AnLinienbreite.Click '/// all fields changed in TabLinienstile ///'
161 PrintLog " All controls could be manipulated."
164 if LaengeLinks.IsEnabled And LaengeRechts.IsEnabled =True Then '/// check if its possible to apply a length to a point ///'
165 WarnLog " A point where you can change its length is not a point anymore"
167 PrintLog " Line style pint tested" '/// All styles for points are changed ///'
173 if Linienstil.GetItemCount = 0 then '/// check if style list is filled ///'
174 Warnlog "- The list for line styles is empty"
175 Hinzufuegen.Click '/// new style ///'
181 Active.SetPage TabLinienstile
182 Kontext "TabLinienstile"
183 Aendern.Click '/// change style ///'
185 Eingabefeld.SetText Eingabefeld.GetText + "1" '/// new name for changed style ///'
186 SetClipboard Eingabefeld.GetText '/// put name into clipboard ///'
189 Active.SetPage TabLinienstile
190 Kontext "TabLinienstile"
195 Active.SetPage TabLinienstile
196 Kontext "TabLinienstile"
203 if Eingabefeld.GetText <> GetClipboardText Then WarnLog "No changes for Line style" '/// check if changed style is in list ///'
207 Active.SetPage TabLinienstile
208 Kontext "TabLinienstile"
211 Loeschen.Click '/// delete changed style ///'
216 if Linienstile.GetItemCount = 0 Then
220 Eingabefeld.SetText "Delete"
225 Active.SetPage TabLinienstile
226 Kontext "TabLinienstile"
229 '--------------------------------------------
231 Call hRechteckErstellen (40,40,80,50) '/// create rectangle ///'
235 Active.SetPage TabLinienenden
236 Kontext "TabLinienenden"
239 if Linienstil.Exists then Aendern.Click '/// change style ///'
242 Active.SetPage TabLinienenden
243 Kontext "TabLinienenden"
247 Hinzufuegen.Click '/// add style ///'
252 Active.SetPage TabLinienenden
253 Kontext "TabLinienenden"
254 Aendern.Click '/// change style ///'
256 Printlog Active.GetText
259 Eingabefeld.SetText Eingabefeld.GetText + "1"
260 PrintLog " Name inserted"
264 if active.GetRt=304 then
267 Eingabefeld.SetText Eingabefeld.GetText + "1"
268 PrintLog " Name inserted"
271 if active.GetRt=304 then
273 warnlog "still not a valid name :-("
276 Active.SetPage TabLinienenden
277 Kontext "TabLinienenden"
278 Loeschen.Click '/// delete style ///'
283 Active.SetPage TabLinienenden
284 Kontext "TabLinienenden"
286 Speichern.Click '/// save style ///'
288 Kontext "SpeichernDlg"
292 Kontext "TabLinienenden"
293 TabLinienenden.Cancel
296 '///New part for line
297 'EditSelectAll '/// Select all objects in document ///'
299 'hTypeKeys "<DELETE>" '/// Delete objects ///'
302 '/// Create line to test shadow tabpage in line dialog
306 'if (gApplication = "DRAW") then
307 ' Kontext "DocumentDraw"
308 ' gMouseMove (30,50, 40,60)
311 ' Kontext "DocumentImpress"
312 ' gMouseMove (30,50, 40,60)
317 'Active.SetPage TabSchatten
320 Call hCloseDocument '/// close document ///'
322 endcase 'tiFormatLine
323 '-------------------------------------------------------------------------------'
324 testcase tLineConnect
326 Dim value1 as integer
327 Dim value2 as integer
328 Dim value3 as integer
329 Dim StatusBarText as string
332 Dim cfirst as integer
335 QaErrorLog "tLineConnect ends because Asian languages are not fully supported."
339 Call hNewDocument '/// New Impress / Draw document ///'
341 kontext "GraphicObjectbar"
342 if GraphicObjectbar.Exists then
343 if GraphicObjectbar.isDocked = False then
344 GraphicObjectbar.Move 900,900
347 kontext "Gluepointsobjectbar"
348 if Gluepointsobjectbar.Exists then
349 if Gluepointsobjectbar.isDocked = false then
350 Gluepointsobjectbar.Move 900,900
354 if Optionsbar.Exists then
355 if Optionsbar.isDocked = false then
356 Optionsbar.Move 900,900
360 '/// Create 2 lines ///'
364 if (gApplication = "DRAW") then
365 Kontext "DocumentDraw"
366 gMouseMove (30,50, 40,60)
370 Kontext "DocumentDraw"
371 gMouseMove (70,50, 60,60)
373 Kontext "DocumentImpress"
374 gMouseMove (30,50, 40,60)
378 Kontext "DocumentImpress"
379 gMouseMove (70,50, 60,60)
382 printlog "'" + (gApplication) +"'"
384 '/// Check the amount of objects ///'
389 if (gApplication = "IMPRESS") then
390 StatusBarText = DocumentImpress.StatusGetText(DocumentImpress.StatusGetItemID(1))
392 kontext "DocumentDraw"
393 StatusBarText = DocumentDraw.StatusGetText(DocumentDraw.StatusGetItemID(1))
396 value1 = left(StatusBarText,(InStr(StatusBarText, "2" )))
398 warnlog "UH? There is supposed to be two objects visible, but was: " + value1 + " and the StatusBarText said: " + StatusBarText + "."
401 value1 = left(StatusBarText,1)
402 printlog "StatusBarText was: " + StatusBarText
404 warnlog "UH? There is supposed to be two objects visible, but we found " + value1 + " objects."
408 '/// Connect the two objects selected ///'
413 '/// Check the amount of objects ///'
418 if (gApplication = "IMPRESS") then
419 StatusBarText = DocumentImpress.StatusGetText(DocumentImpress.StatusGetItemID(1))
421 kontext "DocumentDraw"
422 StatusBarText = DocumentDraw.StatusGetText(DocumentDraw.StatusGetItemID(1))
424 value2 = left(StatusBarText,1)
425 printlog "StatusBarText was: " + StatusBarText
427 '/// if same as the first value = wrong ///'
428 if value1 = value2 then
429 warnlog "Expected to find one object, but found " + value2 + " instead."
432 warnlog "Connect was not successful. We should have one object, but have " + value2 + " instead."
435 '/// unmark the objects, thereafter mark them again ///'
440 '/// Break them from eachother ///'
445 '/// unmark the objects, thereafter mark them again ///'
450 '/// Check the amount of objects ///'
451 if (gApplication = "IMPRESS") then
452 StatusBarText = DocumentImpress.StatusGetText(DocumentImpress.StatusGetItemID(1))
454 kontext "DocumentDraw"
455 StatusBarText = DocumentDraw.StatusGetText(DocumentDraw.StatusGetItemID(1))
457 value3 = left(StatusBarText,1)
459 printlog "StatusBarText was: " + StatusBarText
461 '/// if the same as any of the ones before: Wrong ///'
462 if (value3 = value1 OR value3 = value2) then
463 warnlog "Expected to find three objects, but found " + value3 + " instead."
466 '/// if 3 objects, then everything is ok ///'
468 printlog "Found three objects. Means the test was successful."
470 warnlog "Wrong value, expected three objects, but found " + value3 + "."
473 '/// Go through the different Corner-styles ///'
477 hMenuSelectNr(2) 'Choose "Line"
480 if TabLinie.Exists(2) then
481 cfirst = CornerStyle.GetSelIndex
486 For i = 1 to CornerStyle.GetItemCount
488 if (i > 1) AND (cname <> CornerStyle.GetSelText) then
489 warnlog "Cornerstylename wasnt saved. Should have been: " + cname + ". But was: " + CornerStyle.GetSelText
492 cname = CornerStyle.GetSelText
493 Printlog " Found and selected Corner-Style: " + cname
497 hMenuSelectNr(2) 'Choose "Line"
501 CornerStyle.Select cfirst
504 '/// And a nice finish to make life a bit happier for anyone who looks at the test ///'
507 if (gApplication = "DRAW") then
508 Kontext "DocumentDraw"
509 gMouseMove (40,40, 50,30)
513 Kontext "DocumentDraw"
514 gMouseMove (51,40, 61,30)
517 Kontext "DocumentDraw"
518 gMouseMove (48,43, 53,50)
520 Kontext "DocumentImpress"
521 gMouseMove (40,40, 50,30)
525 Kontext "DocumentImpress"
526 gMouseMove (51,40, 61,30)
529 Kontext "DocumentImpress"
530 gMouseMove (48,43, 53,50)
533 '/// Close the document ///'
537 endcase 'tiLineConnect
538 '-------------------------------------------------------------------------------'