common/tools/ats/smoketest/localisation/apparchitecture/tef/T_LocaleStep.cpp
author victorp@symbian.org
Wed, 03 Feb 2010 16:06:24 +0000
changeset 872 17498133d9ad
parent 793 0c32c669a39d
permissions -rw-r--r--
adding EPL headers to smoke test
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
793
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     1
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     2
// All rights reserved.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     3
// This component and the accompanying materials are made available
872
17498133d9ad adding EPL headers to smoke test
victorp@symbian.org
parents: 793
diff changeset
     4
// under the terms of the License "Eclipse Public License v1.0"
793
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     5
// which accompanies this distribution, and is available
872
17498133d9ad adding EPL headers to smoke test
victorp@symbian.org
parents: 793
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
793
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     7
//
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     8
// Initial Contributors:
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    10
//
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    11
// Contributors:
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    12
//
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    13
// Description:
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    14
// Tests to meet REQ758.2: "Captions localization must be efficient
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    15
// (i.e. not waste disk space) and extensible (i.e. support non-ROM language packs)"\n
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    16
// Test for UIKON GT0143 Typhoon Work Series 60 Changes
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    17
// REQ758.2: Captions localization must be efficient (i.e. not waste disk space)
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    18
// and extensible (i.e. support non-ROM language packs)
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    19
// Test for CR0902 - Enable Dynamic Language Switching in APPARC.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    20
// Application's localisable information should be updated by apparc on language change event.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    21
// 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    22
//
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    23
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    24
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    25
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    26
/**
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    27
 @file
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    28
 @internalComponent - Internal Symbian test code 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    29
*/
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    30
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    31
#include <e32test.h>
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    32
#include <f32file.h>
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    33
#include <apgicnfl.h>
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    34
#include <hal.h>
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    35
#include <apgcli.h>
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    36
#include "T_LocaleStep.h"
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    37
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    38
const TUid KUidTestApp = { 10 }; //uid of tstapp.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    39
const TUid KUidCustomiseDefaultIconApp = {0x10208181}; // uid of CustomiseDefaultIconApp.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    40
const TInt KDelayForOnDemand = 20000; //a small delay
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    41
const TInt KDelay = 4000000; // Most apparc tests have 2.5 secs wait time to let apparc update the app-list, but on safer side let us give 4 secs.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    42
const TInt KViewCount = 3; // Total no of views in tstapp
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    43
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    44
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    45
/**
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    46
  Auxiliary Fn for Test Case ID T-LocaleStep-TestAllLanguages
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    47
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    48
  This method loads the required DLL for the language specified as argument
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    49
  and changes the locale accordingly.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    50
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    51
*/
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    52
void CT_LocaleStep::ChangeLocaleL(TLanguage aLanguage)
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    53
	{
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    54
	_LIT(KLitLocaleDllNameBase, "ELOCL");
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    55
	_LIT(KLitLocaleDllNameExtension, ".LOC");
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    56
	RLibrary localeDll;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    57
	TBuf<16> localeDllName(KLitLocaleDllNameBase);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    58
	CleanupClosePushL(localeDll);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    59
	const TUidType uidType(TUid::Uid(0x10000079),TUid::Uid(0x100039e6));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    60
	_LIT(TwoDigExt,".%02d");
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    61
	localeDllName.AppendFormat(TwoDigExt, aLanguage);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    62
	TInt error=localeDll.Load(localeDllName, uidType);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    63
	if (error==KErrNotFound)
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    64
		{
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    65
		localeDllName=KLitLocaleDllNameBase;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    66
		localeDllName.Append(KLitLocaleDllNameExtension);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    67
		error=localeDll.Load(localeDllName, uidType);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    68
		}
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    69
	User::LeaveIfError(error);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    70
	User::LeaveIfError(UserSvr::ChangeLocale(localeDllName));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    71
	CleanupStack::PopAndDestroy(); // localeDll
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    72
	}
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    73
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    74
// CheckIcons is a function used in testcase TestLocaleDefaultIconL to check the size of the default icons
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    75
void CT_LocaleStep::CheckIcons(CArrayFixFlat<TSize>* aNewIconSizes,TSize aSmall,TSize aMedium,TSize aLarge, TSize& afstIcon, TSize& asecIcon, TSize& atrdIcon)
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    76
	{
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    77
	afstIcon = (*aNewIconSizes)[0];
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    78
	asecIcon = (*aNewIconSizes)[1];
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    79
	atrdIcon = (*aNewIconSizes)[2];
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    80
	TEST((afstIcon==aSmall) || (afstIcon==aMedium) || (afstIcon==aLarge) && ((afstIcon!=asecIcon) && (afstIcon!=atrdIcon)));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    81
	TEST((asecIcon==aSmall) || (asecIcon==aMedium) || (asecIcon==aLarge) && ((asecIcon!=afstIcon) && (asecIcon!=atrdIcon)));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    82
	TEST((atrdIcon==aSmall) || (atrdIcon==aMedium) || (atrdIcon==aLarge) && ((atrdIcon!=afstIcon) && (atrdIcon!=asecIcon)));	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    83
	}
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    84
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    85
/**
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    86
  @SYMTestCaseID APPFWK-APPARC-0070
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    87
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    88
  @SYMPREQ
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    89
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    90
  @SYMTestCaseDesc Test whether the default app icons change with respect to the locale/language.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    91
  This testcase checks whether BaflUtils::NearestLanguageFile is called when the locale has been changed.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    92
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    93
  @SYMTestPriority High  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    94
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    95
  @SYMTestStatus Implemented
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    96
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    97
  @SYMTestActions  Call User::Language() to check that the default locale is English; Call CT_LocaleStep::CheckIcons 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    98
  to check the size of the current default icons; Call UserSvr::ChangeLocale to change the Locale to French; 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    99
  Call CT_LocaleStep::CheckIcons to check the size of the new icons; Restore the file system and the locale 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   100
  and check if the icons are restored.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   101
  API Calls:\n	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   102
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   103
  @SYMTestExpectedResults Returns KErrNone
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   104
 */	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   105
