1 /* |
|
2 * Copyright (c) 2007 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: Dummy controller class for Cameraapp Unit Tests* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "CameraappTestBitmapManager.h" |
|
21 |
|
22 // EXTERNAL DATA STRUCTURES |
|
23 //extern ?external_data; |
|
24 |
|
25 // EXTERNAL FUNCTION PROTOTYPES |
|
26 //extern ?external_function( ?arg_type,?arg_type ); |
|
27 |
|
28 // CONSTANTS |
|
29 const TInt KMaxBitmaps = 3; |
|
30 |
|
31 // MACROS |
|
32 //#define ?macro ?macro_def |
|
33 |
|
34 // LOCAL CONSTANTS AND MACROS |
|
35 //const ?type ?constant_var = ?constant; |
|
36 //#define ?macro_name ?macro_def |
|
37 |
|
38 // MODULE DATA STRUCTURES |
|
39 //enum ?declaration |
|
40 //typedef ?declaration |
|
41 |
|
42 // LOCAL FUNCTION PROTOTYPES |
|
43 //?type ?function_name( ?arg_type, ?arg_type ); |
|
44 |
|
45 // FORWARD DECLARATIONS |
|
46 //class ?FORWARD_CLASSNAME; |
|
47 |
|
48 // ============================ MEMBER FUNCTIONS =============================== |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CCameraappTestBitmapManager::NewL |
|
52 // Two-phased constructor. |
|
53 // ----------------------------------------------------------------------------- |
|
54 // |
|
55 CCameraappTestBitmapManager* CCameraappTestBitmapManager::NewL() |
|
56 { |
|
57 CCameraappTestBitmapManager* self = new( ELeave ) CCameraappTestBitmapManager; |
|
58 CleanupStack::PushL( self ); |
|
59 self->ConstructL(); |
|
60 CleanupStack::Pop( self ); |
|
61 |
|
62 return self; |
|
63 } |
|
64 |
|
65 |
|
66 // Destructor |
|
67 CCameraappTestBitmapManager::~CCameraappTestBitmapManager() |
|
68 { |
|
69 iBitmaps.ResetAndDestroy(); |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // CCameraappTestBitmapManager::SnapshotImage |
|
74 // Get post-exposure snapshot bitmap, if available. |
|
75 // |
|
76 // Returns: pointer to post-exposure snapshot bitmap. Does not transfer ownership. |
|
77 // May be NULL if no image available. |
|
78 // |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 CFbsBitmap& CCameraappTestBitmapManager::Bitmap( TInt aBitmapIndex ) const |
|
82 { |
|
83 if ( aBitmapIndex < iBitmaps.Count() ) |
|
84 { |
|
85 return *( iBitmaps[aBitmapIndex] ); |
|
86 } |
|
87 else |
|
88 { |
|
89 return *( iBitmaps[iBitmaps.Count() - 1] ); |
|
90 } |
|
91 } |
|
92 |
|
93 CFbsBitmap& CCameraappTestBitmapManager::NextBitmap() |
|
94 { |
|
95 IncrementBitmapIndex(); |
|
96 return *(iBitmaps[iBitmapIndex]); |
|
97 } |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CCameraappTestBitmapManager::CCameraappTestBitmapManager |
|
101 // C++ default constructor can NOT contain any code, that |
|
102 // might leave. |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 CCameraappTestBitmapManager::CCameraappTestBitmapManager() |
|
106 : iBitmapIndex( -1 ) |
|
107 { |
|
108 } |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // CCameraappTestBitmapManager::ConstructL |
|
112 // Symbian 2nd phase constructor can leave. |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 void CCameraappTestBitmapManager::ConstructL() |
|
116 { |
|
117 // load test bitmaps |
|
118 _LIT( bitmapFile, "z:\\system\\apps\\cameraapp\\DummyViewFinder.mbm" ); |
|
119 |
|
120 for ( TInt i = 0 ; i < KMaxBitmaps; i++ ) |
|
121 { |
|
122 CFbsBitmap* bitmap = new( ELeave ) CFbsBitmap; |
|
123 CleanupStack::PushL( bitmap ); |
|
124 |
|
125 User::LeaveIfError( bitmap->Load( bitmapFile, i ) ); |
|
126 User::LeaveIfError( iBitmaps.Append( bitmap ) ); |
|
127 CleanupStack::Pop( bitmap ); |
|
128 } |
|
129 } |
|
130 |
|
131 void CCameraappTestBitmapManager::IncrementBitmapIndex() |
|
132 { |
|
133 iBitmapIndex = ++iBitmapIndex % iBitmaps.Count(); |
|
134 } |
|
135 |
|
136 // End of File |
|