|
1 // Copyright (c) 2006-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 // Source file for the testing T_AppListFileUpdateStep test step. |
|
15 // TestAppInstall.cpp is a simple Hello World GUI application. |
|
16 // In test build of ..\..\apparc\group TestAppInstall.RSC is created. |
|
17 // T_SyncAppListAndFileUpdate installs the RSC file into C:\private\10003a3f\import\apps |
|
18 // and Tests that Modified time after installation of RSC is more than |
|
19 // Modified time before installation. |
|
20 // |
|
21 // |
|
22 |
|
23 /** |
|
24 @file |
|
25 @test |
|
26 @internalComponent - Internal Symbian test code |
|
27 */ |
|
28 |
|
29 #include <eikstart.h> |
|
30 |
|
31 |
|
32 #include "TestAppInstall.h" |
|
33 |
|
34 const TUid KUidTestAppInstall = { 0x102826DD }; |
|
35 |
|
36 |
|
37 // |
|
38 // |
|
39 // Implementation of the application class - CExampleApplication |
|
40 // |
|
41 // |
|
42 |
|
43 TUid CExampleApplication::AppDllUid() const |
|
44 { |
|
45 return KUidTestAppInstall; |
|
46 } |
|
47 |
|
48 CApaDocument* CExampleApplication::CreateDocumentL() |
|
49 { |
|
50 return new (ELeave) CExampleDocument(*this); |
|
51 } |
|
52 |
|
53 |
|
54 // |
|
55 // |
|
56 // Implementation of the appui class - CExampleAppUi |
|
57 // |
|
58 // |
|
59 |
|
60 void CExampleAppUi::ConstructL() |
|
61 { |
|
62 BaseConstructL(); |
|
63 iAppView = CExampleAppView::NewL(ClientRect()); |
|
64 } |
|
65 |
|
66 CExampleAppUi::~CExampleAppUi() |
|
67 { |
|
68 delete iAppView; |
|
69 } |
|
70 |
|
71 void CExampleAppUi::HandleCommandL(TInt aCommand) |
|
72 { |
|
73 switch (aCommand) |
|
74 { |
|
75 case EEikCmdExit: |
|
76 Exit(); |
|
77 break; |
|
78 } |
|
79 } |
|
80 |
|
81 |
|
82 |
|
83 // |
|
84 // |
|
85 // Implementation of the view class - CExampleAppView |
|
86 // |
|
87 // |
|
88 |
|
89 CExampleAppView::CExampleAppView() |
|
90 { |
|
91 } |
|
92 |
|
93 CExampleAppView* CExampleAppView::NewL(const TRect& aRect) |
|
94 { |
|
95 CExampleAppView* self = new(ELeave) CExampleAppView(); |
|
96 CleanupStack::PushL(self); |
|
97 self->ConstructL(aRect); |
|
98 CleanupStack::Pop(); |
|
99 return self; |
|
100 } |
|
101 |
|
102 CExampleAppView::~CExampleAppView() |
|
103 { |
|
104 delete iExampleText; |
|
105 } |
|
106 |
|
107 void CExampleAppView::ConstructL(const TRect& aRect) |
|
108 { |
|
109 // Fetch the text from the resource file. |
|
110 iExampleText = iEikonEnv->AllocReadResourceL(R_EXAMPLE_TEXT_TESTAPP); |
|
111 |
|
112 // Control is a window owning control |
|
113 CreateWindowL(); |
|
114 |
|
115 // Extent of the control. This is |
|
116 // the whole rectangle available to application. |
|
117 // The rectangle is passed to us from the application UI. |
|
118 SetRect(aRect); |
|
119 |
|
120 // At this stage, the control is ready to draw so |
|
121 // we tell the UI framework by activating it. |
|
122 ActivateL(); |
|
123 } |
|
124 |
|
125 |
|
126 void CExampleAppView::Draw(const TRect& /*aRect*/) const |
|
127 { |
|
128 CWindowGc& gc = SystemGc(); // Window graphics context |
|
129 TRect drawRect = Rect(); // Area in which we shall draw |
|
130 const CFont* fontUsed; // Font used for drawing text |
|
131 |
|
132 // Start with a clear screen |
|
133 gc.Clear(); |
|
134 |
|
135 // Draw an outline rectangle (the default pen and brush styles ensure this) slightly smaller than the drawing area. |
|
136 drawRect.Shrink(10,10); |
|
137 gc.DrawRect(drawRect); |
|
138 |
|
139 // Use the title font supplied by the UI |
|
140 fontUsed = iEikonEnv->TitleFont(); |
|
141 gc.UseFont(fontUsed); |
|
142 |
|
143 // Draw the text in the middle of the rectangle. |
|
144 TInt baselineOffset=(drawRect.Height() - fontUsed->HeightInPixels())/2; |
|
145 gc.DrawText(*iExampleText,drawRect,baselineOffset,CGraphicsContext::ECenter, 0); |
|
146 |
|
147 // Finished using the font |
|
148 gc.DiscardFont(); |
|
149 } |
|
150 |
|
151 |
|
152 |
|
153 // |
|
154 // |
|
155 // Implementation of the document class - CExampleDocument |
|
156 // |
|
157 // |
|
158 |
|
159 CExampleDocument::CExampleDocument(CEikApplication& aApp) |
|
160 : CEikDocument(aApp) |
|
161 { |
|
162 } |
|
163 |
|
164 CEikAppUi* CExampleDocument::CreateAppUiL() |
|
165 { |
|
166 return new(ELeave) CExampleAppUi; |
|
167 } |
|
168 |
|
169 |
|
170 LOCAL_C CApaApplication* NewApplication() |
|
171 { |
|
172 return new CExampleApplication; |
|
173 } |
|
174 |
|
175 GLDEF_C TInt E32Main() |
|
176 { |
|
177 return EikStart::RunApplication(NewApplication); |
|
178 } |
|
179 |