summaryrefslogtreecommitdiff
path: root/qadevOOo/tests/basic/ifc/i18n/XLocaleData/i18n_XLocaleData.xba
diff options
context:
space:
mode:
Diffstat (limited to 'qadevOOo/tests/basic/ifc/i18n/XLocaleData/i18n_XLocaleData.xba')
-rw-r--r--qadevOOo/tests/basic/ifc/i18n/XLocaleData/i18n_XLocaleData.xba279
1 files changed, 279 insertions, 0 deletions
diff --git a/qadevOOo/tests/basic/ifc/i18n/XLocaleData/i18n_XLocaleData.xba b/qadevOOo/tests/basic/ifc/i18n/XLocaleData/i18n_XLocaleData.xba
new file mode 100644
index 000000000000..bffc7489a770
--- /dev/null
+++ b/qadevOOo/tests/basic/ifc/i18n/XLocaleData/i18n_XLocaleData.xba
@@ -0,0 +1,279 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="i18n_XLocaleData" script:language="StarBasic">
+
+
+'*************************************************************************
+'*
+'* $RCSfile: i18n_XLocaleData.xba,v $
+'*
+'* $Revision: 1.1 $
+'*
+'* last change:$Date: 2003-01-27 17:50:31 $
+'*
+'* The Contents of this file are made available subject to the terms of
+'* either of the following licenses
+'*
+'* - GNU Lesser General Public License Version 2.1
+'* - Sun Industry Standards Source License Version 1.1
+'*
+'* Sun Microsystems Inc., October, 2000
+'*
+'* GNU Lesser General Public License Version 2.1
+'* =============================================
+'* Copyright 2000 by Sun Microsystems, Inc.
+'* 901 San Antonio Road, Palo Alto, CA 94303, USA
+'*
+'* This library is free software; you can redistribute it and/or
+'* modify it under the terms of the GNU Lesser General Public
+'* License version 2.1, as published by the Free Software Foundation.
+'*
+'* This library is distributed in the hope that it will be useful,
+'* but WITHOUT ANY WARRANTY; without even the implied warranty of
+'* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+'* Lesser General Public License for more details.
+'*
+'* You should have received a copy of the GNU Lesser General Public
+'* License along with this library; if not, write to the Free Software
+'* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+'* MA 02111-1307 USA
+'*
+'*
+'* Sun Industry Standards Source License Version 1.1
+'* =================================================
+'* The contents of this file are subject to the Sun Industry Standards
+'* Source License Version 1.1 (the "License"); You may not use this file
+'* except in compliance with the License. You may obtain a copy of the
+'* License at http://www.openoffice.org/license.html.
+'*
+'* Software provided under this License is provided on an "AS IS" basis,
+'* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+'* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+'* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+'* See the License for the specific provisions governing your rights and
+'* obligations concerning the Software.
+'*
+'* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+'*
+'* Copyright: 2000 by Sun Microsystems, Inc.
+'*
+'* All Rights Reserved.
+'*
+'* Contributor(s): _______________________________________
+'*
+'*
+'*************************************************************************
+'*************************************************************************
+
+
+
+' Be sure that all variables are dimensioned:
+option explicit
+
+
+
+Sub RunTest()
+
+'*************************************************************************
+' INTERFACE:
+' com.sun.star.i18n.XLocaleData
+'*************************************************************************
+On Error Goto ErrHndl
+ Dim bOK As Boolean
+ Dim AllNames As Variant, nNamesCount As Integer, i As Integer
+ Dim Locale As Variant, oInfo As Variant, LocItem As Variant
+ Dim AllCalendars As Variant, AllCurrencies As Variant
+ Dim AllFormats As Variant, Implementations As Variant
+ Dim sOpt As Variant, size As Variant
+ Dim rtLit As Variant, fbc As Variant, rw As Variant
+
+ Test.StartMethod("getAllInstalledLocaleNames()")
+ bOK = true
+ AllNames = oObj.getAllInstalledLocaleNames()
+ nNamesCount = ubound(AllNames)
+ Out.Log("Found " + nNamesCount + " Loacales registered in the system")
+
+ for i = 0 to nNamesCount
+ Out.Log("" + i + "). " + AllNames(i).Country + ";" + AllNames(i).Language + ";" + AllNames(i).Variant)
+ next i
+
+ Randomize
+ Locale = AllNames(rnd * nNamesCount)
+ Out.Log("Choose for testing : " + Locale.Country)
+
+ bOK = bOK AND NOT isNULL(Locale)
+ Test.MethodTested("getAllInstalledLocaleNames()", bOK)
+
+ Test.StartMethod("getLanguageCountryInfo()")
+ bOK = true
+ oInfo = oObj.getLanguageCountryInfo(Locale)
+ bOK = bOK AND oInfo.Language = Locale.Language
+ bOK = bOK AND oInfo.Country = Locale.Country
+ Out.Log("Language: " + oInfo.Language + _
+ ", LanguageDefaultName: " + oInfo.LanguageDefaultName + _
+ ", Country: " + oInfo.Country + _
+ ", CountryDefaultName: " + oInfo.CountryDefaultName + _
+ ", Variant: " + oInfo.Variant)
+
+ Test.MethodTested("getLanguageCountryInfo()", bOK)
+
+ Test.StartMethod("getLocaleItem()")
+ bOK = true
+ LocItem = oObj.getLocaleItem(Locale)
+ bOK = bOK AND LocItem.unoID &lt;&gt; ""
+ Out.Log(" unoID: " + LocItem.unoID + _
+ " dateSeparator: " + LocItem.dateSeparator + _
+ " thousandSeparator: " + LocItem.thousandSeparator + _
+ " decimalSeparator: " + LocItem.decimalSeparator + _
+ " timeSeparator: " + LocItem.timeSeparator + _
+ " time100SecSeparator: " + LocItem.time100SecSeparator + _
+ " listSeparator: " + LocItem.listSeparator + _
+ " quotationStart: " + LocItem.quotationStart + _
+ " quotationEnd: " + LocItem.quotationEnd + _
+ " doubleQuotationStart: " + LocItem.doubleQuotationStart + _
+ " doubleQuotationEnd: " + LocItem.doubleQuotationEnd + _
+ " timeAM: " + LocItem.timeAM + _
+ " timePM: " + LocItem.timePM + _
+ " measurementSystem: " + LocItem.measurementSystem + _
+ " LongDateDayOfWeekSeparator: " + LocItem.LongDateDayOfWeekSeparator + _
+ " LongDateDaySeparator: " + LocItem.LongDateDaySeparator + _
+ " LongDateMonthSeparator: " + LocItem.LongDateMonthSeparator + _
+ " LongDateYearSeparator: " + LocItem.LongDateYearSeparator)
+ Test.MethodTested("getLocaleItem()", bOK)
+
+ Test.StartMethod("getAllCalendars()")
+ bOK = true
+ AllCalendars = oObj.getAllCalendars(Locale)
+ bOK = bOK AND NOT isNULL(AllCalendars(0))
+ Out.Log("Found " + ubound(AllCalendars) + 1 + " calendar(s) used in this Locale")
+
+ Dim Days As Variant, Months As Variant, Eras As Variant
+ Dim j As Integer
+ for i = 0 to ubound(AllCalendars)
+
+ Out.Log("Calendar " + i + 1 + ":")
+ Out.Log(" Days:")
+ Days = AllCalendars(i).Days
+ for j = 0 to ubound(Days)
+ Out.Log(" " + j + ") ID: " + Days(j).ID + ", AbbrevName: " + Days(j).AbbrevName + ", FullName: " + Days(j).FullName)
+ next j
+ Out.Log(" Months:")
+ Months = AllCalendars(i).Months
+ for j = 0 to ubound(Months)
+ Out.Log(" " + j + ") ID: " + Months(j).ID + ", AbbrevName: " + Months(j).AbbrevName + ", FullName: " + Months(j).FullName)
+ next j
+ Out.Log(" Eras:")
+ Eras = AllCalendars(i).Eras
+ for j = 0 to ubound(Eras)
+ Out.Log(" " + j + ") ID: " + Eras(j).ID + ", AbbrevName: " + Eras(j).AbbrevName + ", FullName: " + Eras(j).FullName)
+ next j
+ Out.Log(" StartOfWeek: " + AllCalendars(i).StartOfWeek)
+ Out.Log(" MinimumNumberOfDaysForFirstWeek: " + AllCalendars(i).MinimumNumberOfDaysForFirstWeek)
+ Out.Log(" Default: " + AllCalendars(i).Default)
+ Out.Log(" Name: " + AllCalendars(i).Name)
+ next i
+
+ Test.MethodTested("getAllCalendars()", bOK)
+
+ Test.StartMethod("getAllCurrencies()")
+ bOK = true
+ AllCurrencies = oObj.getAllCurrencies(Locale)
+ Out.Log("Found " + ubound(AllCurrencies) + 1 + " Currencies used in this Locale")
+ bOK = bOK AND NOT isNULL(AllCurrencies(0))
+ for i = 0 to ubound(AllCurrencies)
+ Out.Log("Currency " + i + 1 + ":")
+ Out.Log(" ID: " + AllCurrencies(i).ID + _
+ " Symbol: " + AllCurrencies(i).Symbol + _
+ " BankSymbol: " + AllCurrencies(i).BankSymbol + _
+ " Name: " + AllCurrencies(i).Name + _
+ " Default: " + AllCurrencies(i).Default)
+ next i
+
+ Test.MethodTested("getAllCurrencies()", bOK)
+
+ Test.StartMethod("getAllFormats()")
+ bOK = true
+ AllFormats = oObj.getAllFormats(Locale)
+ Out.Log("Found " + ubound(AllFormats) + 1 + " FormatElement(s) used in this Locale")
+ bOK = bOK AND NOT isNULL(AllFormats(0))
+ for i = 0 to ubound(AllFormats)
+ Out.Log("FormatElement " + i + 1 + ":")
+ Out.Log(" formatCode: " + AllFormats(i).formatCode + _
+ " formatName: " + AllFormats(i).formatName + _
+ " formatKey: " + AllFormats(i).formatKey + _
+ " formatType: " + AllFormats(i).formatType + _
+ " formatUsage: " + AllFormats(i).formatUsage + _
+ " formatIndex: " + AllFormats(i).formatIndex + _
+ " isDefault: " + AllFormats(i).isDefault)
+ next i
+ Test.MethodTested("getAllFormats()", bOK)
+
+ Test.StartMethod("getCollatorImplementations()")
+ bOK = true
+ Implementations = oObj.getCollatorImplementations(Locale)
+ Out.Log("Found " + (ubound(Implementations) + 1) + " Implementation(s) used in this Locale")
+ bOK = bOK AND NOT isNULL(Implementations(0))
+ for i = 0 to ubound(Implementations)
+ Out.Log("Implementation " + (i + 1) + ":")
+ Out.Log(" unoID: " + Implementations(i).unoID )
+ Out.Log(" isDefault: " + Implementations(i).isDefault)
+ next i
+ Test.MethodTested("getCollatorImplementations()", bOK)
+
+ Test.StartMethod("getSearchOptions()")
+ bOK = true
+ sOpt = oObj.getSearchOptions(Locale)
+ size = ubound(sOpt)
+ Out.Log("There are : " + (size + 1) + " search options.")
+ for i = 0 to size
+ Out.Log("'" + sOpt(i) + "'")
+ next i
+ bOK = bOK AND isArray(sOpt)
+ Test.MethodTested("getSearchOptions()", bOK)
+
+ Test.StartMethod("getCollationOptions()")
+ bOK = true
+ sOpt = oObj.getCollationOptions(Locale)
+ size = ubound(sOpt)
+ Out.Log("There are : " + (size + 1) + " collation options.")
+ for i = 0 to size
+ Out.Log("'" + sOpt(i) + "'")
+ next i
+ bOK = bOK AND isArray(sOpt)
+ Test.MethodTested("getCollationOptions()", bOK)
+
+ Test.StartMethod("getTransliterations()")
+ bOK = true
+ rtLit = oObj.getTransliterations(Locale)
+ bOK = bOK AND NOT isNULL(rtLit)
+ for i = 0 to ubound(rtLit)
+ Out.Log("" + i + 1 +") " + rtLit(i))
+ next i
+ Test.MethodTested("getTransliterations()", bOK)
+
+ Test.StartMethod("getForbiddenCharacters()")
+ bOK = true
+ fbc = oObj.getForbiddenCharacters(Locale)
+
+ Out.Log(" beginLine: " + fbc.beginLine)
+ Out.Log(" endLine: " + fbc.endLine)
+
+ bOK = bOK AND NOT isNULL(fbc)
+ Test.MethodTested("getForbiddenCharacters()", bOK)
+
+ Test.StartMethod("getReservedWord()")
+ bOK = true
+ rw = oObj.getReservedWord(Locale)
+ bOK = bOK AND NOT isNULL(rw)
+ for i = 0 to ubound(rw)
+ Out.Log("" + i + 1 +") " + rw(i))
+ next i
+ Test.MethodTested("getReservedWord()", bOK)
+
+Exit Sub
+ErrHndl:
+ Test.Exception()
+ bOK = false
+ resume next
+End Sub
+</script:module>