1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
30 import lib
.MultiMethodTest
;
32 import com
.sun
.star
.beans
.XPropertySet
;
33 import com
.sun
.star
.util
.XNumberFormats
;
34 import com
.sun
.star
.util
.XNumberFormatsSupplier
;
37 * Testing <code>com.sun.star.util.XNumberFormatsSupplier</code>
40 * <li><code> getNumberFormatSettings()</code></li>
41 * <li><code> getNumberFormats()</code></li>
43 * Test is <b> NOT </b> multithread compilant. <p>
44 * @see com.sun.star.util.XNumberFormatsSupplier
46 public class _XNumberFormatsSupplier
extends MultiMethodTest
{
48 public XNumberFormatsSupplier oObj
= null;
51 * Get format settings and checks some properties for existence. <p>
53 * Has <b> OK </b> status if a number properties inherent to
54 * <code>NumberFormatSettings</code> service exist in the
55 * returned <code>XPropertySet</code>. <p>
57 * @see com.sun.star.util.NumberFormatSettings
59 public void _getNumberFormatSettings() {
60 boolean result
= true ;
61 XPropertySet props
= oObj
.getNumberFormatSettings();
65 result
&= props
.getPropertyValue("NullDate") != null &&
66 props
.getPropertyValue("StandardDecimals") != null &&
67 props
.getPropertyValue("NoZero") != null &&
68 props
.getPropertyValue("TwoDigitDateStart") != null ;
69 } catch (com
.sun
.star
.beans
.UnknownPropertyException e
) {
70 log
.println("Some property doesn't exist") ;
71 e
.printStackTrace(log
) ;
73 } catch (com
.sun
.star
.lang
.WrappedTargetException e
) {
74 e
.printStackTrace(log
) ;
78 log
.println("Method returns null") ;
82 tRes
.tested("getNumberFormatSettings()", result
) ;
86 * Test calls the method. <p>
87 * Has <b> OK </b> status if the method returns not
88 * <code>null</code> value.
90 public void _getNumberFormats() {
91 XNumberFormats formats
= oObj
.getNumberFormats();
93 tRes
.tested("getNumberFormats()", formats
!= null) ;