diff options
Diffstat (limited to 'qadevOOo/tests/basic/ifc/i18n/XLocaleData/i18n_XLocaleData.xba')
-rw-r--r-- | qadevOOo/tests/basic/ifc/i18n/XLocaleData/i18n_XLocaleData.xba | 245 |
1 files changed, 245 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..88c9952fb920 --- /dev/null +++ b/qadevOOo/tests/basic/ifc/i18n/XLocaleData/i18n_XLocaleData.xba @@ -0,0 +1,245 @@ +<?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"> + + +'************************************************************************* +' +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org 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 version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'************************************************************************* +'************************************************************************* + + + +' 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 <> "" + 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> |