1 /*************************************************************************
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: _LineProperties.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 import com
.sun
.star
.beans
.PropertyValue
;
34 import com
.sun
.star
.drawing
.LineDash
;
35 import lib
.MultiPropertyTest
;
38 * Testing <code>com.sun.star.drawing.LineProperties</code>
39 * service properties :
41 * <li><code> LineStyle</code></li>
42 * <li><code> LineDash</code></li>
43 * <li><code> LineColor</code></li>
44 * <li><code> LineTransparence</code></li>
45 * <li><code> LineWidth</code></li>
46 * <li><code> LineJoint</code></li>
47 * <li><code> LineStartName</code></li>
48 * <li><code> LineStart</code></li>
49 * <li><code> LineEnd</code></li>
50 * <li><code> LineStartCenter</code></li>
51 * <li><code> LineStartWidth</code></li>
52 * <li><code> LineEndCenter</code></li>
53 * <li><code> LineEndWidth</code></li>
55 * Properties testing is automated by <code>lib.MultiPropertyTest</code>.
56 * @see com.sun.star.drawing.LineProperties
58 public class _LineProperties
extends MultiPropertyTest
{
61 * Tester used for property LineStartName which can have
62 * only predefined String values.
64 protected PropertyTester LineTester
= new PropertyTester() {
65 protected Object
getNewValue(String propName
, Object oldValue
)
66 throws java
.lang
.IllegalArgumentException
{
67 if (oldValue
.equals("Arrow"))
74 * The property switched between 'Square' and 'Arrow' values.
76 public void _LineStartName() {
77 log
.println("Testing with custom Property tester");
78 testProperty("LineStartName", LineTester
) ;
81 public void _LineDash() {
82 LineDash aLineDash
= new LineDash();
83 LineDash aLineDash2
= new LineDash();
84 aLineDash
.DashLen
= 5;
85 aLineDash2
.DashLen
= 1;
86 PropertyValue
[] firstValue
= new PropertyValue
[2];
87 firstValue
[0] = new PropertyValue();
88 firstValue
[0].Name
= "Name";
89 firstValue
[0].Value
= "Name1";
90 firstValue
[1] = new PropertyValue();
91 firstValue
[1].Name
= "LineDash";
92 firstValue
[1].Value
= aLineDash
;
93 PropertyValue
[] secondValue
= new PropertyValue
[2];
94 secondValue
[0] = new PropertyValue();
95 secondValue
[0].Name
= "Name";
96 secondValue
[0].Value
= "Name2";
97 secondValue
[1] = new PropertyValue();
98 secondValue
[1].Name
= "LineDash";
99 secondValue
[1].Value
= aLineDash2
;
100 testProperty("LineDash",firstValue
,secondValue
);