os/ossrv/lowlevellibsandfws/apputils/initLocale/test/T_CheckLocale.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 #include "T_CheckLocale.h"
    16 
    17 void TestLocaleDLLName(RTest& test, const TDesC& alanguage, const TDesC& aRegion, const TDesC& aCollation)
    18     {
    19     test.Printf(_L("\nThe expected locale language, Region, Collation DLL names are: %S, %S, %S"), &alanguage, &aRegion, &aCollation);
    20     User::After(1000000);
    21     TExtendedLocale extendLocale;
    22     extendLocale.LoadSystemSettings();
    23     TBuf<KMaxFullName> loadedLocaleDLLName;
    24     User::After(1000000);
    25     
    26     extendLocale.GetLocaleDllName(ELocaleLanguageSettings, loadedLocaleDLLName);
    27     test.Printf(_L("\nThe system locale lagnuage DLL names is: %S"), &loadedLocaleDLLName);
    28     test(KErrNotFound != loadedLocaleDLLName.Find(alanguage));
    29  
    30     extendLocale.GetLocaleDllName(ELocaleLocaleSettings, loadedLocaleDLLName);
    31     test.Printf(_L("\nThe system locale Region DLL names is: %S"), &loadedLocaleDLLName);
    32     test(KErrNotFound != loadedLocaleDLLName.Find(aRegion));
    33     
    34     extendLocale.GetLocaleDllName(ELocaleCollateSetting, loadedLocaleDLLName);
    35     test.Printf(_L("\nThe system locale collation DLL names is: %S"), &loadedLocaleDLLName);
    36     test(KErrNotFound != loadedLocaleDLLName.Find(aCollation));
    37     }
    38 
    39 void TestLocaleContent(RTest& test, TLanguage alanguageID, TPtrC aCurrencySymbol, TUint aTCollationMethodID)
    40     {
    41     test.Printf(_L("\nThe expected locale languageID, CurrencySymbol, TCollationMethodID are: %d, %S, %d"), alanguageID, &aCurrencySymbol, aTCollationMethodID);
    42     User::After(1000000);
    43     TExtendedLocale extendLocale;
    44     extendLocale.LoadSystemSettings();
    45     User::After(1000000);
    46 
    47     test.Printf(_L("\nThe system locale languageID is: %d"), User::Language());
    48     test(alanguageID == User::Language());
    49     TPtrC currencySymbol = extendLocale.GetCurrencySymbol();
    50     test.Printf(_L("\nThe system locale CurrencySymbol is: %S"), &currencySymbol);
    51     test(aCurrencySymbol == extendLocale.GetCurrencySymbol());
    52     test.Printf(_L("\nThe system locale TCollationMethodID is: %d"), extendLocale.GetPreferredCollationMethod().iId);
    53     test(aTCollationMethodID == extendLocale.GetPreferredCollationMethod().iId);
    54     }