|
1 /* |
|
2 * Copyright (c) 2008 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: CAlfPerfAppBaseTestCaseControl implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "alfperfappbasetestcasecontrol.h" |
|
20 #include "alfperfapp.hrh" |
|
21 |
|
22 #include <aknutils.h> |
|
23 #include <alf/alfenv.h> |
|
24 #include <alf/alfdisplay.h> |
|
25 #include <alf/alfcontrol.h> |
|
26 #include <alf/alfcontrolgroup.h> |
|
27 #include <alf/alfroster.h> |
|
28 #include <alf/alfcommand.h> |
|
29 #include <alf/alfevent.h> |
|
30 #include <alf/alftexturemanager.h> |
|
31 #include <alf/alfimagevisual.h> |
|
32 #include <alf/alfimageloaderutil.h> |
|
33 #include <alf/alfutil.h> |
|
34 #include <alf/alfgridlayout.h> |
|
35 #include <alf/alfcurvepathlayout.h> |
|
36 #include <alf/alfdecklayout.h> |
|
37 #include <alf/alfflowlayout.h> |
|
38 #include <alf/alfanchorlayout.h> |
|
39 |
|
40 #include <alfperfapp_imagetest.mbg> |
|
41 |
|
42 /** |
|
43 * Complete now command. |
|
44 */ |
|
45 const TInt KAlfPerfAppCmdCompleteNow = 0x5000; |
|
46 |
|
47 |
|
48 // ============================ MEMBER FUNCTIONS =============================== |
|
49 |
|
50 |
|
51 // Implementation of CAlfPerfAppBaseTestCaseControl: |
|
52 |
|
53 static void GetImageTestCasePrivatePath( TFileName& aPath ) |
|
54 { |
|
55 CEikonEnv::Static()->FsSession().PrivatePath( aPath ); |
|
56 |
|
57 ::CompleteWithAppPath( aPath ); |
|
58 } |
|
59 |
|
60 CAlfPerfAppBaseTestCaseControl::CAlfPerfAppBaseTestCaseControl() |
|
61 { |
|
62 } |
|
63 |
|
64 CAlfPerfAppBaseTestCaseControl::~CAlfPerfAppBaseTestCaseControl() |
|
65 { |
|
66 CompleteNow( KErrCancel ); |
|
67 } |
|
68 |
|
69 void CAlfPerfAppBaseTestCaseControl::ConstructL( |
|
70 CAlfEnv& aEnv, TInt aCaseId, const TRect& /*aVisibleArea*/ ) |
|
71 { |
|
72 iCaseId = aCaseId; |
|
73 CAlfControl::ConstructL( aEnv ); |
|
74 |
|
75 TFileName privatePath; |
|
76 GetImageTestCasePrivatePath( privatePath ); |
|
77 aEnv.TextureManager().SetImagePathL( privatePath ); |
|
78 } |
|
79 |
|
80 void CAlfPerfAppBaseTestCaseControl::StartExecuteL( TRequestStatus& aStatus ) |
|
81 { |
|
82 iStatus = &aStatus; |
|
83 *iStatus = KRequestPending; |
|
84 |
|
85 TRAPD( err, DoStartExecuteL() ); |
|
86 if ( err != KErrNone ) |
|
87 { |
|
88 iStatus = NULL; |
|
89 User::Leave( err ); |
|
90 } |
|
91 } |
|
92 |
|
93 void CAlfPerfAppBaseTestCaseControl::CancelExecution() |
|
94 { |
|
95 CompleteNow( KErrCancel ); |
|
96 } |
|
97 |
|
98 void CAlfPerfAppBaseTestCaseControl::DoStartExecuteL() |
|
99 { |
|
100 CompleteNow( KErrNone ); |
|
101 } |
|
102 |
|
103 void CAlfPerfAppBaseTestCaseControl::SetVisibleArea( |
|
104 const TRect& /*aVisibleArea*/ ) |
|
105 { |
|
106 } |
|
107 |
|
108 TBool CAlfPerfAppBaseTestCaseControl::OfferEventL( const TAlfEvent& aEvent ) |
|
109 { |
|
110 if ( aEvent.IsCustomEvent() && |
|
111 aEvent.CustomParameter() == KAlfPerfAppCmdCompleteNow ) |
|
112 { |
|
113 CompleteNow( KErrNone ); |
|
114 return ETrue; |
|
115 } |
|
116 |
|
117 return CAlfControl::OfferEventL( aEvent ); |
|
118 } |
|
119 |
|
120 void CAlfPerfAppBaseTestCaseControl::CompleteAfterL( TInt aDuration ) |
|
121 { |
|
122 // In order to use this service, base class StartExecuteL must |
|
123 // have been called. |
|
124 __ASSERT_ALWAYS( iStatus, User::Invariant() ); |
|
125 |
|
126 TAlfCustomEventCommand command( KAlfPerfAppCmdCompleteNow, this ); |
|
127 User::LeaveIfError( Env().Send( command, aDuration ) ); |
|
128 } |
|
129 |
|
130 void CAlfPerfAppBaseTestCaseControl::CompleteNow( TInt aErrorCode ) |
|
131 { |
|
132 if ( iStatus ) |
|
133 { |
|
134 User::RequestComplete( iStatus, aErrorCode ); |
|
135 iStatus = NULL; |
|
136 } |
|
137 } |
|
138 /* |
|
139 inline TInt CAlfPerfAppBaseTestCaseControl::CaseId() const |
|
140 { |
|
141 return iCaseId; |
|
142 } |
|
143 |
|
144 inline TBool CAlfPerfAppBaseTestCaseControl::IsExecutionOngoing() const |
|
145 { |
|
146 return ( iStatus != NULL ); |
|
147 } |
|
148 */ |