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
.linguistic2
;
21 import lib
.MultiMethodTest
;
23 import com
.sun
.star
.lang
.Locale
;
24 import com
.sun
.star
.linguistic2
.XSupportedLocales
;
27 * Testing <code>com.sun.star.linguistic2.XSupportedLocales</code>
30 * <li><code>getLocales()</code></li>
31 * <li><code>hasLocale()</code></li>
33 * @see com.sun.star.linguistic2.XSupportedLocales
35 public class _XSupportedLocales
extends MultiMethodTest
{
37 public XSupportedLocales oObj
= null;
38 public Locale
[] locales
= new Locale
[0];
41 * Test calls the method, stores returned value and checks it. <p>
42 * Has <b> OK </b> status if length of returned array isn't zero. <p>
44 public void _getLocales() {
45 locales
= oObj
.getLocales();
46 tRes
.tested("getLocales()", locales
.length
> 0);
50 * Test calls the method for every language from list of supported languages,
51 * calls the method for one unsupported language and checks
52 * all returned values. <p>
53 * Has <b> OK </b> status if all returned values for supported languages
54 * are equal to true and if returned value for unsupported language is equal
56 * The following method tests are to be completed successfully before :
58 * <li> <code> getLocales() </code> : to have list of
59 * all supported languages </li>
62 public void _hasLocale() {
63 requiredMethod("getLocales()");
66 // first check all available locales
67 for (int i
=0; i
< locales
.length
; i
++) {
68 res
&= oObj
.hasLocale(locales
[i
]);
71 // now create an invalid locale
72 Locale invalid
= new Locale("myLanguage","myCountry","");
73 res
&= !oObj
.hasLocale(invalid
);
75 tRes
.tested("hasLocale()", res
);
78 } // finish class XSupportedLocales