|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 #include <QTest> |
|
18 #include "cxeerror.h" |
|
19 #include "e32err.h" |
|
20 #include "cxeerrormappingsymbian.h" |
|
21 #include "unittest_cxeerrormappersymbian.h" |
|
22 |
|
23 // Enums |
|
24 |
|
25 |
|
26 UnitTestCxeErrorMapperSymbian::UnitTestCxeErrorMapperSymbian() |
|
27 { |
|
28 } |
|
29 |
|
30 UnitTestCxeErrorMapperSymbian::~UnitTestCxeErrorMapperSymbian() |
|
31 { |
|
32 } |
|
33 |
|
34 // Run before each individual test case |
|
35 void UnitTestCxeErrorMapperSymbian::init() |
|
36 { |
|
37 } |
|
38 |
|
39 // Run after each individual test case |
|
40 void UnitTestCxeErrorMapperSymbian::cleanup() |
|
41 { |
|
42 } |
|
43 |
|
44 void UnitTestCxeErrorMapperSymbian::testSymbianErr2CxeErrorId() |
|
45 { |
|
46 int symbianError = -10000; |
|
47 CxeError::Id result; |
|
48 |
|
49 // case 0: check default value |
|
50 result = CxeErrorHandlingSymbian::map(symbianError); |
|
51 QVERIFY(result == CxeError::General); |
|
52 |
|
53 // case 0: check with unknown value |
|
54 result = CxeErrorHandlingSymbian::map(100); |
|
55 QVERIFY(result == CxeError::General); |
|
56 |
|
57 // case 1: try with valid error code |
|
58 // KrrNone should be mapped to CxeError::None. |
|
59 symbianError = KErrNone; |
|
60 result = CxeErrorHandlingSymbian::map(symbianError); |
|
61 QVERIFY(result == CxeError::None); |
|
62 |
|
63 symbianError = KErrNotReady; |
|
64 result = CxeErrorHandlingSymbian::map(symbianError); |
|
65 QVERIFY(result == CxeError::NotReady); |
|
66 |
|
67 // case 2: try with invalid error code |
|
68 symbianError = KErrTotalLossOfPrecision; |
|
69 result = CxeErrorHandlingSymbian::map(symbianError); |
|
70 QVERIFY(result == CxeError::General); |
|
71 |
|
72 } |
|
73 |
|
74 |
|
75 // main() function non-GUI testing |
|
76 QTEST_APPLESS_MAIN(UnitTestCxeErrorMapperSymbian) |
|
77 ; |