diff -r 92ab7f8d0eab -r 6bb1b21d2484 phoneapp/phoneuiview2/tsrc/ut_phoneuiqtview/unit_tests.cpp --- a/phoneapp/phoneuiview2/tsrc/ut_phoneuiqtview/unit_tests.cpp Fri Mar 19 09:28:42 2010 +0200 +++ b/phoneapp/phoneuiview2/tsrc/ut_phoneuiqtview/unit_tests.cpp Fri Apr 16 14:58:25 2010 +0300 @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -38,6 +39,8 @@ static const int KMINVOLUME = 0; static const int KVOLUMECOMMAND = 5; +bool m_qtimer_stop_called; + #define PHONE_QT_VIEW_TEST_MAIN(TestObject) \ int main(int argc, char *argv[]) \ @@ -86,6 +89,7 @@ void testShowDialpad(); void testDialpadText(); void testSetMenuActions(); + void testLongEndKeyPressEvent(); private: int createCallHeader(); @@ -96,7 +100,11 @@ }; - +void QTimer::stop() +{ + m_qtimer_stop_called = true; +} + TestPhoneUIQtView::TestPhoneUIQtView () { } @@ -107,22 +115,22 @@ void TestPhoneUIQtView::initTestCase () { + m_main_window = new HbMainWindow(); + m_view = new PhoneUIQtView(*m_main_window); } void TestPhoneUIQtView::cleanupTestCase () { + delete m_view; } void TestPhoneUIQtView::init () { - m_main_window = new HbMainWindow(); - m_view = new PhoneUIQtView(*m_main_window); + m_qtimer_stop_called = false; } void TestPhoneUIQtView::cleanup () { - delete m_view; - delete m_main_window; } void TestPhoneUIQtView::testAddBubbleCommand () @@ -169,6 +177,7 @@ m_view->showToolbar (); QCOMPARE (m_showCalled, true); } + void TestPhoneUIQtView::testAddToolbarActions () { m_actions.clear(); @@ -378,6 +387,14 @@ return bubble; } +void TestPhoneUIQtView::testLongEndKeyPressEvent() +{ + QSignalSpy spy(m_view, SIGNAL(endKeyLongPress())); + m_view->longEndKeyPressEvent(); + QVERIFY(m_qtimer_stop_called == true); + QCOMPARE(spy.count(), 1); +} + PHONE_QT_VIEW_TEST_MAIN(TestPhoneUIQtView) Q_DECLARE_METATYPE(QKeyEvent *) #include "unit_tests.moc"