summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-09-02 19:45:17 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-09-02 19:45:17 (GMT)
commit9c726c2f2791f82de52f54ffc1f580630d10c61d (patch)
tree6b68e13e04f69fb91e4926b67884ee45a482cbe1 /tests/auto
parent4dd241331b9c906fe166184f7111f915ed8c00c0 (diff)
parent41a8c2280a3f454c457f811fc6428826b11b4754 (diff)
downloadQt-9c726c2f2791f82de52f54ffc1f580630d10c61d.zip
Qt-9c726c2f2791f82de52f54ffc1f580630d10c61d.tar.gz
Qt-9c726c2f2791f82de52f54ffc1f580630d10c61d.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public: Symbian: return better default font for SansSerif style hint Removing a left over #if 1..#endif construct Fixed a few warnings. Fixed a bug where passwords would not be committed when confirming.
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qinputcontext/tst_qinputcontext.cpp124
1 files changed, 124 insertions, 0 deletions
diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp
index 93813f9..52e655b 100644
--- a/tests/auto/qinputcontext/tst_qinputcontext.cpp
+++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp
@@ -49,6 +49,7 @@
#include <qradiobutton.h>
#include <qwindowsstyle.h>
#include <qdesktopwidget.h>
+#include <qpushbutton.h>
#ifdef Q_OS_SYMBIAN
#include <private/qt_s60_p.h>
@@ -80,6 +81,8 @@ private slots:
void focusProxy();
void symbianTestCoeFepInputContext_data();
void symbianTestCoeFepInputContext();
+ void symbianTestCoeFepAutoCommit_data();
+ void symbianTestCoeFepAutoCommit();
private:
bool m_phoneIsQwerty;
@@ -936,5 +939,126 @@ void tst_QInputContext::symbianTestCoeFepInputContext()
#endif
}
+void tst_QInputContext::symbianTestCoeFepAutoCommit_data()
+{
+#ifdef Q_OS_SYMBIAN
+ QTest::addColumn<Qt::InputMethodHints> ("inputMethodHints");
+ QTest::addColumn<QLineEdit::EchoMode> ("echoMode");
+ QTest::addColumn<QList<FepReplayEvent> > ("keyEvents");
+ QTest::addColumn<QString> ("finalString");
+
+ QList<FepReplayEvent> events;
+
+ events << FepReplayEvent('4', '4', 0, 0);
+ events << FepReplayEvent('4', '4', 0, 0);
+ events << FepReplayEvent('0', '0', 0, 0);
+ events << FepReplayEvent('9', '9', 0, 0);
+ events << FepReplayEvent('6', '6', 0, 0);
+ events << FepReplayEvent('8', '8', 0, 0);
+ QTest::newRow("Numbers")
+ << Qt::InputMethodHints(Qt::ImhDigitsOnly)
+ << QLineEdit::Normal
+ << events
+ << QString("440968");
+ QTest::newRow("Numbers and password")
+ << Qt::InputMethodHints(Qt::ImhDigitsOnly)
+ << QLineEdit::Password
+ << events
+ << QString("440968");
+ QTest::newRow("Multitap")
+ << Qt::InputMethodHints(Qt::ImhPreferLowercase | Qt::ImhNoPredictiveText)
+ << QLineEdit::Normal
+ << events
+ << QString("h wmt");
+ QTest::newRow("T9")
+ << Qt::InputMethodHints(Qt::ImhPreferLowercase)
+ << QLineEdit::Normal
+ << events
+ << QString("hi you");
+ QTest::newRow("Multitap with password")
+ << Qt::InputMethodHints(Qt::ImhPreferLowercase | Qt::ImhNoPredictiveText)
+ << QLineEdit::Password
+ << events
+ << QString("h wmt");
+ QTest::newRow("T9 with password")
+ << Qt::InputMethodHints(Qt::ImhPreferLowercase)
+ << QLineEdit::Password
+ << events
+ << QString("h wmt");
+#endif
+}
+
+void tst_QInputContext::symbianTestCoeFepAutoCommit()
+{
+#ifndef Q_OS_SYMBIAN
+ QSKIP("This is a Symbian-only test", SkipAll);
+#else
+ QCoeFepInputContext *ic = qobject_cast<QCoeFepInputContext *>(qApp->inputContext());
+ if (!ic) {
+ QSKIP("coefep is not the active input context; skipping test", SkipAll);
+ }
+
+ QFETCH(Qt::InputMethodHints, inputMethodHints);
+ QFETCH(QLineEdit::EchoMode, echoMode);
+ QFETCH(QList<FepReplayEvent>, keyEvents);
+ QFETCH(QString, finalString);
+
+ if (m_phoneIsQwerty) {
+ QSKIP("Skipping advanced input method tests on QWERTY phones", SkipSingle);
+ }
+
+ QWidget w;
+ QLayout *layout = new QVBoxLayout;
+ w.setLayout(layout);
+ QLineEdit *lineedit = new QLineEdit;
+ layout->addWidget(lineedit);
+ lineedit->setFocus();
+#ifdef QT_KEYPAD_NAVIGATION
+ lineedit->setEditFocus(true);
+#endif
+ QPushButton *pushButton = new QPushButton("Done");
+ layout->addWidget(pushButton);
+ QAction softkey("Done", &w);
+ softkey.setSoftKeyRole(QAction::PositiveSoftKey);
+ w.addAction(&softkey);
+ w.show();
+
+ lineedit->setInputMethodHints(inputMethodHints);
+ lineedit->setEchoMode(echoMode);
+
+ QTest::qWait(200);
+ foreach(FepReplayEvent event, keyEvents) {
+ event.replay(lineedit);
+ }
+ QApplication::processEvents();
+
+ QTest::mouseClick(pushButton, Qt::LeftButton);
+
+ QCOMPARE(lineedit->text(), finalString);
+ QVERIFY(ic->m_preeditString.isEmpty());
+
+#ifdef Q_WS_S60
+ lineedit->inputContext()->reset();
+ lineedit->clear();
+ lineedit->setFocus();
+#ifdef QT_KEYPAD_NAVIGATION
+ lineedit->setEditFocus(true);
+#endif
+
+ QTest::qWait(200);
+ foreach(FepReplayEvent event, keyEvents) {
+ event.replay(lineedit);
+ }
+ QApplication::processEvents();
+
+ FepReplayEvent(EStdKeyDevice0, EKeyDevice0, 0, 0).replay(lineedit); // Left softkey
+
+ QCOMPARE(lineedit->text(), finalString);
+ QVERIFY(ic->m_preeditString.isEmpty());
+
+#endif // Q_WS_S60
+#endif // Q_OS_SYMBIAN
+}
+
QTEST_MAIN(tst_QInputContext)
#include "tst_qinputcontext.moc"