os/ossrv/lowlevellibsandfws/apputils/initLocale/test/T_OldAPIOldModel.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 
    16 #include "T_CheckLocale.h"
    17 
    18 RTest test(_L("T_OldAPIinOldModel"));
    19 
    20 
    21 //Old locale API should matain backward compatibility  in the old locale model
    22 //(with the old locale DLL format)
    23 
    24 void TestOldLocaleAPI()
    25     {
    26     TExtendedLocale firstExtendLocale;
    27     
    28     test.Start(_L(" @SYMTestCaseID:TI18N-EUSER-CIT-4015 old LoadLocale() API on old locale model"));
    29     firstExtendLocale.LoadSystemSettings();
    30     test( KErrNone == firstExtendLocale.LoadLocale(KOldCNLocaleName()) );
    31     test( KErrNone == firstExtendLocale.SaveSystemSettings() );   
    32     TestLocaleDLLName(test, KOldCNLocaleName(), KOldCNLocaleName(), KOldCNLocaleName() );
    33     TestLocaleContent(test, KCNLanguageID, KCNCurrencySymbol, KCNTCollationMethodID);
    34 
    35     firstExtendLocale.LoadSystemSettings();
    36     test( KErrNone == firstExtendLocale.LoadLocale(KOldUKLocaleName()) );
    37     test( KErrNone == firstExtendLocale.SaveSystemSettings() );   
    38     TestLocaleDLLName(test, KOldUKLocaleName(), KOldUKLocaleName(), KOldUKLocaleName() );
    39     TestLocaleContent(test, KEnglishLanguageID, KUKCurrencySymbol, KStandardCollationID);
    40     test.End();
    41     
    42     //becasue TestLocaleContent() naturally check the system locale content, we mark this test case here.
    43     test.Start(_L(" @SYMTestCaseID:TI18N-EUSER-CIT-4019 publish locale content to the system"));
    44     test.End();
    45     
    46     test.Start(_L(" @SYMTestCaseID:TI18N-EUSER-CIT-4016 old LoadLocaleAspect() API on old locale model"));
    47     firstExtendLocale.LoadSystemSettings();  
    48     test( KErrNone == firstExtendLocale.LoadLocaleAspect(ELocaleLanguageSettings, KOldUKLocaleName()));
    49     test( KErrNone == firstExtendLocale.LoadLocaleAspect(ELocaleCollateSetting, KOldCNLocaleName()));
    50     test( KErrNone == firstExtendLocale.LoadLocaleAspect(ELocaleLocaleSettings, KOldUSLocaleName()));
    51     test( KErrNone == firstExtendLocale.SaveSystemSettings() );
    52     TestLocaleDLLName(test, KOldUKLocaleName(), KOldUSLocaleName(), KOldCNLocaleName() );
    53     TestLocaleContent(test, KEnglishLanguageID, KUSCurrencySymbol, KCNTCollationMethodID);
    54 
    55     firstExtendLocale.LoadSystemSettings();
    56     test( KErrNone == firstExtendLocale.LoadLocaleAspect(ELocaleLanguageSettings, KOldGELocaleName()));
    57     test( KErrNone == firstExtendLocale.LoadLocaleAspect(ELocaleCollateSetting, KOldGELocaleName()));
    58     test( KErrNone == firstExtendLocale.LoadLocaleAspect(ELocaleLocaleSettings, KOldGELocaleName()));
    59     test( KErrNone == firstExtendLocale.SaveSystemSettings() );
    60     TestLocaleDLLName(test, KOldGELocaleName(), KOldGELocaleName(), KOldGELocaleName() );
    61     TestLocaleContent(test, KGELanguageID, KGECurrencySymbol, KGETCollationMethodID);
    62     test.End();
    63     }
    64 
    65 
    66 void TestOldLocaleModel()
    67     {   
    68     TestOldLocaleAPI();   
    69     }
    70 
    71 TInt E32Main()
    72     {
    73     CTrapCleanup* tc = CTrapCleanup::New();
    74     test(tc != NULL);
    75 
    76     __UHEAP_MARK;
    77 
    78     test.Start(_L("The test for old locale API in old locale model"));
    79     test.Title();
    80     TRAPD(err, ::TestOldLocaleModel())
    81     test(err == KErrNone);
    82     
    83     test.Printf(_L("\nTest for old locale API in old locale model finished!"));
    84 
    85     test.End();
    86     test.Close();
    87 
    88     __UHEAP_MARKEND;
    89 
    90     delete tc;
    91 
    92     return(KErrNone);
    93     }