|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "commontestclass.h" |
|
20 #include <mpxsubscription.h> |
|
21 |
|
22 // ----------------------------------------------------------------------------- |
|
23 // CCommonTestClass::CMPXSubscriptionNewL() |
|
24 // Returns: Symbian OS errors. |
|
25 // ----------------------------------------------------------------------------- |
|
26 TInt CCommonTestClass::CMPXSubscriptionNewL(CStifItemParser& /*aItem*/) |
|
27 { |
|
28 FTRACE( FPrint( _L("CCommonTestClass::CMPXSubscription testing CMPXSubscription::NewL begin") ) ); |
|
29 iLog->Log( _L("CCommonTestClass::CMPXSubscription testing CMPXSubscription::NewL begin") ); |
|
30 TInt result = KErrNone; |
|
31 if( !iSubscription ) |
|
32 { |
|
33 TRAP( result,iSubscription = CMPXSubscription::NewL() ); |
|
34 //iSubscription = CMPXSubscription::NewL(); |
|
35 if( result == KErrNone ) |
|
36 { |
|
37 iLog->Log( _L("Successfully create instance of CMPXSubscription, none error returns.\r\n") ); |
|
38 } |
|
39 else |
|
40 { |
|
41 iLog->Log( _L("Failed to create instance of CMPXSubscription,error %d returns.\r\n"),result ); |
|
42 } |
|
43 } |
|
44 else |
|
45 { |
|
46 iLog->Log( _L("instance of CMPXSubscription has already existed.\r\n") ); |
|
47 } |
|
48 return result; |
|
49 } |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CCommonTestClass::CMPXSubscriptionNewLWithediaArrayL() |
|
52 // Returns: Symbian OS errors. |
|
53 // ----------------------------------------------------------------------------- |
|
54 TInt CCommonTestClass::CMPXSubscriptionNewLWithMediaArrayL(CStifItemParser& /*aItem*/) |
|
55 { |
|
56 FTRACE( FPrint( _L("CCommonTestClass::CMPXSubscription testing CMPXSubscription::NewL(CMPXMediaArray& aMediaArray) begin") ) ); |
|
57 iLog->Log( _L("CCommonTestClass::CMPXSubscription testing CMPXSubscription::NewL(CMPXMediaArray& aMediaArray) begin") ); |
|
58 TInt result = KErrNone; |
|
59 if( !iSubscription ) |
|
60 { |
|
61 TRAP( result,iSubscription = CMPXSubscription::NewL( *iMPXMediaArray ) ); |
|
62 //iSubscription = CMPXSubscription::NewL( *iMPXMediaArray ); |
|
63 if( result == KErrNone ) |
|
64 { |
|
65 iLog->Log( _L("Successfully create instance of CMPXSubscription, none error returns.\r\n") ); |
|
66 } |
|
67 else |
|
68 { |
|
69 iLog->Log( _L("Failed to create instance of CMPXSubscription,error %d returns.\r\n"),result ); |
|
70 } |
|
71 } |
|
72 else |
|
73 { |
|
74 iLog->Log( _L("instance of CMPXSubscription has already existed.\r\n") ); |
|
75 } |
|
76 return result; |
|
77 } |
|
78 // ----------------------------------------------------------------------------- |
|
79 // CCommonTestClass::CMPXSubscriptionAddItemL() |
|
80 // Returns: Symbian OS errors. |
|
81 // ----------------------------------------------------------------------------- |
|
82 TInt CCommonTestClass::CMPXSubscriptionAddItemL(CStifItemParser& /*aItem*/) |
|
83 { |
|
84 FTRACE( FPrint( _L("CCommonTestClass::CMPXSubscription testing CMPXSubscription::AddItemL() begin") ) ); |
|
85 iLog->Log( _L("CCommonTestClass::CMPXSubscription testing CMPXSubscription::AddItemL() begin") ); |
|
86 TInt result = KErrNone; |
|
87 CMPXSubscriptionItem* subscriptionItem = CMPXSubscriptionItem::NewL(); |
|
88 CleanupStack::PushL( subscriptionItem ); |
|
89 TRAP( result,iSubscription->AddItemL( *subscriptionItem ) ); |
|
90 //iSubscription->AddItemL( *subscriptionItem ); |
|
91 CleanupStack::Pop(); |
|
92 if( result == KErrNone ) |
|
93 { |
|
94 iLog->Log( _L("Successfully add item to CMPXSubscription instance.No error returns.\r\n") ); |
|
95 } |
|
96 else |
|
97 { |
|
98 iLog->Log( _L("Failed to add item to CMPXSubscription instance.Error %d returns.\r\n"),result ); |
|
99 } |
|
100 return result; |
|
101 } |
|
102 |
|
103 // ----------------------------------------------------------------------------- |
|
104 // CCommonTestClass::CMPXSubscriptionItemsL() |
|
105 // Returns: Symbian OS errors. |
|
106 // ----------------------------------------------------------------------------- |
|
107 TInt CCommonTestClass::CMPXSubscriptionItemsL(CStifItemParser& /*aItem*/) |
|
108 { |
|
109 FTRACE( FPrint( _L("CCommonTestClass::CMPXSubscription testing CMPXSubscription::ItemsL() begin") ) ); |
|
110 iLog->Log( _L("CCommonTestClass::CMPXSubscription testing CMPXSubscription::ItemsL() begin") ); |
|
111 TInt result = KErrNone; |
|
112 |
|
113 const CMPXMediaArray* mediaArray; |
|
114 TRAP( result,mediaArray = iSubscription->ItemsL() ); |
|
115 //mediaArray = iSubscription->ItemsL(); |
|
116 //TInt count = mediaArray->Count(); |
|
117 |
|
118 if( result == KErrNone ) |
|
119 { |
|
120 iLog->Log( _L("Successfully get CMPXMediaArray pionter.No error returns.\r\n") ); |
|
121 } |
|
122 else |
|
123 { |
|
124 iLog->Log( _L("Failed to get CMPXMediaArray pionter.Error %d returns.\r\n"),result ); |
|
125 } |
|
126 return result; |
|
127 } |
|
128 // ----------------------------------------------------------------------------- |
|
129 // CCommonTestClass::CMPXSubscriptionIsEqualOperator() |
|
130 // Returns: Symbian OS errors. |
|
131 // ----------------------------------------------------------------------------- |
|
132 TInt CCommonTestClass::CMPXSubscriptionIsEqualOperator(CStifItemParser& aItem) |
|
133 { |
|
134 FTRACE( FPrint( _L("CCommonTestClass::CMPXSubscription testing CMPXSubscription::operator==() begin") ) ); |
|
135 iLog->Log( _L("CCommonTestClass::CMPXSubscription testing CMPXSubscription::operator==() begin") ); |
|
136 TInt result = KErrNone; |
|
137 TBool IsEqual; |
|
138 |
|
139 TInt EqualTag; |
|
140 if( aItem.GetNextInt( EqualTag ) == KErrNone ) |
|
141 { |
|
142 if( EqualTag ) |
|
143 { |
|
144 CMPXSubscription* subscription = CMPXSubscription::NewL( *iMPXMediaArray ); |
|
145 IsEqual = iSubscription->operator==( *subscription ); |
|
146 } |
|
147 else |
|
148 { |
|
149 CMPXMediaArray* mediaArray = CMPXMediaArray::NewL(); |
|
150 CMPXSubscription* subscription = CMPXSubscription::NewL( *mediaArray ); |
|
151 |
|
152 CMPXSubscriptionItem* subscriptionItem = CMPXSubscriptionItem::NewL(); |
|
153 CleanupStack::PushL( subscriptionItem ); |
|
154 TRAP( result,iSubscription->AddItemL( *subscriptionItem ) ); |
|
155 //iSubscription->AddItemL( *subscriptionItem ); |
|
156 |
|
157 CMPXSubscriptionItem* subscriptionItem2 = CMPXSubscriptionItem::NewL(); |
|
158 CleanupStack::PushL( subscriptionItem2 ); |
|
159 TRAP( result,iSubscription->AddItemL( *subscriptionItem2 ) ); |
|
160 //iSubscription->AddItemL( *subscriptionItem2 ); |
|
161 CleanupStack::Pop( 2 ); |
|
162 |
|
163 IsEqual = iSubscription->operator==( *subscription ); |
|
164 } |
|
165 |
|
166 if( IsEqual ) |
|
167 { |
|
168 iLog->Log( _L("The 2 CMPXSubscription instances are equal.\r\n") ); |
|
169 } |
|
170 else |
|
171 { |
|
172 iLog->Log( _L("The 2 CMPXSubscription instances are not equal.\r\n"),result ); |
|
173 } |
|
174 } |
|
175 else |
|
176 { |
|
177 iLog->Log( _L("Bad test parameter is passed in, leave here.\r\n"),result ); |
|
178 result = KErrBadTestParameter; |
|
179 User::Leave( result ); |
|
180 } |
|
181 return result; |
|
182 } |
|
183 |
|
184 |