phonesettings/cpphonesettingsplugins/telephonyplugin/tsrc/ut_cptelephonypluginview/ut_cptelephonypluginview.cpp
branchGCC_SURGE
changeset 51 f39ed5e045e0
parent 22 6bb1b21d2484
parent 46 bc5a64e5bc3c
equal deleted inserted replaced
40:bab96b7ed1a4 51:f39ed5e045e0
    21 #include <cpitemdatahelper.h>
    21 #include <cpitemdatahelper.h>
    22 #include <cpsettingformitemdata.h>
    22 #include <cpsettingformitemdata.h>
    23 #include <smcmockclassincludes.h>
    23 #include <smcmockclassincludes.h>
    24 #include <hbdataform.h>
    24 #include <hbdataform.h>
    25 #include <hbdataformmodel.h>
    25 #include <hbdataformmodel.h>
    26 #include <hbsettingformitem.h>
       
    27 #include "cptelephonypluginview.h"
    26 #include "cptelephonypluginview.h"
    28 
    27 
    29 
    28 
    30 class DummyPlugin : public CpPluginInterface
    29 class DummyPlugin : public CpPluginInterface
    31 {
    30 {
    63   UT_CpTelephonyPluginView::init
    62   UT_CpTelephonyPluginView::init
    64  */
    63  */
    65 void UT_CpTelephonyPluginView::init()
    64 void UT_CpTelephonyPluginView::init()
    66 {
    65 {
    67     initialize();
    66     initialize();
       
    67 
    68     CpPluginInterface *nullPlugin=0;
    68     CpPluginInterface *nullPlugin=0;
    69     expect("CpPluginLoader::loadCpPlugin").with(QString("cpcallsplugin")).returns(nullPlugin);
       
    70     DummyPlugin *ret = new DummyPlugin;
    69     DummyPlugin *ret = new DummyPlugin;
    71     
    70 
    72     //ret = new DummyPlugin;
       
    73     QList<CpSettingFormItemData*> list;
    71     QList<CpSettingFormItemData*> list;
    74     list.append(new CpSettingFormItemData);
    72     list.append(new CpSettingFormItemData);
    75     expect("CpPluginLoader::loadCpPlugin").with(QString("cpdivertplugin")).returns(ret); // cpnetworkplugin
    73     expect("CpPluginLoader::loadCpPluginInterface").
       
    74             with(QString("cpcallsplugin")).returns(ret);
    76     expect("DummyPlugin::createSettingFormItemData").returns(list);
    75     expect("DummyPlugin::createSettingFormItemData").returns(list);
       
    76     expect("CpPluginLoader::loadCpPluginInterface").
       
    77             with(QString("cpdivertplugin")).returns(nullPlugin);
    77     
    78     
    78     m_callspluginview = new CpTelephonyPluginView;
    79     m_callspluginview = new CpTelephonyPluginView;
    79     QVERIFY( verify() );
    80     QVERIFY( verify() );
       
    81 
    80 }
    82 }
    81 
    83 
    82 /*!
    84 /*!
    83   UT_CpTelephonyPluginView::cleanup
    85   UT_CpTelephonyPluginView::cleanup
    84  */
    86  */
    96 void UT_CpTelephonyPluginView::t_memleak()
    98 void UT_CpTelephonyPluginView::t_memleak()
    97 {
    99 {
    98     QList<CpSettingFormItemData*> list;
   100     QList<CpSettingFormItemData*> list;
    99     list.append(new CpSettingFormItemData);
   101     list.append(new CpSettingFormItemData);
   100     DummyPlugin *ret = new DummyPlugin;
   102     DummyPlugin *ret = new DummyPlugin;
   101     expect("CpPluginLoader::loadCpPlugin").with(QString("cpcallsplugin")).returns(ret);
   103     expect("CpPluginLoader::loadCpPluginInterface").
       
   104             with(QString("cpcallsplugin")).returns(ret);
   102     expect("DummyPlugin::createSettingFormItemData").returns(list);
   105     expect("DummyPlugin::createSettingFormItemData").returns(list);
   103     
   106     
   104     ret = new DummyPlugin;
   107     ret = new DummyPlugin;
   105     expect("CpPluginLoader::loadCpPlugin").with(QString("cpdivertplugin")).returns(ret);
   108     expect("CpPluginLoader::loadCpPluginInterface").
       
   109             with(QString("cpdivertplugin")).returns(ret);
   106     expect("DummyPlugin::createSettingFormItemData").returns(list);
   110     expect("DummyPlugin::createSettingFormItemData").returns(list);
   107     
   111     
   108     
   112     
   109     CpTelephonyPluginView *tmp = new CpTelephonyPluginView;
   113     CpTelephonyPluginView *tmp = new CpTelephonyPluginView;
   110     QVERIFY( verify() );
   114     QVERIFY( verify() );