bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / ifc / table / _CellProperties.java
blobce45507cb27d6d01c1b708c3238546a08bf3cf2c
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package ifc.table;
21 import lib.MultiPropertyTest;
23 import com.sun.star.container.XNameContainer;
24 import com.sun.star.uno.AnyConverter;
25 import com.sun.star.uno.Type;
26 import com.sun.star.xml.AttributeData;
28 /**
29 * Testing <code>com.sun.star.table.CellProperties</code>
30 * service properties :
31 * <ul>
32 * <li><code> CellStyle</code></li>
33 * <li><code> CellBackColor</code></li>
34 * <li><code> IsCellBackgroundTransparent</code></li>
35 * <li><code> NumberFormat</code></li>
36 * <li><code> ShadowFormat</code></li>
37 * <li><code> HoriJustify</code></li>
38 * <li><code> VertJustify</code></li>
39 * <li><code> Orientation</code></li>
40 * <li><code> CellProtection</code></li>
41 * <li><code> TableBorder</code></li>
42 * <li><code> IsTextWrapped</code></li>
43 * <li><code> RotateAngle</code></li>
44 * <li><code> RotateReference</code></li>
45 * </ul> <p>
46 * Properties testing is automated by <code>lib.MultiPropertyTest</code>.
47 * @see com.sun.star.table.CellProperties
49 public class _CellProperties extends MultiPropertyTest {
52 /**
53 * This property is tested with custom property tester which
54 * switches between 'Default' and 'Result' style names.
56 public void _CellStyle() {
57 testProperty("CellStyle", new PropertyTester() {
58 protected Object getNewValue(String name, Object old) {
59 return "Default".equals(old) ? "Result" : "Default" ;
61 }) ;
64 public void _UserDefinedAttributes() {
65 XNameContainer uda = null;
66 boolean res = false;
67 try {
68 uda = (XNameContainer) AnyConverter.toObject(
69 new Type(XNameContainer.class),
70 oObj.getPropertyValue("UserDefinedAttributes"));
71 AttributeData attr = new AttributeData();
72 attr.Namespace = "http://www.sun.com/staroffice/apitest/Cellprop";
73 attr.Type="CDATA";
74 attr.Value="true";
75 uda.insertByName("Cellprop:has-first-alien-attribute",attr);
76 uda.getElementNames();
77 oObj.setPropertyValue("UserDefinedAttributes",uda);
78 uda = (XNameContainer) AnyConverter.toObject(
79 new Type(XNameContainer.class),
80 oObj.getPropertyValue("UserDefinedAttributes"));
81 uda.getElementNames();
82 uda.getByName("Cellprop:has-first-alien-attribute");
83 res = true;
84 } catch (com.sun.star.beans.UnknownPropertyException upe) {
85 log.println("Don't know the Property 'UserDefinedAttributes'");
86 } catch (com.sun.star.lang.WrappedTargetException wte) {
87 log.println("WrappedTargetException while getting Property 'UserDefinedAttributes'");
88 } catch (com.sun.star.container.NoSuchElementException nee) {
89 log.println("added Element isn't part of the NameContainer");
90 } catch (com.sun.star.lang.IllegalArgumentException iae) {
91 log.println("IllegalArgumentException while getting Property 'UserDefinedAttributes'");
92 } catch (com.sun.star.beans.PropertyVetoException pve) {
93 log.println("PropertyVetoException while getting Property 'UserDefinedAttributes'");
94 } catch (com.sun.star.container.ElementExistException eee) {
95 log.println("ElementExistException while getting Property 'UserDefinedAttributes'");
97 tRes.tested("UserDefinedAttributes",res);
100 } // finish class _CellProperties