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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // This file contains RTest based test which checks behaviour of InitialiseLocale.exe
15 // when persisted locale is corrrupt/damaged
27 #include <centralrepository.h>
28 #include "LocaleRepository.h"
29 #include "InitialiseLocale.h"
30 #include "T_CheckLocale.h"
33 // Name of the exe to be called explicitly
34 _LIT(KInitPersistLocaleExeName, "InitialiseLocale.exe");
36 LOCAL_D RTest test(_L("T_RebootLocaleNewLocaleModel"));
39 // Central Repository Data cage file-path
40 _LIT(KPersistLocale, "C:\\private\\10202be9\\persists\\1020E4D3.*");
45 This function prepares for next test i.e, tests InitialiseLocale behaves
46 when persisted file is damaged/corrupt.
48 void SetUpTestCorruptLocale()
50 TExtendedLocale myExtendedLocale;
51 myExtendedLocale.LoadSystemSettings() ;
53 test.Printf(_L("\n Changing Locale to Chinese Locale(31) so that default values are evident"));
55 // Change the locale to Default Locale, all settings from single Dll
56 myExtendedLocale.LoadLocale(KCNLanguage(), KCNRegion(), KCNCollation());
58 // Save the changes to system settings
59 myExtendedLocale.SaveSystemSettings();
61 // Wait so that it persists to repository
64 User::LeaveIfError(TheFs.Connect());
65 // Delete/damage the persisted file so that InitialiseLocale.exe
66 // detects the damage and loads default locale
67 BaflUtils::DeleteFile(TheFs, KPersistLocale);
69 test.Printf(_L("\n Deleted persist file from C: \n"));
72 @SYMTestCaseID SYSLIB-BAFL-CIT-0142
73 @SYMTestCaseDesc Check that InitialiseLocale can get the correct locale information after reboot in the new locale model.
75 @SYMTestActions Ensure that InitialiseLocale can get the correct locale information after reboot in the new locale model.
76 @SYMTestExpectedResults The test must not fail.
79 LOCAL_D void TestRebootLocale()
81 test.Start(_L(" @SYMTestCaseID:TI18N-INITLOCALE-CT-4006 after rebooting check the locale content"));
82 TestLocaleDLLName(test, KCNLanguage(), KCNRegion(), KCNCollation());
83 TestLocaleContent(test, KCNLanguageID, KCNCurrencySymbol, KCNTCollationMethodID);
89 /** Tests behavior of Initialisation mechanism after system reboots
90 This test requires that,
91 1. The T_LocaleFlexiNewLocaleModel is executed
93 3. Epoc restarted (so that InitialisationLocale.exe is called)
94 4. Then this test be run
96 void TestRebootLocaleBehavior()
99 // Kick-in InitialiseLocale.exe once again explicitly, This will be
100 // done as part of system start in actual release code.
101 TInt r = process.Create(KInitPersistLocaleExeName, KNullDesC);
104 process.Resume(); // Start the process going
105 User::After(1000000);
109 User::After(1000000);
111 User::After(1000000);
118 CTrapCleanup* cleanup = CTrapCleanup::New();
119 test(cleanup != NULL);
122 test.Start(_L("Test to test reboot system"));
125 TRAPD(err, ::TestRebootLocaleBehavior());
127 test(err == KErrNone);
129 TRAPD(err1, ::SetUpTestCorruptLocale());
130 test(err1 == KErrNone);