controlpanel/tsrc/unit/ut_cpapi/src/ut_cpapi.cpp
changeset 21 851e19007849
parent 18 e3554c9069b6
child 23 7e4c5a2ff1a2
equal deleted inserted replaced
19:30540fccecae 21:851e19007849
    23 #include <QtAlgorithms>
    23 #include <QtAlgorithms>
    24 #include <HbView.h>
    24 #include <HbView.h>
    25 #include <hbdataform.h>
    25 #include <hbdataform.h>
    26 #include <hbdataformmodel.h>
    26 #include <hbdataformmodel.h>
    27 #include <hbdataformmodelitem.h>
    27 #include <hbdataformmodelitem.h>
       
    28 #include <hbdataformviewitem.h>
    28 #include <hbabstractviewitem.h>
    29 #include <hbabstractviewitem.h>
    29 #include <hbsettingformitem.h>
       
    30 #include <hbpushbutton.h>
    30 #include <hbpushbutton.h>
    31 //testing following classes
    31 //testing following classes
    32 
    32 
    33 #include "cpbasesettingview.h"
    33 #include "cpbasesettingview.h"
    34 #include "cpsettingformentryitemdata.h"
    34 #include "cpsettingformentryitemdata.h"
    46   mainWindow->show();
    46   mainWindow->show();
    47 }
    47 }
    48 
    48 
    49 void TestCpAPI::cleanupTestCase()
    49 void TestCpAPI::cleanupTestCase()
    50 {
    50 {
    51 	delete mainWindow;
    51 	//delete mainWindow;
    52 	mainWindow = 0;
    52 	//mainWindow = 0;
       
    53 	//if delete mainwindow, test app will be freezing
       
    54 	QCoreApplication::processEvents();
    53 }
    55 }
    54 void TestCpAPI::testCpBaseSettingView()
    56 void TestCpAPI::testCpBaseSettingView()
    55 {
    57 {
    56 	CpBaseSettingView * pview = new CpBaseSettingView(0);
    58 	CpBaseSettingView * pview = new CpBaseSettingView(0);
    57 	QVERIFY( pview != 0 );
    59 	QVERIFY( pview != 0 );
   125     HbDataFormModelItem *general = model->appendDataFormPage(QString("General"));
   127     HbDataFormModelItem *general = model->appendDataFormPage(QString("General"));
   126     CpItemDataHelper *phelper = new CpItemDataHelper();
   128     CpItemDataHelper *phelper = new CpItemDataHelper();
   127     phelper->addConnection( general, "hello",form,"hello");
   129     phelper->addConnection( general, "hello",form,"hello");
   128     phelper->removeConnection(general,"hello",form, "hello");
   130     phelper->removeConnection(general,"hello",form, "hello");
   129     phelper->bindToForm(form);
   131     phelper->bindToForm(form);
   130     HbSettingFormItem *pitem = new HbSettingFormItem();
   132     HbDataFormViewItem *pitem = new HbDataFormViewItem();
   131     phelper->addItemPrototype(pitem);
   133     phelper->addItemPrototype(pitem);
   132     delete phelper;
   134     delete phelper;
   133 }
   135 }
   134 void TestCpAPI::testCpPluginUtility()
   136 void TestCpAPI::testCpPluginUtility()
   135 {
   137 {
   136     HbDataForm* form = new HbDataForm();
   138     HbDataForm* form = new HbDataForm();
   137     QList<HbAbstractViewItem *> oldList = form->itemPrototypes();
   139     QList<HbAbstractViewItem *> oldList = form->itemPrototypes();
   138     CpPluginUtility::addCpItemPrototype(form);
   140     CpPluginUtility::addCpItemPrototype(form);
   139     QList<HbAbstractViewItem *> newList = form->itemPrototypes();
   141     QList<HbAbstractViewItem *> newList = form->itemPrototypes();
   140     QVERIFY( oldList.count() == newList.count()-1 );
   142     QVERIFY( oldList.count() < newList.count() );
   141 }
   143 }
   142 
   144 
   143 void TestCpAPI::testCpPluginLoader()
   145 void TestCpAPI::testCpPluginLoader()
   144 {
   146 {
   145     CpPluginInterface *plugin = CpPluginLoader::loadCpPlugin("non_existing_plugin.dll");
   147     CpPluginInterface *plugin = CpPluginLoader::loadCpPlugin("non_existing_plugin.dll");