phoneapp/phoneuiview2/tsrc/ut_phoneuiqtview/unit_tests.cpp
changeset 30 ebdbd102c78a
parent 27 2f8f8080a020
child 51 f39ed5e045e0
--- a/phoneapp/phoneuiview2/tsrc/ut_phoneuiqtview/unit_tests.cpp	Mon May 03 12:31:11 2010 +0300
+++ b/phoneapp/phoneuiview2/tsrc/ut_phoneuiqtview/unit_tests.cpp	Fri May 14 15:51:57 2010 +0300
@@ -43,7 +43,7 @@
 static const int KVOLUMECOMMAND = 5;
 
 bool m_qtimer_stop_called;
-
+QString m_networkName;
 
 #define PHONE_QT_VIEW_TEST_MAIN(TestObject) \
 int main(int argc, char *argv[]) \
@@ -93,6 +93,7 @@
     void testDialpadText();
     void testSetMenuActions();
     void testLongEndKeyPressEventOutsideTelephony();
+    void testNetworkNameChanged();
 
 private:
     int createCallHeader();
@@ -118,8 +119,9 @@
 
 void TestPhoneUIQtView::initTestCase ()
 {	
-    m_main_window = new HbMainWindow(); 
+    m_main_window = new HbMainWindow();
     m_view = new PhoneUIQtView(*m_main_window);
+    QCOMPARE(m_networkName, QString("Unit test network"));
 }
 
 void TestPhoneUIQtView::cleanupTestCase ()
@@ -401,6 +403,22 @@
     QCOMPARE(spy.count(), 1);*/
 }
 
+void TestPhoneUIQtView::testNetworkNameChanged()
+{
+    // Title is changed only for GmsMode
+    m_view->networkNameChanged(QSystemNetworkInfo::GsmMode, QString("test"));
+    QCOMPARE(m_networkName, QString("test"));
+
+    // Other modes shouldn't affect the title
+    m_view->networkNameChanged(QSystemNetworkInfo::CdmaMode, QString("another operator"));
+    QCOMPARE(m_networkName, QString("test"));
+}
+
+void HbView::setTitle (const QString &title)
+{
+    m_networkName = title;
+}
+
 PHONE_QT_VIEW_TEST_MAIN(TestPhoneUIQtView)
 Q_DECLARE_METATYPE(QKeyEvent *)
 #include "unit_tests.moc"