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 .
21 import lib
.MultiMethodTest
;
23 import com
.sun
.star
.beans
.XPropertySet
;
24 import com
.sun
.star
.util
.XNumberFormats
;
25 import com
.sun
.star
.util
.XNumberFormatsSupplier
;
28 * Testing <code>com.sun.star.util.XNumberFormatsSupplier</code>
31 * <li><code> getNumberFormatSettings()</code></li>
32 * <li><code> getNumberFormats()</code></li>
34 * Test is <b> NOT </b> multithread compliant. <p>
35 * @see com.sun.star.util.XNumberFormatsSupplier
37 public class _XNumberFormatsSupplier
extends MultiMethodTest
{
39 public XNumberFormatsSupplier oObj
= null;
42 * Get format settings and checks some properties for existence. <p>
44 * Has <b> OK </b> status if a number properties inherent to
45 * <code>NumberFormatSettings</code> service exist in the
46 * returned <code>XPropertySet</code>. <p>
48 * @see com.sun.star.util.NumberFormatSettings
50 public void _getNumberFormatSettings() {
51 boolean result
= true ;
52 XPropertySet props
= oObj
.getNumberFormatSettings();
56 result
&= props
.getPropertyValue("NullDate") != null &&
57 props
.getPropertyValue("StandardDecimals") != null &&
58 props
.getPropertyValue("NoZero") != null &&
59 props
.getPropertyValue("TwoDigitDateStart") != null ;
60 } catch (com
.sun
.star
.beans
.UnknownPropertyException e
) {
61 log
.println("Some property doesn't exist") ;
62 e
.printStackTrace(log
) ;
64 } catch (com
.sun
.star
.lang
.WrappedTargetException e
) {
65 e
.printStackTrace(log
) ;
69 log
.println("Method returns null") ;
73 tRes
.tested("getNumberFormatSettings()", result
) ;
77 * Test calls the method. <p>
78 * Has <b> OK </b> status if the method returns not
79 * <code>null</code> value.
81 public void _getNumberFormats() {
82 XNumberFormats formats
= oObj
.getNumberFormats();
84 tRes
.tested("getNumberFormats()", formats
!= null) ;