diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-09-28 16:03:54 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-09-28 16:03:54 (GMT) |
commit | e364e7c006d27c030c8d02d49fece5e6130ee84e (patch) | |
tree | 02b6c800e4418da636ae43dacce34c56ade6dd60 | |
parent | 8b533a7564c634e6e7228c5e02832d55513777b5 (diff) | |
parent | c4ef479906f073fa84999eb950f00e264ebd4e8e (diff) | |
download | Qt-e364e7c006d27c030c8d02d49fece5e6130ee84e.zip Qt-e364e7c006d27c030c8d02d49fece5e6130ee84e.tar.gz Qt-e364e7c006d27c030c8d02d49fece5e6130ee84e.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:
Fix QFontMetrics::lineWidth() for fonts with defined point size
Implemeting, exporting and autotesting QFont::lastResortFont()
Fixed compile error on non-Symbian platforms.
Fixed regression when typing in QTextControl based widgets on Symbian
Fixed incorrect snippet in BLD_INF_RULES documentation
Streamlined smart installer package creation
-rw-r--r-- | doc/src/development/qmake-manual.qdoc | 2 | ||||
-rw-r--r-- | doc/src/snippets/code/doc_src_qmake-manual.qdoc | 7 | ||||
-rw-r--r-- | mkspecs/features/symbian/sis_targets.prf | 4 | ||||
-rw-r--r-- | qmake/generators/symbian/symbiancommon.cpp | 13 | ||||
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 6 | ||||
-rw-r--r-- | src/gui/text/qfont_s60.cpp | 10 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase_s60.cpp | 8 | ||||
-rw-r--r-- | src/s60installs/bwins/QtGuiu.def | 1 | ||||
-rw-r--r-- | src/s60installs/eabi/QtGuiu.def | 1 | ||||
-rw-r--r-- | tests/auto/qfont/tst_qfont.cpp | 7 | ||||
-rw-r--r-- | tests/auto/qfontmetrics/tst_qfontmetrics.cpp | 18 | ||||
-rw-r--r-- | tests/auto/qinputcontext/tst_qinputcontext.cpp | 257 |
12 files changed, 273 insertions, 61 deletions
diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index 754b8ad..98e136f 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -1088,7 +1088,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 146 + \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 152 This will add the specified statements to the \c prj_exports section of the generated \c bld.inf file. diff --git a/doc/src/snippets/code/doc_src_qmake-manual.qdoc b/doc/src/snippets/code/doc_src_qmake-manual.qdoc index 4ac7d5e..8c35c3f 100644 --- a/doc/src/snippets/code/doc_src_qmake-manual.qdoc +++ b/doc/src/snippets/code/doc_src_qmake-manual.qdoc @@ -1002,3 +1002,10 @@ symbian { RSS_RULES.service_list += "uid = 0x12345678; datatype_list = \{\}; opaque_data = r_my_icon;" RSS_RULES.footer +="RESOURCE CAPTION_AND_ICON_INFO r_my_icon \{ icon_file =\"$$PWD/my_icon.svg\"; \}" //! [151] + +//! [152] +my_exports = \ + "foo.h /epoc32/include/mylib/foo.h" \ + "bar.h /epoc32/include/mylib/bar.h" +BLD_INF_RULES.prj_exports += my_exports +//! [152] diff --git a/mkspecs/features/symbian/sis_targets.prf b/mkspecs/features/symbian/sis_targets.prf index 800a04c..673127e 100644 --- a/mkspecs/features/symbian/sis_targets.prf +++ b/mkspecs/features/symbian/sis_targets.prf @@ -67,7 +67,7 @@ equals(GENERATE_SIS_TARGETS, true) { , \ $(MAKE) -f $(MAKEFILE) fail_sis_nopkg \ ) - installer_sis_target.depends = $${baseTarget}.sis + installer_sis_target.depends = sis ok_installer_sis_target.target = ok_installer_sis ok_installer_sis_target.commands = createpackage.bat $(QT_SIS_OPTIONS) $${baseTarget}_installer.pkg - \ @@ -154,7 +154,7 @@ equals(GENERATE_SIS_TARGETS, true) { installer_sis_target.target = installer_sis installer_sis_target.commands = $$QMAKE_CREATEPACKAGE $(QT_SIS_OPTIONS) $${baseTarget}_installer.pkg - \ $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE) - installer_sis_target.depends = $${sis_destdir}/$${baseTarget}.sis + installer_sis_target.depends = sis !isEmpty(sis_destdir):!equals(sis_destdir, "."):!equals(sis_destdir, "./") { sis_target.commands += && $$QMAKE_MOVE $${baseTarget}.sis $$sis_destdir diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index a60ae07..9af3fe4 100644 --- a/qmake/generators/symbian/symbiancommon.cpp +++ b/qmake/generators/symbian/symbiancommon.cpp @@ -178,8 +178,15 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB QTextStream ts(&stubPkgFile); QString installerSisHeader = project->values("DEPLOYMENT.installer_header").join("\n"); - if (installerSisHeader.isEmpty()) - installerSisHeader = "0xA000D7CE"; // Use default self-signable UID if not defined + if (installerSisHeader.isEmpty()) { + // Use correct protected UID for publishing if application UID is in protected range, + // otherwise use self-signable test UID. + QRegExp protUidMatcher("0[xX][0-7].*"); + if (protUidMatcher.exactMatch(uid3)) + installerSisHeader = QLatin1String("0x2002CCCF"); + else + installerSisHeader = QLatin1String("0xA000D7CE"); // Use default self-signable UID + } QString wrapperStreamBuffer; QTextStream tw(&wrapperStreamBuffer); @@ -531,7 +538,7 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB // Wrapped files deployment QString currentPath = qmake_getpwd(); QString sisName = QString("%1.sis").arg(fixedTarget); - twf << "\"" << currentPath << "/" << sisName << "\" - \"c:\\private\\2002CCCE\\import\\" << sisName << "\"" << endl; + twf << "\"" << currentPath << "/" << sisName << "\" - \"!:\\private\\2002CCCE\\import\\" << sisName << "\"" << endl; QString bootStrapPath = QLibraryInfo::location(QLibraryInfo::PrefixPath); bootStrapPath.append("/smartinstaller.sis"); diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index af86d77..4a1b9b9 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -238,8 +238,10 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) } QString widgetText = focusWidget()->inputMethodQuery(Qt::ImSurroundingText).toString(); - int maxLength = focusWidget()->inputMethodQuery(Qt::ImMaximumTextLength).toInt(); - if (!keyEvent->text().isEmpty() && widgetText.size() + m_preeditString.size() >= maxLength) { + bool validLength; + int maxLength = focusWidget()->inputMethodQuery(Qt::ImMaximumTextLength).toInt(&validLength); + if (!keyEvent->text().isEmpty() && validLength + && widgetText.size() + m_preeditString.size() >= maxLength) { // Don't send key events with string content if the widget is "full". return true; } diff --git a/src/gui/text/qfont_s60.cpp b/src/gui/text/qfont_s60.cpp index d39f30a..80a3bb2 100644 --- a/src/gui/text/qfont_s60.cpp +++ b/src/gui/text/qfont_s60.cpp @@ -57,6 +57,16 @@ Q_GLOBAL_STATIC_WITH_INITIALIZER(QStringList, fontFamiliesOnFontServer, { }); #endif // QT_NO_FREETYPE +QString QFont::lastResortFont() const +{ + // Symbian's font Api does not distinguish between font and family. + // Therefore we try to get a "Family" first, then fall back to "Sans". + static QString font = lastResortFamily(); + if (font.isEmpty()) + font = QLatin1String("Sans"); + return font; +} + QString QFont::lastResortFamily() const { #ifdef QT_NO_FREETYPE diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index ec252cd..5e168c6 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -453,7 +453,7 @@ QFontDef cleanedFontDef(const QFontDef &req) return result; } -QFontEngine *QFontDatabase::findFont(int script, const QFontPrivate *, const QFontDef &req) +QFontEngine *QFontDatabase::findFont(int script, const QFontPrivate *d, const QFontDef &req) { const QFontCache::Key key(cleanedFontDef(req), script); @@ -498,8 +498,14 @@ QFontEngine *QFontDatabase::findFont(int script, const QFontPrivate *, const QFo static_cast<const QSymbianFontDatabaseExtrasImplementation*>(db->symbianExtras); const QSymbianTypeFaceExtras *typeFaceExtras = dbExtras->extras(fontFamily, request.weight > QFont::Normal, request.style != QFont::StyleNormal); + + // We need a valid pixelSize, e.g. for lineThickness() + if (request.pixelSize < 0) + request.pixelSize = request.pointSize * d->dpi / 72; + fe = new QFontEngineS60(request, typeFaceExtras); #else // QT_NO_FREETYPE + Q_UNUSED(d) QFontEngine::FaceId faceId; const QtFontFamily * const reqQtFontFamily = db->family(fontFamily); faceId.filename = reqQtFontFamily->fontFilename; diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 7805dae..9a61523 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12892,4 +12892,5 @@ EXPORTS ?setTimeout@QTapAndHoldGesture@@SAXH@Z @ 12891 NONAME ; void QTapAndHoldGesture::setTimeout(int) ?qmljsDebugArguments@QApplicationPrivate@@2VQString@@A @ 12892 NONAME ; class QString QApplicationPrivate::qmljsDebugArguments ?effectiveBoundingRect@QGraphicsItemPrivate@@QBE?AVQRectF@@PAVQGraphicsItem@@@Z @ 12893 NONAME ; class QRectF QGraphicsItemPrivate::effectiveBoundingRect(class QGraphicsItem *) const + ?lastResortFont@QFont@@QBE?AVQString@@XZ @ 12894 NONAME ; class QString QFont::lastResortFont(void) const diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 4442d33..634b7af 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12097,4 +12097,5 @@ EXPORTS _ZN19QApplicationPrivate19qmljsDebugArgumentsE @ 12096 NONAME DATA 4 _ZN20QGraphicsItemPrivate26childrenBoundingRectHelperEP10QTransformP6QRectFP13QGraphicsItem @ 12097 NONAME _ZNK20QGraphicsItemPrivate21effectiveBoundingRectEP13QGraphicsItem @ 12098 NONAME + _ZNK5QFont14lastResortFontEv @ 12099 NONAME diff --git a/tests/auto/qfont/tst_qfont.cpp b/tests/auto/qfont/tst_qfont.cpp index 7bda665..296ed68 100644 --- a/tests/auto/qfont/tst_qfont.cpp +++ b/tests/auto/qfont/tst_qfont.cpp @@ -76,6 +76,7 @@ private slots: void italicOblique(); void insertAndRemoveSubstitutions(); void serializeSpacing(); + void lastResortFont(); }; // Testing get/set functions @@ -593,5 +594,11 @@ void tst_QFont::serializeSpacing() QCOMPARE(font3.wordSpacing(), 50.); } +void tst_QFont::lastResortFont() +{ + QFont font; + QVERIFY(!font.lastResortFont().isEmpty()); +} + QTEST_MAIN(tst_QFont) #include "tst_qfont.moc" diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp index a22d624..41121a5 100644 --- a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp +++ b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp @@ -74,6 +74,7 @@ private slots: void bypassShaping(); void elidedMultiLength(); void elidedMultiLengthF(); + void lineWidth(); }; tst_QFontMetrics::tst_QFontMetrics() @@ -266,5 +267,22 @@ void tst_QFontMetrics::elidedMultiLengthF() elidedMultiLength_helper<QFontMetricsF>(); } +void tst_QFontMetrics::lineWidth() +{ + // QTBUG-13009, QTBUG-13011 + QFont smallFont; + smallFont.setPointSize(8); + smallFont.setWeight(QFont::Light); + const QFontMetrics smallFontMetrics(smallFont); + + QFont bigFont; + bigFont.setPointSize(40); + bigFont.setWeight(QFont::Black); + const QFontMetrics bigFontMetrics(bigFont); + + QVERIFY(smallFontMetrics.lineWidth() >= 1); + QVERIFY(smallFontMetrics.lineWidth() < bigFontMetrics.lineWidth()); +} + QTEST_MAIN(tst_QFontMetrics) #include "tst_qfontmetrics.moc" diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp index d077bc1..7811a53 100644 --- a/tests/auto/qinputcontext/tst_qinputcontext.cpp +++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp @@ -67,6 +67,8 @@ public: tst_QInputContext() : m_phoneIsQwerty(false) {} virtual ~tst_QInputContext() {} + template <class WidgetType> void symbianTestCoeFepInputContext_addData(); + public slots: void initTestCase(); void cleanupTestCase() {} @@ -467,6 +469,7 @@ void tst_QInputContext::focusProxy() void tst_QInputContext::symbianTestCoeFepInputContext_data() { #ifdef Q_OS_SYMBIAN + QTest::addColumn<QWidget *> ("editwidget"); QTest::addColumn<bool> ("inputMethodEnabled"); QTest::addColumn<Qt::InputMethodHints> ("inputMethodHints"); QTest::addColumn<int> ("maxLength"); // Zero for no limit @@ -474,7 +477,24 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() QTest::addColumn<QList<FepReplayEvent> > ("keyEvents"); QTest::addColumn<QString> ("finalString"); QTest::addColumn<QString> ("preeditString"); + + symbianTestCoeFepInputContext_addData<QLineEdit>(); + symbianTestCoeFepInputContext_addData<QPlainTextEdit>(); + symbianTestCoeFepInputContext_addData<QTextEdit>(); +#endif +} + +Q_DECLARE_METATYPE(QWidget *) +Q_DECLARE_METATYPE(QLineEdit *) +Q_DECLARE_METATYPE(QPlainTextEdit *) +Q_DECLARE_METATYPE(QTextEdit *) + +template <class WidgetType> +void tst_QInputContext::symbianTestCoeFepInputContext_addData() +{ +#ifdef Q_OS_SYMBIAN QList<FepReplayEvent> events; + QWidget *editwidget; events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); @@ -487,7 +507,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); events << FepReplayEvent('2', '2', 0, 0); events << FepReplayEvent('1', '1', 0, 0); - QTest::newRow("Numbers (no FEP)") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers (no FEP)").toLocal8Bit()) + << editwidget << false << Qt::InputMethodHints(Qt::ImhNone) << 0 @@ -495,7 +518,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("521") << QString(""); - QTest::newRow("Numbers and password mode (no FEP)") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers and password mode (no FEP)").toLocal8Bit()) + << editwidget << false << Qt::InputMethodHints(Qt::ImhNone) << 0 @@ -503,7 +529,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("521") << QString(""); - QTest::newRow("Numbers") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhDigitsOnly) << 0 @@ -511,7 +540,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("521") << QString(""); - QTest::newRow("Numbers max length (no FEP)") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers max length (no FEP)").toLocal8Bit()) + << editwidget << false << Qt::InputMethodHints(Qt::ImhNone) << 2 @@ -519,7 +551,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("21") << QString(""); - QTest::newRow("Numbers max length") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers max length").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhDigitsOnly) << 2 @@ -534,7 +569,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() events << FepReplayEvent(EEventKey, '5', '5', 0, 1); events << FepReplayEvent(EEventKey, '5', '5', 0, 1); events << FepReplayEvent(EEventKeyUp, '5', 0, 0, 0); - QTest::newRow("Numbers and autorepeat (no FEP)") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers and autorepeat (no FEP)").toLocal8Bit()) + << editwidget << false << Qt::InputMethodHints(Qt::ImhNone) << 0 @@ -552,7 +590,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() events << FepReplayEvent('5', '5', 0, 0); events << FepReplayEvent('5', '5', 0, 0); events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); - QTest::newRow("Multitap") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText) << 0 @@ -560,7 +601,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("Adh") << QString(""); - QTest::newRow("Multitap with no auto uppercase") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with no auto uppercase").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhNoAutoUppercase) << 0 @@ -568,7 +612,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("adh") << QString(""); - QTest::newRow("Multitap with uppercase") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with uppercase").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferUppercase) << 0 @@ -576,7 +623,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("ADH") << QString(""); - QTest::newRow("Multitap with lowercase") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with lowercase").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase) << 0 @@ -584,7 +634,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("adh") << QString(""); - QTest::newRow("Multitap with forced uppercase") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with forced uppercase").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhUppercaseOnly) << 0 @@ -592,7 +645,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("ADH") << QString(""); - QTest::newRow("Multitap with forced lowercase") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with forced lowercase").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhLowercaseOnly) << 0 @@ -611,7 +667,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() events << FepReplayEvent('5', '5', 0, 0); events << FepReplayEvent('5', '5', 0, 0); events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); - QTest::newRow("Multitap with mode switch") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with mode switch").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText) << 0 @@ -626,7 +685,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() events << FepReplayEvent('8', '8', 0, 0); events << FepReplayEvent('9', '9', 0, 0); events << FepReplayEvent('9', '9', 0, 0); - QTest::newRow("Multitap with unfinished text") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with unfinished text").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText) << 0 @@ -635,7 +697,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << QString("Qt") << QString("x"); events << FepReplayEvent(2000); - QTest::newRow("Multitap with committed text") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with committed text").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText) << 0 @@ -671,7 +736,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() events << FepReplayEvent('8', '8', 0, 0); events << FepReplayEvent(2000); events << FepReplayEvent(EStdKeyDevice3, EKeyDevice3, 0, 0); // Select key - QTest::newRow("Multitap and numbers") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap and numbers").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText) << 0 @@ -679,7 +747,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("H778wmt") << QString(""); - QTest::newRow("T9 and numbers") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 and numbers").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhPreferLowercase) << 0 @@ -692,7 +763,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() events << FepReplayEvent('4', '4', 0, 0); events << FepReplayEvent('4', '4', 0, 0); events << FepReplayEvent(EStdKeyDevice3, EKeyDevice3, 0, 0); // Select key - QTest::newRow("T9") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhPreferLowercase) << 0 @@ -700,7 +774,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("hi") << QString(""); - QTest::newRow("T9 with uppercase") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with uppercase").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhPreferUppercase) << 0 @@ -708,7 +785,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("HI") << QString(""); - QTest::newRow("T9 with forced lowercase") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with forced lowercase").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhLowercaseOnly) << 0 @@ -716,7 +796,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("hi") << QString(""); - QTest::newRow("T9 with forced uppercase") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with forced uppercase").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhUppercaseOnly) << 0 @@ -724,7 +807,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("HI") << QString(""); - QTest::newRow("T9 with maxlength") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with maxlength").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhLowercaseOnly) << 1 @@ -746,7 +832,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() events << FepReplayEvent(EStdKeyRightArrow, EKeyRightArrow, 0, 0); events << FepReplayEvent('8', '8', 0, 0); events << FepReplayEvent('8', '8', 0, 0); - QTest::newRow("T9 with movement and unfinished text") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with movement and unfinished text").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhPreferLowercase) << 0 @@ -754,7 +843,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("you hi") << QString("tv"); - QTest::newRow("T9 with movement, password and unfinished text") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with movement, password and unfinished text").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhPreferLowercase) << 0 @@ -762,7 +854,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("wmt h") << QString("u"); - QTest::newRow("T9 with movement, maxlength, password and unfinished text") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with movement, maxlength, password and unfinished text").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhPreferLowercase) << 2 @@ -770,7 +865,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("wh") << QString(""); - QTest::newRow("T9 with movement, maxlength and unfinished text") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with movement, maxlength and unfinished text").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhPreferLowercase) << 2 @@ -778,7 +876,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("hi") << QString(""); - QTest::newRow("Multitap with movement and unfinished text") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with movement and unfinished text").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase) << 0 @@ -786,7 +887,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("wmt h") << QString("u"); - QTest::newRow("Multitap with movement, maxlength and unfinished text") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with movement, maxlength and unfinished text").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase) << 2 @@ -794,7 +898,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("wh") << QString(""); - QTest::newRow("Numbers with movement") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers with movement").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhDigitsOnly) << 0 @@ -802,7 +909,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("96804488") << QString(""); - QTest::newRow("Numbers with movement and maxlength") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers with movement and maxlength").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhDigitsOnly) << 2 @@ -810,7 +920,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("44") << QString(""); - QTest::newRow("Numbers with movement, password and unfinished text") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers with movement, password and unfinished text").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhDigitsOnly) << 0 @@ -818,7 +931,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("9680448") << QString("8"); - QTest::newRow("Numbers with movement, maxlength, password and unfinished text") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers with movement, maxlength, password and unfinished text").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhDigitsOnly) << 2 @@ -827,7 +943,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << QString("44") << QString(""); events << FepReplayEvent(EStdKeyRightArrow, EKeyRightArrow, 0, 0); - QTest::newRow("T9 with movement") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with movement").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhPreferLowercase) << 0 @@ -835,7 +954,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("you htvi") << QString(""); - QTest::newRow("T9 with movement and password") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with movement and password").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhPreferLowercase) << 0 @@ -843,7 +965,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("wmt hu") << QString(""); - QTest::newRow("T9 with movement, maxlength and password") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with movement, maxlength and password").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhPreferLowercase) << 2 @@ -851,7 +976,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("wh") << QString(""); - QTest::newRow("Multitap with movement") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with movement").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase) << 0 @@ -859,7 +987,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("wmt hu") << QString(""); - QTest::newRow("Multitap with movement and maxlength") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with movement and maxlength").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase) << 2 @@ -867,7 +998,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("wh") << QString(""); - QTest::newRow("Numbers with movement and password") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers with movement and password").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhDigitsOnly) << 0 @@ -875,7 +1009,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("96804488") << QString(""); - QTest::newRow("Numbers with movement, maxlength and password") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers with movement, maxlength and password").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhDigitsOnly) << 2 @@ -888,7 +1025,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() // Test that the symbol key successfully does nothing when in number-only mode. events << FepReplayEvent(EEventKeyDown, EStdKeyLeftFunc, 0, 0, 0); events << FepReplayEvent(EEventKeyUp, EStdKeyLeftFunc, 0, 0, 0); - QTest::newRow("Dead symbols key") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Dead symbols key").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhDigitsOnly) << 0 @@ -896,7 +1036,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("") << QString(""); - QTest::newRow("Dead symbols key and password") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Dead symbols key and password").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhDigitsOnly) << 0 @@ -918,6 +1061,7 @@ void tst_QInputContext::symbianTestCoeFepInputContext() QSKIP("coefep is not the active input context; skipping test", SkipAll); } + QFETCH(QWidget *, editwidget); QFETCH(bool, inputMethodEnabled); QFETCH(Qt::InputMethodHints, inputMethodHints); QFETCH(int, maxLength); @@ -933,30 +1077,39 @@ void tst_QInputContext::symbianTestCoeFepInputContext() QWidget w; QLayout *layout = new QVBoxLayout; w.setLayout(layout); - QLineEdit *lineedit = new QLineEdit; - layout->addWidget(lineedit); - lineedit->setFocus(); + + layout->addWidget(editwidget); + editwidget->setFocus(); #ifdef QT_KEYPAD_NAVIGATION - lineedit->setEditFocus(true); + editwidget->setEditFocus(true); #endif w.show(); - lineedit->setAttribute(Qt::WA_InputMethodEnabled, inputMethodEnabled); - lineedit->setInputMethodHints(inputMethodHints); - if (maxLength > 0) - lineedit->setMaxLength(maxLength); - lineedit->setEchoMode(echoMode); + editwidget->setAttribute(Qt::WA_InputMethodEnabled, inputMethodEnabled); + editwidget->setInputMethodHints(inputMethodHints); + QLineEdit *lineedit = qobject_cast<QLineEdit *>(editwidget); + if (lineedit) { + if (maxLength > 0) + lineedit->setMaxLength(maxLength); + lineedit->setEchoMode(echoMode); + } else if (maxLength > 0 || echoMode != QLineEdit::Normal) { + // Only QLineEdits support these features so don't attempt any tests using those + // on other widgets. + return; + } QTest::qWait(200); foreach(FepReplayEvent event, keyEvents) { - event.replay(lineedit); + event.replay(editwidget); } QApplication::processEvents(); - QCOMPARE(lineedit->text(), finalString); + QCOMPARE(editwidget->inputMethodQuery(Qt::ImSurroundingText).toString(), finalString); QCOMPARE(ic->m_preeditString, preeditString); + + delete editwidget; #endif } |