|
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: Provides testing of PosLmCategorySerialization class methods |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <EPos_CPosLandmark.h> |
|
22 #include <EPos_CPosLandmarkDatabase.h> |
|
23 #include <EPos_CPosLmCategoryManager.h> |
|
24 #include <EPos_CPosLandmarkCategory.h> |
|
25 #include <LbsPosition.h> |
|
26 #include <EPos_PosLmCategorySerialization.h> |
|
27 #include "testposlmcategoryserialization.h" |
|
28 |
|
29 // ============================ MEMBER FUNCTIONS =============================== |
|
30 |
|
31 // ----------------------------------------------------------------------------- |
|
32 // TestPosLmkCatSerialization::TestPosLmkCatSerialization |
|
33 // |
|
34 // |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 TestPosLmkCatSerialization::TestPosLmkCatSerialization( CStifLogger* aLog ) |
|
38 { |
|
39 iLog = aLog; |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // TestPosLmkCatSerialization::PackCategory |
|
44 // |
|
45 // |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 TInt TestPosLmkCatSerialization::PackCategoryL( CStifItemParser& /*aItem*/ ) |
|
49 { |
|
50 // Create category |
|
51 CPosLandmarkCategory* category = CPosLandmarkCategory::NewL(); |
|
52 CleanupStack::PushL( category ); |
|
53 // Set name |
|
54 // Name |
|
55 _LIT( KCatName, "A Test Category" ); |
|
56 category->SetCategoryNameL( KCatName ); |
|
57 // Pack it |
|
58 HBufC8* catBuffer = PosLmCategorySerialization::PackL( *category ); |
|
59 CleanupStack::PopAndDestroy( category ); |
|
60 iLog->Log(_L("PackCategory succeeds")); |
|
61 return KErrNone; |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // TestPosLmkCatSerialization::UnpackCategory |
|
66 // |
|
67 // |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 TInt TestPosLmkCatSerialization::UnpackCategoryL( CStifItemParser& /*aItem*/ ) |
|
71 { |
|
72 // Create category |
|
73 CPosLandmarkCategory* category = CPosLandmarkCategory::NewL(); |
|
74 CleanupStack::PushL( category ); |
|
75 // Set name |
|
76 // Name |
|
77 _LIT( KCatName, "A Test Category" ); |
|
78 category->SetCategoryNameL( KCatName ); |
|
79 // Pack it |
|
80 HBufC8* catBuffer = PosLmCategorySerialization::PackL( *category ); |
|
81 // Unpack it |
|
82 CPosLandmarkCategory* unpackedCat = PosLmCategorySerialization::UnpackL( *catBuffer ); |
|
83 CleanupStack::PushL( unpackedCat ); |
|
84 // Check name |
|
85 CleanupStack::PopAndDestroy( 2, category ); |
|
86 iLog->Log(_L("PackCategory succeeds")); |
|
87 return KErrNone; |
|
88 } |