author | William Roberts <williamr@symbian.org> |
Thu, 22 Jul 2010 16:33:21 +0100 | |
branch | GCC_SURGE |
changeset 51 | f39ed5e045e0 |
parent 22 | 6bb1b21d2484 |
parent 46 | bc5a64e5bc3c |
permissions | -rw-r--r-- |
37 | 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 "ut_cptelephonypluginview.h" |
|
19 |
#include "qtestmains60ui.h" |
|
20 |
#include <cpplugininterface.h> |
|
21 |
#include <cpitemdatahelper.h> |
|
22 |
#include <cpsettingformitemdata.h> |
|
23 |
#include <smcmockclassincludes.h> |
|
24 |
#include <hbdataform.h> |
|
25 |
#include <hbdataformmodel.h> |
|
26 |
#include "cptelephonypluginview.h" |
|
27 |
||
28 |
||
29 |
class DummyPlugin : public CpPluginInterface |
|
30 |
{ |
|
31 |
public: |
|
32 |
DummyPlugin(){} |
|
33 |
~DummyPlugin(){} |
|
34 |
||
35 |
QList<CpSettingFormItemData*> createSettingFormItemData( |
|
36 |
CpItemDataHelper &itemDataHelper) const |
|
37 |
{ |
|
38 |
SMC_MOCK_METHOD1( QList<CpSettingFormItemData*>, CpItemDataHelper &, itemDataHelper ) |
|
39 |
} |
|
40 |
}; |
|
41 |
||
42 |
/*! |
|
43 |
UT_CpTelephonyPluginView::UT_CpTelephonyPluginView |
|
44 |
*/ |
|
45 |
UT_CpTelephonyPluginView::UT_CpTelephonyPluginView() |
|
46 |
: m_callspluginview(NULL) |
|
47 |
{ |
|
48 |
||
49 |
} |
|
50 |
||
51 |
/*! |
|
52 |
UT_CpTelephonyPluginView::~UT_CpTelephonyPluginView |
|
53 |
*/ |
|
54 |
UT_CpTelephonyPluginView::~UT_CpTelephonyPluginView() |
|
55 |
{ |
|
56 |
delete m_callspluginview; |
|
57 |
} |
|
58 |
||
59 |
||
60 |
||
61 |
/*! |
|
62 |
UT_CpTelephonyPluginView::init |
|
63 |
*/ |
|
64 |
void UT_CpTelephonyPluginView::init() |
|
65 |
{ |
|
66 |
initialize(); |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
67 |
|
37 | 68 |
CpPluginInterface *nullPlugin=0; |
69 |
DummyPlugin *ret = new DummyPlugin; |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
70 |
|
37 | 71 |
QList<CpSettingFormItemData*> list; |
72 |
list.append(new CpSettingFormItemData); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
73 |
expect("CpPluginLoader::loadCpPluginInterface"). |
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
74 |
with(QString("cpcallsplugin")).returns(ret); |
37 | 75 |
expect("DummyPlugin::createSettingFormItemData").returns(list); |
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
76 |
expect("CpPluginLoader::loadCpPluginInterface"). |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
77 |
with(QString("cpdivertplugin")).returns(nullPlugin); |
37 | 78 |
|
79 |
m_callspluginview = new CpTelephonyPluginView; |
|
80 |
QVERIFY( verify() ); |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
81 |
|
37 | 82 |
} |
83 |
||
84 |
/*! |
|
85 |
UT_CpTelephonyPluginView::cleanup |
|
86 |
*/ |
|
87 |
void UT_CpTelephonyPluginView::cleanup() |
|
88 |
{ |
|
89 |
reset(); |
|
90 |
||
91 |
delete m_callspluginview; |
|
92 |
m_callspluginview = NULL; |
|
93 |
} |
|
94 |
||
95 |
/*! |
|
96 |
UT_CpTelephonyPluginView::t_memleak |
|
97 |
*/ |
|
98 |
void UT_CpTelephonyPluginView::t_memleak() |
|
99 |
{ |
|
100 |
QList<CpSettingFormItemData*> list; |
|
101 |
list.append(new CpSettingFormItemData); |
|
102 |
DummyPlugin *ret = new DummyPlugin; |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
103 |
expect("CpPluginLoader::loadCpPluginInterface"). |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
104 |
with(QString("cpcallsplugin")).returns(ret); |
37 | 105 |
expect("DummyPlugin::createSettingFormItemData").returns(list); |
106 |
||
107 |
ret = new DummyPlugin; |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
108 |
expect("CpPluginLoader::loadCpPluginInterface"). |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
109 |
with(QString("cpdivertplugin")).returns(ret); |
37 | 110 |
expect("DummyPlugin::createSettingFormItemData").returns(list); |
111 |
||
112 |
||
113 |
CpTelephonyPluginView *tmp = new CpTelephonyPluginView; |
|
114 |
QVERIFY( verify() ); |
|
115 |
delete tmp; |
|
116 |
} |
|
117 |
||
118 |
||
119 |
||
120 |
QTEST_MAIN_S60UI(UT_CpTelephonyPluginView) |