os/ossrv/lowlevellibsandfws/apputils/initLocale/test/T_OldAPIOldModel.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/lowlevellibsandfws/apputils/initLocale/test/T_OldAPIOldModel.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,93 @@
     1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#include "T_CheckLocale.h"
    1.20 +
    1.21 +RTest test(_L("T_OldAPIinOldModel"));
    1.22 +
    1.23 +
    1.24 +//Old locale API should matain backward compatibility  in the old locale model
    1.25 +//(with the old locale DLL format)
    1.26 +
    1.27 +void TestOldLocaleAPI()
    1.28 +    {
    1.29 +    TExtendedLocale firstExtendLocale;
    1.30 +    
    1.31 +    test.Start(_L(" @SYMTestCaseID:TI18N-EUSER-CIT-4015 old LoadLocale() API on old locale model"));
    1.32 +    firstExtendLocale.LoadSystemSettings();
    1.33 +    test( KErrNone == firstExtendLocale.LoadLocale(KOldCNLocaleName()) );
    1.34 +    test( KErrNone == firstExtendLocale.SaveSystemSettings() );   
    1.35 +    TestLocaleDLLName(test, KOldCNLocaleName(), KOldCNLocaleName(), KOldCNLocaleName() );
    1.36 +    TestLocaleContent(test, KCNLanguageID, KCNCurrencySymbol, KCNTCollationMethodID);
    1.37 +
    1.38 +    firstExtendLocale.LoadSystemSettings();
    1.39 +    test( KErrNone == firstExtendLocale.LoadLocale(KOldUKLocaleName()) );
    1.40 +    test( KErrNone == firstExtendLocale.SaveSystemSettings() );   
    1.41 +    TestLocaleDLLName(test, KOldUKLocaleName(), KOldUKLocaleName(), KOldUKLocaleName() );
    1.42 +    TestLocaleContent(test, KEnglishLanguageID, KUKCurrencySymbol, KStandardCollationID);
    1.43 +    test.End();
    1.44 +    
    1.45 +    //becasue TestLocaleContent() naturally check the system locale content, we mark this test case here.
    1.46 +    test.Start(_L(" @SYMTestCaseID:TI18N-EUSER-CIT-4019 publish locale content to the system"));
    1.47 +    test.End();
    1.48 +    
    1.49 +    test.Start(_L(" @SYMTestCaseID:TI18N-EUSER-CIT-4016 old LoadLocaleAspect() API on old locale model"));
    1.50 +    firstExtendLocale.LoadSystemSettings();  
    1.51 +    test( KErrNone == firstExtendLocale.LoadLocaleAspect(ELocaleLanguageSettings, KOldUKLocaleName()));
    1.52 +    test( KErrNone == firstExtendLocale.LoadLocaleAspect(ELocaleCollateSetting, KOldCNLocaleName()));
    1.53 +    test( KErrNone == firstExtendLocale.LoadLocaleAspect(ELocaleLocaleSettings, KOldUSLocaleName()));
    1.54 +    test( KErrNone == firstExtendLocale.SaveSystemSettings() );
    1.55 +    TestLocaleDLLName(test, KOldUKLocaleName(), KOldUSLocaleName(), KOldCNLocaleName() );
    1.56 +    TestLocaleContent(test, KEnglishLanguageID, KUSCurrencySymbol, KCNTCollationMethodID);
    1.57 +
    1.58 +    firstExtendLocale.LoadSystemSettings();
    1.59 +    test( KErrNone == firstExtendLocale.LoadLocaleAspect(ELocaleLanguageSettings, KOldGELocaleName()));
    1.60 +    test( KErrNone == firstExtendLocale.LoadLocaleAspect(ELocaleCollateSetting, KOldGELocaleName()));
    1.61 +    test( KErrNone == firstExtendLocale.LoadLocaleAspect(ELocaleLocaleSettings, KOldGELocaleName()));
    1.62 +    test( KErrNone == firstExtendLocale.SaveSystemSettings() );
    1.63 +    TestLocaleDLLName(test, KOldGELocaleName(), KOldGELocaleName(), KOldGELocaleName() );
    1.64 +    TestLocaleContent(test, KGELanguageID, KGECurrencySymbol, KGETCollationMethodID);
    1.65 +    test.End();
    1.66 +    }
    1.67 +
    1.68 +
    1.69 +void TestOldLocaleModel()
    1.70 +    {   
    1.71 +    TestOldLocaleAPI();   
    1.72 +    }
    1.73 +
    1.74 +TInt E32Main()
    1.75 +    {
    1.76 +    CTrapCleanup* tc = CTrapCleanup::New();
    1.77 +    test(tc != NULL);
    1.78 +
    1.79 +    __UHEAP_MARK;
    1.80 +
    1.81 +    test.Start(_L("The test for old locale API in old locale model"));
    1.82 +    test.Title();
    1.83 +    TRAPD(err, ::TestOldLocaleModel())
    1.84 +    test(err == KErrNone);
    1.85 +    
    1.86 +    test.Printf(_L("\nTest for old locale API in old locale model finished!"));
    1.87 +
    1.88 +    test.End();
    1.89 +    test.Close();
    1.90 +
    1.91 +    __UHEAP_MARKEND;
    1.92 +
    1.93 +    delete tc;
    1.94 +
    1.95 +    return(KErrNone);
    1.96 +    }