|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "Te_SimNitzTest.h" |
|
17 |
|
18 CSimNitzTest::CSimNitzTest() |
|
19 { |
|
20 SetTestStepName(_L("NitzTest")); |
|
21 } |
|
22 |
|
23 TVerdict CSimNitzTest::doTestStepL() |
|
24 { |
|
25 INFO_PRINTF1(_L("BeginNitzTest")); |
|
26 |
|
27 CreateConfigFileL(_L("c:\\config3.txt")); |
|
28 SetTestNumberL(0); |
|
29 |
|
30 const TInt32 KNitzFieldsUsed0= (RMobilePhone::KCapsTimeAvailable |
|
31 |RMobilePhone::KCapsTimezoneAvailable |
|
32 |RMobilePhone::KCapsDSTAvailable); |
|
33 const TInt KYear0= 2001; |
|
34 const TMonth KMonth0= EOctober; |
|
35 const TInt KDay0= 15; |
|
36 const TInt KHour0= 10; |
|
37 const TInt KMinute0= 15; |
|
38 const TInt KSecond0= 0; |
|
39 const TInt KMicroSecond0= 0; |
|
40 const TInt KTimeZone0= 1234; |
|
41 const TInt KDST0= 5678; |
|
42 _LIT(KShortNetworkId0,""); |
|
43 _LIT(KLongNetworkId0,""); |
|
44 |
|
45 const TInt32 KNitzFieldsUsed1= (RMobilePhone::KCapsTimeAvailable |
|
46 |RMobilePhone::KCapsTimezoneAvailable |
|
47 |RMobilePhone::KCapsDSTAvailable |
|
48 |RMobilePhone::KCapsShortNameAvailable |
|
49 |RMobilePhone::KCapsLongNameAvailable); |
|
50 const TInt KYear1= 2002; |
|
51 const TMonth KMonth1= ENovember; |
|
52 const TInt KDay1= 16; |
|
53 const TInt KHour1= 11; |
|
54 const TInt KMinute1= 16; |
|
55 const TInt KSecond1= 1; |
|
56 const TInt KMicroSecond1= 1; |
|
57 const TInt KTimeZone1= 9012; |
|
58 const TInt KDST1= 3456; |
|
59 _LIT(KShortNetworkId1,"Voda"); |
|
60 _LIT(KLongNetworkId1,"Vodafone_UK"); |
|
61 |
|
62 TInt ret = iPhone.Open(iTelServer,KPhoneName); |
|
63 INFO_PRINTF2(_L("Result: %d"),ret); |
|
64 TESTL(ret == KErrNone); |
|
65 INFO_PRINTF1(_L("Opened phone object")); |
|
66 |
|
67 TESTL(iPhone.Initialise()==KErrNone); |
|
68 INFO_PRINTF1(_L("Opened phone object")); |
|
69 |
|
70 INFO_PRINTF1(_L("Test Retrieve current NITZ information")); |
|
71 RMobilePhone::TMobilePhoneNITZ nitzInfo; |
|
72 TESTL(iPhone.GetNITZInfo(nitzInfo)==KErrNone); |
|
73 TESTL(nitzInfo.iNitzFieldsUsed==KNitzFieldsUsed0); |
|
74 TESTL(nitzInfo.Year()==KYear0); |
|
75 TESTL(nitzInfo.Month()==KMonth0); |
|
76 TESTL(nitzInfo.Day()==KDay0); |
|
77 TESTL(nitzInfo.Hour()==KHour0); |
|
78 TESTL(nitzInfo.Minute()==KMinute0); |
|
79 TESTL(nitzInfo.Second()==KSecond0); |
|
80 TESTL(nitzInfo.MicroSecond()==KMicroSecond0); |
|
81 TESTL(nitzInfo.iTimeZone==KTimeZone0); |
|
82 TESTL(nitzInfo.iDST==KDST0); |
|
83 TESTL(nitzInfo.iShortNetworkId==KShortNetworkId0); |
|
84 TESTL(nitzInfo.iLongNetworkId==KLongNetworkId0); |
|
85 |
|
86 INFO_PRINTF1(_L("Test Notification of NITZ information changing")); |
|
87 TRequestStatus stat0; |
|
88 iPhone.NotifyNITZInfoChange(stat0,nitzInfo); |
|
89 User::WaitForRequest(stat0); |
|
90 TESTL(nitzInfo.iNitzFieldsUsed==KNitzFieldsUsed1); |
|
91 TESTL(nitzInfo.Year()==KYear1); |
|
92 TESTL(nitzInfo.Month()==KMonth1); |
|
93 TESTL(nitzInfo.Day()==KDay1); |
|
94 TESTL(nitzInfo.Hour()==KHour1); |
|
95 TESTL(nitzInfo.Minute()==KMinute1); |
|
96 TESTL(nitzInfo.Second()==KSecond1); |
|
97 TESTL(nitzInfo.MicroSecond()==KMicroSecond1); |
|
98 TESTL(nitzInfo.iTimeZone==KTimeZone1); |
|
99 TESTL(nitzInfo.iDST==KDST1); |
|
100 TESTL(nitzInfo.iShortNetworkId==KShortNetworkId1); |
|
101 TESTL(nitzInfo.iLongNetworkId==KLongNetworkId1); |
|
102 |
|
103 iPhone.Close(); |
|
104 ASSERT(RThread().RequestCount()==0); |
|
105 |
|
106 return TestStepResult(); |
|
107 } |
|
108 |