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 <hbsettingformitem.h>
|
|
27 |
#include "cptelephonypluginview.h"
|
|
28 |
|
|
29 |
|
|
30 |
class DummyPlugin : public CpPluginInterface
|
|
31 |
{
|
|
32 |
public:
|
|
33 |
DummyPlugin(){}
|
|
34 |
~DummyPlugin(){}
|
|
35 |
|
|
36 |
QList<CpSettingFormItemData*> createSettingFormItemData(
|
|
37 |
CpItemDataHelper &itemDataHelper) const
|
|
38 |
{
|
|
39 |
SMC_MOCK_METHOD1( QList<CpSettingFormItemData*>, CpItemDataHelper &, itemDataHelper )
|
|
40 |
}
|
|
41 |
};
|
|
42 |
|
|
43 |
/*!
|
|
44 |
UT_CpTelephonyPluginView::UT_CpTelephonyPluginView
|
|
45 |
*/
|
|
46 |
UT_CpTelephonyPluginView::UT_CpTelephonyPluginView()
|
|
47 |
: m_callspluginview(NULL)
|
|
48 |
{
|
|
49 |
|
|
50 |
}
|
|
51 |
|
|
52 |
/*!
|
|
53 |
UT_CpTelephonyPluginView::~UT_CpTelephonyPluginView
|
|
54 |
*/
|
|
55 |
UT_CpTelephonyPluginView::~UT_CpTelephonyPluginView()
|
|
56 |
{
|
|
57 |
delete m_callspluginview;
|
|
58 |
}
|
|
59 |
|
|
60 |
|
|
61 |
|
|
62 |
/*!
|
|
63 |
UT_CpTelephonyPluginView::init
|
|
64 |
*/
|
|
65 |
void UT_CpTelephonyPluginView::init()
|
|
66 |
{
|
|
67 |
initialize();
|
|
68 |
CpPluginInterface *nullPlugin=0;
|
|
69 |
expect("CpPluginLoader::loadCpPlugin").with(QString("cpcallsplugin")).returns(nullPlugin);
|
|
70 |
DummyPlugin *ret = new DummyPlugin;
|
|
71 |
|
|
72 |
//ret = new DummyPlugin;
|
|
73 |
QList<CpSettingFormItemData*> list;
|
|
74 |
list.append(new CpSettingFormItemData);
|
|
75 |
expect("CpPluginLoader::loadCpPlugin").with(QString("cpdivertplugin")).returns(ret); // cpnetworkplugin
|
|
76 |
expect("DummyPlugin::createSettingFormItemData").returns(list);
|
|
77 |
|
|
78 |
m_callspluginview = new CpTelephonyPluginView;
|
|
79 |
QVERIFY( verify() );
|
|
80 |
}
|
|
81 |
|
|
82 |
/*!
|
|
83 |
UT_CpTelephonyPluginView::cleanup
|
|
84 |
*/
|
|
85 |
void UT_CpTelephonyPluginView::cleanup()
|
|
86 |
{
|
|
87 |
reset();
|
|
88 |
|
|
89 |
delete m_callspluginview;
|
|
90 |
m_callspluginview = NULL;
|
|
91 |
}
|
|
92 |
|
|
93 |
/*!
|
|
94 |
UT_CpTelephonyPluginView::t_memleak
|
|
95 |
*/
|
|
96 |
void UT_CpTelephonyPluginView::t_memleak()
|
|
97 |
{
|
|
98 |
QList<CpSettingFormItemData*> list;
|
|
99 |
list.append(new CpSettingFormItemData);
|
|
100 |
DummyPlugin *ret = new DummyPlugin;
|
|
101 |
expect("CpPluginLoader::loadCpPlugin").with(QString("cpcallsplugin")).returns(ret);
|
|
102 |
expect("DummyPlugin::createSettingFormItemData").returns(list);
|
|
103 |
|
|
104 |
ret = new DummyPlugin;
|
|
105 |
expect("CpPluginLoader::loadCpPlugin").with(QString("cpdivertplugin")).returns(ret);
|
|
106 |
expect("DummyPlugin::createSettingFormItemData").returns(list);
|
|
107 |
|
|
108 |
|
|
109 |
CpTelephonyPluginView *tmp = new CpTelephonyPluginView;
|
|
110 |
QVERIFY( verify() );
|
|
111 |
delete tmp;
|
|
112 |
}
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
QTEST_MAIN_S60UI(UT_CpTelephonyPluginView)
|