phoneapp/phoneuiview2/tsrc/ut_phoneuiqtview/unit_tests.cpp
changeset 30 ebdbd102c78a
parent 27 2f8f8080a020
child 51 f39ed5e045e0
equal deleted inserted replaced
27:2f8f8080a020 30:ebdbd102c78a
    41 static const int KMAXVOLUME = 10;
    41 static const int KMAXVOLUME = 10;
    42 static const int KMINVOLUME = 0;
    42 static const int KMINVOLUME = 0;
    43 static const int KVOLUMECOMMAND = 5;
    43 static const int KVOLUMECOMMAND = 5;
    44 
    44 
    45 bool m_qtimer_stop_called;
    45 bool m_qtimer_stop_called;
    46 
    46 QString m_networkName;
    47 
    47 
    48 #define PHONE_QT_VIEW_TEST_MAIN(TestObject) \
    48 #define PHONE_QT_VIEW_TEST_MAIN(TestObject) \
    49 int main(int argc, char *argv[]) \
    49 int main(int argc, char *argv[]) \
    50 { \
    50 { \
    51     HbApplication app(argc, argv); \
    51     HbApplication app(argc, argv); \
    91     void testBackButtonClicked();
    91     void testBackButtonClicked();
    92     void testShowDialpad();
    92     void testShowDialpad();
    93     void testDialpadText();
    93     void testDialpadText();
    94     void testSetMenuActions();
    94     void testSetMenuActions();
    95     void testLongEndKeyPressEventOutsideTelephony();
    95     void testLongEndKeyPressEventOutsideTelephony();
       
    96     void testNetworkNameChanged();
    96 
    97 
    97 private:
    98 private:
    98     int createCallHeader();
    99     int createCallHeader();
    99 
   100 
   100 private:
   101 private:
   116 {
   117 {
   117 }
   118 }
   118 
   119 
   119 void TestPhoneUIQtView::initTestCase ()
   120 void TestPhoneUIQtView::initTestCase ()
   120 {	
   121 {	
   121     m_main_window = new HbMainWindow(); 
   122     m_main_window = new HbMainWindow();
   122     m_view = new PhoneUIQtView(*m_main_window);
   123     m_view = new PhoneUIQtView(*m_main_window);
       
   124     QCOMPARE(m_networkName, QString("Unit test network"));
   123 }
   125 }
   124 
   126 
   125 void TestPhoneUIQtView::cleanupTestCase ()
   127 void TestPhoneUIQtView::cleanupTestCase ()
   126 {
   128 {
   127     delete m_view;
   129     delete m_view;
   399 
   401 
   400     QVERIFY(returnValue == true);
   402     QVERIFY(returnValue == true);
   401     QCOMPARE(spy.count(), 1);*/
   403     QCOMPARE(spy.count(), 1);*/
   402 }
   404 }
   403 
   405 
       
   406 void TestPhoneUIQtView::testNetworkNameChanged()
       
   407 {
       
   408     // Title is changed only for GmsMode
       
   409     m_view->networkNameChanged(QSystemNetworkInfo::GsmMode, QString("test"));
       
   410     QCOMPARE(m_networkName, QString("test"));
       
   411 
       
   412     // Other modes shouldn't affect the title
       
   413     m_view->networkNameChanged(QSystemNetworkInfo::CdmaMode, QString("another operator"));
       
   414     QCOMPARE(m_networkName, QString("test"));
       
   415 }
       
   416 
       
   417 void HbView::setTitle (const QString &title)
       
   418 {
       
   419     m_networkName = title;
       
   420 }
       
   421 
   404 PHONE_QT_VIEW_TEST_MAIN(TestPhoneUIQtView)
   422 PHONE_QT_VIEW_TEST_MAIN(TestPhoneUIQtView)
   405 Q_DECLARE_METATYPE(QKeyEvent *)
   423 Q_DECLARE_METATYPE(QKeyEvent *)
   406 #include "unit_tests.moc"
   424 #include "unit_tests.moc"