void CT_LocaleStep::TestLocaleDefaultIconL()
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   106
	{
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   107
	INFO_PRINTF1(_L("APPFWK-APPARC-0070: TestLocaleDefaultIconL started..."));	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   108
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   109
	TInt ret = 0;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   110
		
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   111
	//first checks that language is not currently set to French (any other language except English since English is the default language
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   112
	TEST(User::Language()!=ELangFrench);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   113
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   114
	// getappiconsizes must be called to check if the icons are the default ones
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   115
	// KUidCustomiseDefaultIconApp - uid of CustomiseDefaultIconApp_reg.RSS; this app has a localisable resource file, CustomiseDefaultIconApp_loc.RSS, that does not define any icon
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   116
	// Hence, the default icons must be picked up when the language changes to French. The default icons for French are defined in default_app_icon.m02
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   117
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   118
	CArrayFixFlat<TSize>* newIconSizes = new(ELeave) CArrayFixFlat<TSize>(3);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   119
	CleanupStack::PushL(newIconSizes);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   120
	TRAP(ret,iLs.GetAppIconSizes(KUidCustomiseDefaultIconApp, *newIconSizes));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   121
	TEST(ret==KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   122
	TEST(newIconSizes->Count()!=0);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   123
	// these are the sizes of the default icons
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   124
	TSize small(24,24);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   125
	TSize medium(32,32);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   126
	TSize large(48,48);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   127
	TSize fstIcon;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   128
	TSize secIcon;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   129
	TSize trdIcon;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   130
	CheckIcons(newIconSizes, small, medium,large, fstIcon, secIcon, trdIcon);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   131
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   132
	// Change the locale to French
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   133
	TRAP(ret,ChangeLocaleL(ELangFrench));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   134
	TEST(ret==KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   135
	TEST(User::Language()==ELangFrench);//checks that the language has been set to French
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   136
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   137
	//Wait for a small period to let apparc receive language change notification
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   138
	User::After(KDelayForOnDemand);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   139
	//call getappiconsizes to see if the new icons have been changed as as expected 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   140
	// The size of the icons indicates whether the icon corresponding to French Locale has been picked up
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   141
	newIconSizes->Reset();
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   142
	TRAP(ret,iLs.GetAppIconSizes(KUidCustomiseDefaultIconApp, *newIconSizes));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   143
	TEST(ret==KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   144
	TEST(newIconSizes->Count()!=0);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   145
	small.SetSize(25,25);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   146
	medium.SetSize(35,35);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   147
	large.SetSize(50,50);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   148
	CheckIcons(newIconSizes, small, medium,large, fstIcon, secIcon, trdIcon);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   149
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   150
	//have to restore the locale before exiting the testcase
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   151
	TRAP(ret,ChangeLocaleL(ELangEnglish));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   152
	TEST(ret==KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   153
	TEST(User::Language()==ELangEnglish);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   154
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   155
	//Again wait for a small period to let apparc receive language change notification
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   156
	User::After(KDelayForOnDemand);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   157
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   158
	//call getappiconsizes to see if the new icons have been changed as as expected 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   159
	// The size of the icons indicates whether the icon corresponding to English Locale has been picked up
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   160
	newIconSizes->Reset();
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   161
	TRAP(ret,iLs.GetAppIconSizes(KUidCustomiseDefaultIconApp, *newIconSizes));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   162
	TEST(ret==KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   163
	TEST(newIconSizes->Count()!=0);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   164
	small.SetSize(24,24);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   165
	medium.SetSize(32,32);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   166
	large.SetSize(48,48);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   167
	CheckIcons(newIconSizes, small, medium,large, fstIcon, secIcon, trdIcon);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   168
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   169
	// Icon cleanup
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   170
	CleanupStack::PopAndDestroy(newIconSizes);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   171
	newIconSizes=NULL;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   172
	INFO_PRINTF1(_L("APPFWK-APPARC-0070: TestLocaleDefaultIconL finished..."));	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   173
	}
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   174
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   175
/**
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   176
  @SYMTestCaseID APPFWK-APPARC-0061
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   177
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   178
  @SYMPREQ CR0902 - Enable Dynamic Language Switching in APPARC.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   179
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   180
  @SYMTestCaseDesc Test whether caption, short caption and app icon, is updated with respect to the change 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   181
  in locale/language. This test case checks on language change event apparc updates application 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   182
  localisable information for all installed applications, without forcing a change in the part of 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   183
  file system which apparc monitors. 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   184
  This test also tests, on a language change event, application's localisable information is 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   185
  updated immediately, if not yet updated by the re-scan (On demand loading). This is done by not 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   186
  giving enough time to finish rescan of app-list.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   187
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   188
  @SYMTestPriority Critical 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   189
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   190
  @SYMTestStatus Implemented
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   191
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   192
  @SYMTestActions  Check if language is English by calling User::Language(). 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   193
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   194
  1. Call GetAppInfo() by passing an application's UID which provides support for multiple languages.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   195
  Check if the caption and short caption, both are in English. Change locale to French.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   196
  2. Call GetAppIcon() by passing same application's UID. Check app icons are same as sepcified in 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   197
  app icon file for English locale.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   198
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   199
  Wait for a small period (20 milli seconds) to let apparc receive language change notification. 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   200
  Again - 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   201
  1. Call GetAppInfo() by passing same application's UID and check if the caption and short caption, 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   202
  both are in French.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   203
  2. Call GetAppIcon() by passing same application's UID. Check app icons are same as sepcified in 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   204
  app icon file for French locale.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   205
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   206
  Restore locale to English and again check - 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   207
  1. If caption and short caption are in English after a call to GetAppInfo() for the same application.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   208
  2. Call GetAppIcon() by passing same application's UID. Check app icons are same as sepcified in 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   209
  app icon file for English locale.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   210
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   211
  @SYMTestExpectedResults 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   212
  1. GetAppInfo() should fetch caption and short caption in the newly-set language.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   213
  2. GetAppIcon() should fetch icons from the icon file selected for current locale.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   214
 */	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   215
void CT_LocaleStep::TestLocaleApplicationInfoOnDemandL()
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   216
	{
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   217
	INFO_PRINTF1(_L("APPFWK-APPARC-0061: TestLocaleApplicationInfoOnDemandL started..."));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   218
	TestAppInfoL(ETrue);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   219
	INFO_PRINTF1(_L("APPFWK-APPARC-0061: TestLocaleApplicationInfoOnDemandL finished..."));	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   220
	}
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   221
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   222
/**
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   223
  @SYMTestCaseID APPFWK-APPARC-0062
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   224
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   225
  @SYMPREQ CR0902 - Enable Dynamic Language Switching in APPARC.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   226
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   227
  @SYMTestCaseDesc Test whether caption, short caption and app icon, is updated with respect to the change in 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   228
  locale/language. This test case checks on language change event apparc updates application localisable
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   229
  information for all installed applications, without forcing a change in the part of file system which 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   230
  apparc monitors.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   231
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   232
  @SYMTestPriority Critical
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   233
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   234
  @SYMTestStatus Implemented
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   235
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   236
  @SYMTestActions  Check if language is English by calling User::Language(). 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   237
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   238
  1. Call GetAppInfo() by passing an application's UID which provides support for multiple languages.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   239
  Check if the caption and short caption, both are in English. Change locale to French.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   240
  2. Call GetAppIcon by passing same application's UID. Check app icons are same as sepcified in 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   241
  app icon file for English locale.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   242
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   243
  Change locale to French. Wait for some time (e.g. 4 seconds) to let apparc complete rescanning of app-list.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   244
  Again - 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   245
  1. Call GetAppInfo() by passing same application's UID and check if the caption and short caption, 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   246
  both are in French.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   247
  2. Call GetAppIcon() by passing same application's UID. Check app icons are same as sepcified in 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   248
  app icon file for French locale.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   249
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   250
  Restore locale to English and again check - 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   251
  1. If caption and short caption are in English after a call to GetAppInfo() for the same application.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   252
  2. Call GetAppIcon() by passing same application's UID. Check app icons are same as sepcified in 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   253
  app icon file for English locale.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   254
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   255
  @SYMTestExpectedResults 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   256
  1. GetAppInfo() should fetch caption and short caption in the newly-set language.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   257
  2. GetAppIcon() should fetch icons from the icon file selected for current locale.  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   258
 */	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   259
void CT_LocaleStep::TestLocaleApplicationInfoL()
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   260
	{
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   261
	INFO_PRINTF1(_L("APPFWK-APPARC-0062: TestLocaleApplicationInfoL started..."));	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   262
	TestAppInfoL(EFalse);	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   263
	INFO_PRINTF1(_L("APPFWK-APPARC-0062: TestLocaleApplicationInfoL finished..."));	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   264
	}
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   265
			
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   266
/** 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   267
  This function performs steps to test application related information (caption, short caption and app icon)
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   268
  on language change event . 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   269
  It is called from TestLocaleApplicationInfoOnDemandL and TestLocaleApplicationInfoL.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   270
    
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   271
  @param aOnDemand Pass true if on demand loading is required, otherwise false.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   272
*/
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   273
void CT_LocaleStep::TestAppInfoL(TBool aOnDemand)
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   274
	{
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   275
	TInt ret = RFbsSession::Connect();
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   276
	TEST(ret == KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   277
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   278
	// If it is on-demand loading delay would be very less.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   279
	TInt delay = aOnDemand ? KDelayForOnDemand : KDelay;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   280
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   281
	// Check language is not currently set to French (any other language except English since English is the default language.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   282
	TEST(User::Language() != ELangFrench);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   283
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   284
	// Caption and Short-caption should be same as defined in English localisable strings file (tstapp01.rls)
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   285
	_LIT(KCaptionEng, "TstCap UK"); 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   286
	_LIT(KShortCaptionEng, "TC UK");
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   287
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   288
	// Call GetAppInfo() by passing KUidTestApp as tstapp's UID. tstapp provides support for multiple languages.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   289
	TApaAppInfo appInfo;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   290
	ret = iLs.GetAppInfo(appInfo, KUidTestApp);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   291
	TEST(ret == KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   292
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   293
	// Caption and short-caption should be in English.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   294
	TEST(appInfo.iCaption == KCaptionEng);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   295
	TEST(appInfo.iShortCaption == KShortCaptionEng);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   296
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   297
	// Test application's icons, should be same as sepcified in app icon file for English locale.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   298
	TestAppIconL(TSize(40,55));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   299
		
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   300
	// Change the locale to French
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   301
	TRAP(ret, ChangeLocaleL(ELangFrench));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   302
	TEST(ret == KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   303
	TEST(User::Language() == ELangFrench);//check language is set to French
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   304
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   305
	// Caption and Short-caption should be same as defined in French localisable strings file (tstapp02.rls)
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   306
	_LIT(KCaptionFrench, "TstCap FR");
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   307
	_LIT(KShortCaptionFrench, "TC FR");
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   308
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   309
	User::After(delay);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   310
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   311
	// Again call GetAppInfo() by passing KUidTestApp as UID. 	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   312
	ret = iLs.GetAppInfo(appInfo, KUidTestApp);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   313
	TEST(ret == KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   314
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   315
	// Caption and short-caption should be in French.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   316
	TEST(appInfo.iCaption == KCaptionFrench);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   317
	TEST(appInfo.iShortCaption == KShortCaptionFrench);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   318
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   319
	// Test application's icons, should be same as sepcified in app icon file for French locale.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   320
	TestAppIconL(TSize(50,50));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   321
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   322
	// Restore locale before exiting the testcase.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   323
	TRAP(ret, ChangeLocaleL(ELangEnglish));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   324
	TEST(ret == KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   325
	TEST(User::Language() == ELangEnglish);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   326
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   327
	User::After(delay);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   328
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   329
	ret = iLs.GetAppInfo(appInfo, KUidTestApp);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   330
	TEST(ret == KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   331
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   332
	// Caption and short-caption should again be in English.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   333
	TEST(appInfo.iCaption == KCaptionEng);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   334
	TEST(appInfo.iShortCaption == KShortCaptionEng);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   335
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   336
	// Test application's icons, should be same as sepcified in app icon file for English locale.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   337
	TestAppIconL(TSize(40,55));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   338
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   339
	RFbsSession::Disconnect();
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   340
	}
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   341
/**
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   342
  This function tests application's icon. It is called from TestAppInfoL function.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   343
*/	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   344
void CT_LocaleStep::TestAppIconL(TSize aSize)
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   345
	{
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   346
	CApaMaskedBitmap* icon = CApaMaskedBitmap::NewLC();
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   347
	TSize lastSize(0,0);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   348
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   349
	TInt ret = iLs.GetAppIcon(KUidTestApp, aSize, *icon);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   350
	TEST(ret == KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   351
	// Returned icon size should be exactly same as asked.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   352
	TEST(icon->SizeInPixels().iWidth * icon->SizeInPixels().iHeight == aSize.iWidth * aSize.iHeight);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   353
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   354
	CleanupStack::PopAndDestroy(icon);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   355
	}
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   356
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   357
/**
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   358
  @SYMTestCaseID APPFWK-APPARC-0063
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   359
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   360
  @SYMPREQ CR0902 - Enable Dynamic Language Switching in APPARC.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   361
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   362
  @SYMTestCaseDesc Test whether caption and short caption remains same on language change, if application
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   363
   does not provide support for multiple languages. 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   364
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   365
  @SYMTestPriority Critical 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   366
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   367
  @SYMTestStatus Implemented
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   368
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   369
  @SYMTestActions  Check if language is English by calling User::Language(). Call GetAppInfo() by passing an
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   370
  application's UID which does not provide support for multiple languages. Check if the caption and short 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   371
  caption, both are in English. Change locale to French.Wait for a small period (20 milli seconds) to let 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   372
  apparc receive language change notification. Again Call GetAppInfo() by passing same application's UID and 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   373
  check if the caption and short caption, both are still in English. Restore locale to English and again check 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   374
  if caption and short caption are in English after a call to GetAppInfo() for the same application.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   375
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   376
  @SYMTestExpectedResults GetAppInfo() should fetch caption and short caption in the same language. 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   377
 */	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   378
void CT_LocaleStep::TestLocaleApplicationInfo1L()
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   379
	{
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   380
	INFO_PRINTF1(_L("APPFWK-APPARC-0063: TestLocaleApplicationInfo1L started..."));	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   381
	TInt ret = KErrNotFound;	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   382
		
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   383
	// Check language is not currently set to French (any other language except English since English is the default language.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   384
	TEST(User::Language() != ELangFrench);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   385
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   386
	// Caption and Short-caption should be same as defined in the localisable resource file. (CustomiseDefaultIconApp_loc.RSS)
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   387
	_LIT(KCaptionEng, "CustomiseDefaultIconAppLong"); 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   388
	_LIT(KShortCaptionEng, "CustomiseDefaultIconApp");
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   389
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   390
	// KUidCustomiseDefaultIconApp - uid of CustomiseDefaultIconApp_reg.RSS; this app does not provide support for multiple languages.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   391
		
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   392
	// Call GetAppInfo() by passing above UID.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   393
	TApaAppInfo appInfo;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   394
	ret = iLs.GetAppInfo(appInfo, KUidCustomiseDefaultIconApp);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   395
	TEST(ret == KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   396
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   397
	// Caption and short-caption should be in English.	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   398
	TEST(appInfo.iCaption == KCaptionEng);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   399
	TEST(appInfo.iShortCaption == KShortCaptionEng);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   400
		
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   401
	// Change the locale to French
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   402
	TRAP(ret,ChangeLocaleL(ELangFrench));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   403
	TEST(ret == KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   404
	TEST(User::Language() == ELangFrench);//check language is set to French.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   405
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   406
	// Wait for a small period (20 milli seconds) to let apparc receive language change notification. 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   407
	User::After(KDelayForOnDemand);	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   408
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   409
	// Again call GetAppInfo() by passing KUidTestApp as UID. 	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   410
	ret = iLs.GetAppInfo(appInfo, KUidCustomiseDefaultIconApp);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   411
	TEST(ret == KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   412
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   413
	// Caption and short-caption should be in English.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   414
	TEST(appInfo.iCaption == KCaptionEng);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   415
	TEST(appInfo.iShortCaption == KShortCaptionEng);	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   416
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   417
	// Restore locale before exiting the testcase.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   418
	TRAP(ret,ChangeLocaleL(ELangEnglish));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   419
	TEST(ret == KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   420
	TEST(User::Language() == ELangEnglish);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   421
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   422
	User::After(KDelayForOnDemand);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   423
	ret = iLs.GetAppInfo(appInfo, KUidCustomiseDefaultIconApp);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   424
	TEST(ret == KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   425
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   426
	// Caption and short-caption should be in English again.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   427
	TEST(appInfo.iCaption == KCaptionEng);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   428
	TEST(appInfo.iShortCaption == KShortCaptionEng);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   429
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   430
	INFO_PRINTF1(_L("APPFWK-APPARC-0063: TestLocaleApplicationInfo1L finished..."));	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   431
	}
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   432
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   433
/**
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   434
  @SYMTestCaseID APPFWK-APPARC-0064 APPFWK-APPARC-0066 APPFWK-APPARC-0068
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   435
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   436
  @SYMPREQ CR0902 - Enable Dynamic Language Switching in APPARC.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   437
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   438
  @SYMTestCaseDesc Test whether 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   439
  1. View's caption is updated with respect to the change in locale/language. 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   440
  2. View's icons is updated with respect to the change in locale/language. 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   441
  3. View's icon file name changes with respect to the change in locale/language. 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   442
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   443
  This test case checks apparc updates application localisable information for all installed applications 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   444
  on language change event without forcing a change in the part of file system which apparc monitors.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   445
  This test also tests, on a language change event, application's localisable information is updated 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   446
  immediately, if not yet updated by the re-scan (On demand loading). This is done by not giving enough 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   447
  time to finish rescan of app-list.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   448
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   449
  @SYMTestPriority High 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   450
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   451
  @SYMTestStatus Implemented
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   452
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   453
  @SYMTestActions  Check if language is English by calling User::Language(). Call GetAppViews() by passing 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   454
  an application's UID which provides support for multiple languages and different size icons for French 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   455
  language. 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   456
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   457
  1. Check if all view captions are same as specified in localisable file and in English.  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   458
  2. Call GetAppViewIcon() passing above application's ID. Check view icon size, it should be as 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   459
  specified in English icon file.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   460
  3. Call overload of GetAppViewIcon() which returns view's icon file, passing above application's ID. 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   461
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   462
  Change locale to French.Wait for a small period (20 milli seconds) to let apparc receive language change 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   463
  notification. Again - 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   464
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   465
  1. Call GetAppViews() by passing same application's UID and check if the view captions for all views 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   466
  are in French.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   467
  2. Call GetAppViewIcon() by passing same application's UID.Check view icon size, it should be as specified 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   468
  in French icon file.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   469
  3. Call GetAppViewIcon() by passing same application's UID. Check view icon file, it should be same as 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   470
  specified in French locale.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   471
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   472
  Restore locale to English and again check 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   473
  1. if view captions are same as specified in English resource file.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   474
  2. if view icon size is same as specified in English icon file.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   475
  3. if view icon file is same as specified in English resource file.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   476
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   477
  @SYMTestExpectedResults Following are the expected results.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   478
  1. GetAppViews() should fetch captions for all views in the newly-set language.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   479
  2. GetAppViewIcon() should fetch icons specified in the newly-set language.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   480
  3. GetAppViewIcon() should fetch view's icon file specified in the newly-set language.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   481
 */	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   482
void CT_LocaleStep::TestLocaleViewCaptionAndIconOnDemandL()
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   483
	{
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   484
	INFO_PRINTF1(_L("APPFWK-APPARC-0064: TestLocaleViewCaptionOnDemandL started..."));		
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   485
	INFO_PRINTF1(_L("APPFWK-APPARC-0066: TestLocaleViewIconSizeOnDemandL started..."));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   486
	INFO_PRINTF1(_L("APPFWK-APPARC-0068: TestLocaleViewIconFileOnDemandL started..."));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   487
	TestViewCaptionAndIconL(ETrue);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   488
	INFO_PRINTF1(_L("APPFWK-APPARC-0064: TestLocaleViewCaptionOnDemandL finished..."));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   489
	INFO_PRINTF1(_L("APPFWK-APPARC-0066: TestLocaleViewIconSizeOnDemandL finished..."));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   490
	INFO_PRINTF1(_L("APPFWK-APPARC-0068: TestLocaleViewIconFileOnDemandL finished..."));	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   491
	}
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   492
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   493
/**
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   494
  @SYMTestCaseID APPFWK-APPARC-0065 APPFWK-APPARC-0067 APPFWK-APPARC-0069
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   495
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   496
  @SYMPREQ CR0902 - Enable Dynamic Language Switching in APPARC.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   497
  @SYMDEF PDEF113054 - Apparc fails to detect the presence of localized Mbm files
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   498
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   499
  @SYMTestCaseDesc Test whether 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   500
  1. View's caption changes with respect to the change in locale/language.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   501
  2. View's icons is updated with respect to the change in locale/language. 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   502
  3. View's icon file name changes with respect to the change in locale/language. 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   503
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   504
  This test case checks apparc updates application localisable information for all installed applications 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   505
  on language change event without forcing a change in the part of file system which apparc monitors.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   506
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   507
  It checks for localized MBM files and MBM icon files with generic extension for an application. 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   508
  @SYMTestPriority High 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   509
 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   510
  @SYMTestStatus Implemented
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   511
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   512
  @SYMTestActions  Check if language is English by calling User::Language(). Call GetAppViews() by passing 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   513
  an application's UID which provides support for multiple languages and different size icons for French 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   514
  language. 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   515
  1. Check if all view captions are same as specified in localisable file and in English.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   516
  2. Call GetAppViewIcon() passing above application's ID. Check view icon size, it should be as 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   517
  specified in English icon file.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   518
  3. Call overload of GetAppViewIcon() which returns view's icon file, passing above application's ID. 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   519
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   520
  Change locale to French. Wait for some time (e.g. 4 seconds) to let apparc complete rescanning of app-list.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   521
  Again - 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   522
  1. Call GetAppViews() by passing same application's UID and check if the view captions for all views 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   523
  are in French.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   524
  2. Call GetAppViewIcon() by passing same application's UID.Check view icon size, it should be as specified 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   525
  in French icon file.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   526
  3. Call GetAppViewIcon() by passing same application's UID. Check view icon file, it should be same as 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   527
  specified in French locale.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   528
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   529
  Restore locale to English and again check - 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   530
  1. if view captions are same as specified in English resource file.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   531
  2. if view icon size is same as specified in English icon file.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   532
  3. if view icon file is same as specified in English resource file.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   533
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   534
  @SYMTestExpectedResults Following are the expected results.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   535
  1. GetAppViews() should fetch captions for all views in the newly-set language.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   536
  2. GetAppViewIcon() should fetch icons specified in the newly-set language. 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   537
  3. GetAppViewIcon() should fetch view's icon file specified in the newly-set language.  		 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   538
 */	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   539
 void CT_LocaleStep::TestLocaleViewCaptionAndIconL()
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   540
	{
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   541
	INFO_PRINTF1(_L("APPFWK-APPARC-0065: TestLocaleViewCaption started..."));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   542
	INFO_PRINTF1(_L("APPFWK-APPARC-0067: TestLocaleViewIconSizeL started..."));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   543
	INFO_PRINTF1(_L("APPFWK-APPARC-0069: TestLocaleViewIconFileL started..."));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   544
	TestViewCaptionAndIconL(EFalse);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   545
	INFO_PRINTF1(_L("APPFWK-APPARC-0065: TestLocaleViewCaption finished..."));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   546
	INFO_PRINTF1(_L("APPFWK-APPARC-0067: TestLocaleViewIconSizeL finished..."));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   547
	INFO_PRINTF1(_L("APPFWK-APPARC-0069: TestLocaleViewIconFileL finished..."));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   548
	}
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   549
		
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   550
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   551
/** 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   552
  This function performs steps to test view related information (view caption, view icon size and view icon 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   553
  file name) on language change event.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   554
  and view icon file name.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   555
  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   556
  This function is called from following test cases -
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   557
  TestLocaleViewCaptionAndIconOnDemandL,
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   558
  TestLocaleViewCaptionAndIconL
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   559
   
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   560
  @param aTesCaption Pass true if caption test is required, otherwise false for view icon test.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   561
  @param aOnDemand Pass true if on demand loading is required, otherwise false.   
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   562
*/
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   563
void CT_LocaleStep::TestViewCaptionAndIconL(TBool aOnDemand)
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   564
	{	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   565
	TInt ret = RFbsSession::Connect();
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   566
	TEST(ret == KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   567
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   568
	// If it is on-demand loading delay would be very less.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   569
	TInt delay = aOnDemand ? KDelayForOnDemand : KDelay;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   570
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   571
	// Check language is not currently set to French (any other language except English since English is the default language.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   572
	TEST(User::Language() != ELangFrench);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   573
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   574
	// Create view array to hold views for TstApp.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   575
	CApaAppViewArray* appViews = new(ELeave) CApaAppViewArray(KViewCount);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   576
	CleanupStack::PushL(appViews);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   577
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   578
	// Call GetAppViews() by passing tstapp's KUidTestApp as UID. 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   579
	// tstapp provides support for multiple languages. 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   580
	ret = iLs.GetAppViews(*appViews, KUidTestApp);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   581
	TEST(ret == KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   582
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   583
	// Check application's view count. It should have three views.One of them is invalid
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   584
	TInt count = appViews->Count();	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   585
	TEST(count == KViewCount);	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   586
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   587
	// Check application's view's captions or icons. They should be in English
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   588
	CheckViewCaptionAndIconL(ELangEnglish, appViews);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   589
	CleanupStack::PopAndDestroy(appViews);		
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   590
		
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   591
	// Switch locale to French
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   592
	TRAP(ret, ChangeLocaleL(ELangFrench));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   593
	TEST(ret == KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   594
	TEST(User::Language() == ELangFrench);//check language is set to French
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   595
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   596
	// Wait for a small period to let apparc receive language change notification. 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   597
	User::After(delay);	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   598
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   599
	// Create view array to hold views for TstApp.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   600
	appViews = NULL;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   601
	appViews = new(ELeave) CApaAppViewArray(KViewCount);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   602
	CleanupStack::PushL(appViews);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   603
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   604
	ret = iLs.GetAppViews(*appViews, KUidTestApp);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   605
	TEST(ret == KErrNone);	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   606
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   607
	count = appViews->Count();
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   608
	TEST(count == KViewCount);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   609
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   610
	//Check application's view's captions or icons. They should be in French.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   611
	CheckViewCaptionAndIconL(ELangFrench, appViews);	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   612
	CleanupStack::PopAndDestroy(appViews);		
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   613
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   614
	//Restore locale to English before exiting the testcase
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   615
	TRAP(ret, ChangeLocaleL(ELangEnglish));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   616
	TEST(ret == KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   617
	TEST(User::Language() == ELangEnglish);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   618
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   619
	User::After(delay);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   620
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   621
	appViews = NULL;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   622
	appViews = new(ELeave) CApaAppViewArray(KViewCount);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   623
	CleanupStack::PushL(appViews);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   624
	ret = iLs.GetAppViews(*appViews, KUidTestApp);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   625
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   626
	TEST(ret == KErrNone);	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   627
	count = appViews->Count();
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   628
	TEST(count == KViewCount);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   629
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   630
	//check every thing is restored to English.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   631
	CheckViewCaptionAndIconL(ELangEnglish, appViews);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   632
	CleanupStack::PopAndDestroy(appViews);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   633
	RFbsSession::Disconnect();	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   634
	}
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   635
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   636
/** 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   637
  Tests view's caption and view's icon.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   638
  It is called from TestViewCaptionAndIconL function.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   639
  This function is hardcoded to test view captions and icons for two languages - 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   640
  ELangEnglish and ELangFrench, 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   641
  if any other language is passed from any test case, this function will cause the test case to fail.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   642
     
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   643
  @param aLanguage Language for which to test caption/icon.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   644
  @param aAppViews application's view array.  
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   645
*/	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   646
void CT_LocaleStep::CheckViewCaptionAndIconL(TLanguage aLanguage, CApaAppViewArray* aAppViews)
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   647
	{
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   648
	TInt testNumberOfIcons=KViewCount-1;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   649
	// the for loop will check for all view icons except the last one which is invalid
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   650
	// Hence the upper limit is KViewCount-1
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   651
	for (TInt ii=0; ii < testNumberOfIcons ; ii++)
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   652
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   653
		{
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   654
		const TApaAppViewInfo& viewInfo = (*aAppViews)[ii];
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   655
		TEST(viewInfo.iViewCaption.Length() > 0);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   656
		TBuf<256> viewCaption;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   657
		TBuf<256> viewIconFileName;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   658
		TSize iconSize;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   659
		
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   660
		switch(aLanguage)
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   661
			{
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   662
			case ELangEnglish:
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   663
				viewCaption.Format(_L("V%d UK"), ii+1);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   664
				iconSize.iWidth  = 50;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   665
				iconSize.iHeight = 50;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   666
				break;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   667
							
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   668
			case ELangFrench:
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   669
				viewCaption.Format(_L("V%d FR"), ii+1);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   670
				iconSize.iWidth  = 40;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   671
				iconSize.iHeight = 55;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   672
				break;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   673
			
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   674
			default:
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   675
				// This case will cause test case to fail if any other language is passed apart from English and French.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   676
				break; 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   677
			}
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   678
		
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   679
		// View's captions should be same as defined in language's localisable strings file (tstappXX.rls)
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   680
		TEST(viewInfo.iViewCaption == viewCaption);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   681
		
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   682
		// View's icon size should be same as defined in icon file for the selected locale/language.
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   683
		CApaMaskedBitmap* viewBitmap = CApaMaskedBitmap::NewLC();
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   684
		TInt ret = iLs.GetAppViewIcon(KUidTestApp, viewInfo.iUid, iconSize, *viewBitmap);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   685
		TEST(ret == KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   686
		CleanupStack::PopAndDestroy(viewBitmap);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   687
		
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   688
		// View's icon file should be same as defined in language's localisable strings file (tstappXX.rls)
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   689
		HBufC* fullFileName = NULL;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   690
		ret = iLs.GetAppViewIcon(KUidTestApp, viewInfo.iUid, fullFileName);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   691
		TEST(ret == KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   692
		TEST(fullFileName != NULL);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   693
		INFO_PRINTF2(_L("View's icon file name is - %S"), fullFileName);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   694
		TEST(fullFileName->Length() > 0);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   695
		
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   696
		delete fullFileName;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   697
		fullFileName = NULL;		
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   698
		} //end of for
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   699
/*The invalid View icon for language French has the file name "tstappview.mbm" This should 
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   700
return KErrNotSupported. Refer to PDEF113054 for details */
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   701
	if (aLanguage==ELangFrench)
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   702
		{
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   703
		TSize iconSize;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   704
		const TApaAppViewInfo& viewInfo = (*aAppViews)[2];
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   705
		CApaMaskedBitmap* viewBitmap = CApaMaskedBitmap::NewLC();
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   706
		TInt ret = iLs.GetAppViewIcon(KUidTestApp, viewInfo.iUid, iconSize, *viewBitmap);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   707
		TEST(ret == KErrNotSupported);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   708
		CleanupStack::PopAndDestroy(viewBitmap);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   709
		HBufC* fullFileName = NULL;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   710
		ret = iLs.GetAppViewIcon(KUidTestApp, viewInfo.iUid, fullFileName);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   711
		TEST(ret == KErrNone);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   712
		TEST(fullFileName != NULL);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   713
		INFO_PRINTF2(_L("Negative View icon file name is - %S"), fullFileName);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   714
		TEST(fullFileName->Length() > 0);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   715
		delete fullFileName;
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   716
		fullFileName = NULL;		
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   717
		}
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   718
	}
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   719
		
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   720
CT_LocaleStep::~CT_LocaleStep()
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   721
/**
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   722
   Destructor
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   723
 */
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   724
	{
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   725
	}
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   726
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   727
CT_LocaleStep::CT_LocaleStep()
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   728
/**
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   729
   Constructor
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   730
 */
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   731
	{
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   732
	// Call base class method to set up the human readable name for logging
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   733
	SetTestStepName(KT_LocaleStep);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   734
	}
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   735
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   736
TVerdict CT_LocaleStep::doTestStepPreambleL()
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   737
/**
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   738
   @return - TVerdict code
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   739
   Override of base class virtual
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   740
 */
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   741
	{
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   742
	SetTestStepResult(EPass);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   743
	return TestStepResult();
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   744
	}
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   745
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   746
TVerdict CT_LocaleStep::doTestStepPostambleL()
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   747
/**
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   748
   @return - TVerdict code
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   749
   Override of base class virtual
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   750
 */
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   751
	{
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   752
	return TestStepResult();
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   753
	}
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   754
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   755
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   756
TVerdict CT_LocaleStep::doTestStepL()
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   757
/**
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   758
   @return - TVerdict code
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   759
   Override of base class virtual
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   760
 */
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   761
{
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   762
	INFO_PRINTF1(_L("Locale tests started"));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   763
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   764
	FbsStartup();
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   765
	TEST(KErrNone == iFs.Connect());
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   766
	TEST(KErrNone == iLs.Connect());
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   767
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   768
	// run the tests
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   769
	//DONT_CHECK due to changes to file system	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   770
	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestLocaleApplicationInfoOnDemandL() ,NO_CLEANUP);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   771
	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestLocaleApplicationInfoL() ,NO_CLEANUP);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   772
	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestLocaleApplicationInfo1L() ,NO_CLEANUP);		
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   773
	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestLocaleViewCaptionAndIconOnDemandL(), NO_CLEANUP);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   774
	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestLocaleViewCaptionAndIconL() ,NO_CLEANUP);	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   775
	HEAP_TEST_LS_SESSION(iLs, 0, DONT_CHECK, TestLocaleDefaultIconL() ,NO_CLEANUP);
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   776
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   777
	iLs.Close();
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   778
	iFs.Close();
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   779
	
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   780
	INFO_PRINTF1(_L("Test completed!"));
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   781
	return TestStepResult();
0c32c669a39d Added new smoke test for phone languages
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   782
}