diff -r 40a3f856b14d -r 41a7f70b3818 phonesettings/cpphonesettingsplugins/telephonyplugin/tsrc/ut_cptelephonypluginview/ut_cptelephonypluginview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonesettings/cpphonesettingsplugins/telephonyplugin/tsrc/ut_cptelephonypluginview/ut_cptelephonypluginview.cpp Tue Aug 31 15:14:29 2010 +0300 @@ -0,0 +1,120 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "ut_cptelephonypluginview.h" +#include "qtestmains60ui.h" +#include +#include +#include +#include +#include +#include +#include "cptelephonypluginview.h" + + +class DummyPlugin : public CpPluginInterface +{ +public: + DummyPlugin(){} + ~DummyPlugin(){} + + QList createSettingFormItemData( + CpItemDataHelper &itemDataHelper) const + { + SMC_MOCK_METHOD1( QList, CpItemDataHelper &, itemDataHelper ) + } +}; + +/*! + UT_CpTelephonyPluginView::UT_CpTelephonyPluginView + */ +UT_CpTelephonyPluginView::UT_CpTelephonyPluginView() + : m_callspluginview(NULL) +{ + +} + +/*! + UT_CpTelephonyPluginView::~UT_CpTelephonyPluginView + */ +UT_CpTelephonyPluginView::~UT_CpTelephonyPluginView() +{ + delete m_callspluginview; +} + + + +/*! + UT_CpTelephonyPluginView::init + */ +void UT_CpTelephonyPluginView::init() +{ + initialize(); + + CpPluginInterface *nullPlugin=0; + DummyPlugin *ret = new DummyPlugin; + + QList list; + list.append(new CpSettingFormItemData); + expect("CpPluginLoader::loadCpPluginInterface"). + with(QString("cpcallsplugin")).returns(ret); + expect("DummyPlugin::createSettingFormItemData").returns(list); + expect("CpPluginLoader::loadCpPluginInterface"). + with(QString("cpdivertplugin")).returns(nullPlugin); + + m_callspluginview = new CpTelephonyPluginView; + QVERIFY( verify() ); + +} + +/*! + UT_CpTelephonyPluginView::cleanup + */ +void UT_CpTelephonyPluginView::cleanup() +{ + reset(); + + delete m_callspluginview; + m_callspluginview = NULL; +} + +/*! + UT_CpTelephonyPluginView::t_memleak + */ +void UT_CpTelephonyPluginView::t_memleak() +{ + QList list; + list.append(new CpSettingFormItemData); + DummyPlugin *ret = new DummyPlugin; + expect("CpPluginLoader::loadCpPluginInterface"). + with(QString("cpcallsplugin")).returns(ret); + expect("DummyPlugin::createSettingFormItemData").returns(list); + + ret = new DummyPlugin; + expect("CpPluginLoader::loadCpPluginInterface"). + with(QString("cpdivertplugin")).returns(ret); + expect("DummyPlugin::createSettingFormItemData").returns(list); + + + CpTelephonyPluginView *tmp = new CpTelephonyPluginView; + QVERIFY( verify() ); + delete tmp; +} + + + +QTEST_MAIN_S60UI(UT_CpTelephonyPluginView)