|
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 |
|
18 #include <QList> |
|
19 #include <PsetContainer.h> |
|
20 #include "ut_psetwrapper.h" |
|
21 #include "psetwrapper.h" |
|
22 #include "testutilities.h" |
|
23 |
|
24 void SimulateLeaveL() |
|
25 { |
|
26 User::Leave(KErrGeneral); |
|
27 } |
|
28 |
|
29 /*! |
|
30 UT_PSetWrapper::UT_PSetWrapper |
|
31 */ |
|
32 UT_PSetWrapper::UT_PSetWrapper() |
|
33 : |
|
34 m_setWrapper(NULL), |
|
35 m_psetContainerMock(NULL) |
|
36 { |
|
37 } |
|
38 |
|
39 /*! |
|
40 UT_PSetWrapper::~UT_PSetWrapper |
|
41 */ |
|
42 UT_PSetWrapper::~UT_PSetWrapper() |
|
43 { |
|
44 delete m_setWrapper; |
|
45 delete m_psetContainerMock; |
|
46 } |
|
47 |
|
48 /*! |
|
49 UT_PSetWrapper::init |
|
50 */ |
|
51 void UT_PSetWrapper::init() |
|
52 { |
|
53 initialize(); |
|
54 |
|
55 m_setWrapper = new PSetWrapper(); |
|
56 m_psetContainerMock = new CPsetContainer(); |
|
57 } |
|
58 |
|
59 /*! |
|
60 UT_PSetWrapper::cleanup |
|
61 */ |
|
62 void UT_PSetWrapper::cleanup() |
|
63 { |
|
64 reset(); |
|
65 |
|
66 delete m_setWrapper; |
|
67 m_setWrapper = NULL; |
|
68 delete m_psetContainerMock; |
|
69 m_psetContainerMock = NULL; |
|
70 } |
|
71 |
|
72 /*! |
|
73 UT_PSetWrapper::t_construction |
|
74 */ |
|
75 void UT_PSetWrapper::t_construction() |
|
76 { |
|
77 if (qstrcmp(QTest::currentTestFunction(), "t_exceptionSafety") != 0) { |
|
78 expect("CPsetContainer::NewL"). |
|
79 willOnce(invokeWithoutArguments(SimulateLeaveL)); |
|
80 |
|
81 PSetWrapper *wrapper = NULL; |
|
82 EXPECT_EXCEPTION(wrapper = new PSetWrapper(NULL); |
|
83 ) |
|
84 delete wrapper; |
|
85 |
|
86 QVERIFY(verify()); |
|
87 } |
|
88 } |
|
89 |
|
90 /*! |
|
91 UT_PSetWrapper::t_cliWrapper |
|
92 */ |
|
93 void UT_PSetWrapper::t_cliWrapper() |
|
94 { |
|
95 PSetCliWrapper *wrapper = NULL; |
|
96 wrapper = &m_setWrapper->cliWrapper(); |
|
97 QVERIFY(wrapper == &m_setWrapper->cliWrapper()); |
|
98 } |
|
99 |
|
100 /*! |
|
101 UT_PSetWrapper::t_callWaitingWrapper |
|
102 */ |
|
103 void UT_PSetWrapper::t_callWaitingWrapper() |
|
104 { |
|
105 PSetCallWaitingWrapper *wrapper = NULL; |
|
106 wrapper = &m_setWrapper->callWaitingWrapper(); |
|
107 QVERIFY(wrapper == &m_setWrapper->callWaitingWrapper()); |
|
108 } |
|
109 |
|
110 /*! |
|
111 UT_PSetWrapper::t_callDivertingWrapper |
|
112 */ |
|
113 void UT_PSetWrapper::t_callDivertingWrapper() |
|
114 { |
|
115 PSetCallDivertingWrapper *wrapper = NULL; |
|
116 wrapper = &m_setWrapper->callDivertingWrapper(); |
|
117 QVERIFY(wrapper == &m_setWrapper->callDivertingWrapper()); |
|
118 } |
|
119 |
|
120 /*! |
|
121 UT_PSetWrapper::t_networkWrapper |
|
122 */ |
|
123 void UT_PSetWrapper::t_networkWrapper() |
|
124 { |
|
125 PSetNetworkWrapper *wrapper = NULL; |
|
126 wrapper = &m_setWrapper->networkWrapper(); |
|
127 QVERIFY(wrapper == &m_setWrapper->networkWrapper()); |
|
128 } |
|
129 |
|
130 /*! |
|
131 UT_PSetWrapper::t_callBarringWrapper |
|
132 */ |
|
133 void UT_PSetWrapper::t_callBarringWrapper() |
|
134 { |
|
135 PSetCallBarringWrapper *wrapper = NULL; |
|
136 wrapper = &m_setWrapper->callBarringWrapper(); |
|
137 QVERIFY(wrapper == &m_setWrapper->callBarringWrapper()); |
|
138 } |
|
139 |
|
140 /*! |
|
141 UT_PSetWrapper::t_exceptionSafety |
|
142 */ |
|
143 void UT_PSetWrapper::t_exceptionSafety() |
|
144 { |
|
145 cleanup(); |
|
146 |
|
147 OomTestExecuter::runAllTests(*this, "t_exceptionSafety"); |
|
148 } |
|
149 |
|
150 QTEST_MAIN_S60(UT_PSetWrapper) |