From bc8409b9d04be54d98ca97d96c32473039f58a80 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 27 Sep 2010 15:39:18 +0300 Subject: Streamlined smart installer package creation Previously manual editing of the pkg file was required to publish application using smart installer. Now a proper app_installer.pkg will be created as long as application has protected range UID. Also changed "make installer_sis" to always generate the application sis as publishing process supports signing both application and its smart installer wrapper packages in single step. Task-number: QTBUG-13991 Reviewed-by: axis --- mkspecs/features/symbian/sis_targets.prf | 4 ++-- qmake/generators/symbian/symbiancommon.cpp | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) 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"); -- cgit v0.12 From 1e4f736c2825c8c36ec74719efbc723f6374d072 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 27 Sep 2010 16:15:40 +0300 Subject: Fixed incorrect snippet in BLD_INF_RULES documentation Task-number: QTBUG-13988 Reviewed-by: TrustMe --- doc/src/development/qmake-manual.qdoc | 2 +- doc/src/snippets/code/doc_src_qmake-manual.qdoc | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index f4becf8..9f569e9 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] -- cgit v0.12 From 3bb3af84bef3c0472ca8ed0d5c6bb3c82320956d Mon Sep 17 00:00:00 2001 From: axis Date: Mon, 27 Sep 2010 13:37:14 +0200 Subject: Fixed regression when typing in QTextControl based widgets on Symbian The bug was that when querying for the maximum text length, the case where an invalid QVariant was returned (which is allowed) was not handled properly. This would lead to input being blocked by the input context when it shouldn't. RevBy: Sami Merila --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 6 +- tests/auto/qinputcontext/tst_qinputcontext.cpp | 257 +++++++++++++++++++----- 2 files changed, 208 insertions(+), 55 deletions(-) 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/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp index d077bc1..700a49b 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 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 ("editwidget"); QTest::addColumn ("inputMethodEnabled"); QTest::addColumn ("inputMethodHints"); QTest::addColumn ("maxLength"); // Zero for no limit @@ -474,7 +477,23 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() QTest::addColumn > ("keyEvents"); QTest::addColumn ("finalString"); QTest::addColumn ("preeditString"); + + symbianTestCoeFepInputContext_addData(); + symbianTestCoeFepInputContext_addData(); + symbianTestCoeFepInputContext_addData(); +#endif +} + +Q_DECLARE_METATYPE(QWidget *) +Q_DECLARE_METATYPE(QLineEdit *) +Q_DECLARE_METATYPE(QPlainTextEdit *) +Q_DECLARE_METATYPE(QTextEdit *) + +template +void tst_QInputContext::symbianTestCoeFepInputContext_addData() +{ QList events; + QWidget *editwidget; events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); @@ -487,7 +506,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 +517,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 +528,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 +539,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 +550,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 +568,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 +589,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 +600,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 +611,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 +622,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 +633,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 +644,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 +666,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 +684,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 +696,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 +735,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 +746,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 +762,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 +773,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 +784,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 +795,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 +806,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 +831,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 +842,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 +853,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 +864,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 +875,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 +886,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 +897,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 +908,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 +919,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 +930,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 +942,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 +953,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 +964,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 +975,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 +986,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 +997,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 +1008,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 +1024,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 +1035,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 @@ -905,7 +1047,6 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << QString("") << QString(""); events.clear(); -#endif } void tst_QInputContext::symbianTestCoeFepInputContext() @@ -918,6 +1059,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 +1075,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(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 } -- cgit v0.12 From 3e3ce984b54a0b199bf5d4f5e3dcb0a9d5b5bd79 Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 28 Sep 2010 08:21:13 +0200 Subject: Fixed compile error on non-Symbian platforms. --- tests/auto/qinputcontext/tst_qinputcontext.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp index 700a49b..7811a53 100644 --- a/tests/auto/qinputcontext/tst_qinputcontext.cpp +++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp @@ -492,6 +492,7 @@ Q_DECLARE_METATYPE(QTextEdit *) template void tst_QInputContext::symbianTestCoeFepInputContext_addData() { +#ifdef Q_OS_SYMBIAN QList events; QWidget *editwidget; @@ -1047,6 +1048,7 @@ void tst_QInputContext::symbianTestCoeFepInputContext_addData() << QString("") << QString(""); events.clear(); +#endif } void tst_QInputContext::symbianTestCoeFepInputContext() -- cgit v0.12 From 1341477e03dae2f9bc5ddb25beeb2ba3cd23358f Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 28 Sep 2010 15:05:03 +0200 Subject: Implemeting, exporting and autotesting QFont::lastResortFont() An implementation of QFont::lastResortFont() is still(!) missing in Qt 4.7.0. I only became aware of QTBUG-6921, lately. This patch... 1) implements QFont::lastResortFont() in qfont_s60.cpp by first trying to get the lastResortFamily() and then falling back to a hardcoded font. 2) updates the .def files with one additional entry 3) adds an autotest which verifies that lastResortFamily() does return a non-empty string. In the firt place, that autotest makes sure that lastResortFamily() is implemented and exported, so that something like this issue will not go unnoticed in the next Qt port. Task-number: QTBUG-6921 Reviewed-by: Eskil --- src/gui/text/qfont_s60.cpp | 10 ++++++++++ src/s60installs/bwins/QtGuiu.def | 1 + src/s60installs/eabi/QtGuiu.def | 1 + tests/auto/qfont/tst_qfont.cpp | 7 +++++++ 4 files changed, 19 insertions(+) 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/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" -- cgit v0.12 From c4ef479906f073fa84999eb950f00e264ebd4e8e Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 28 Sep 2010 16:57:20 +0200 Subject: Fix QFontMetrics::lineWidth() for fonts with defined point size QFontMetrics::lineWidth() and ::underlinePos() return value 1 regardless of the font size if the size was defined in points (instead of pixels). (On Symbian) QFontMetrics::lineWidth() calls QFontEngine::lineThickness() which uses its fontDef.pixelSize in order to come up with a suitable line width. If the QFont size was defined in points, Qt needs to make sure that fontDef.pixelSize is set accordingly. This patch adds the code to make sure that QFontEngine::fontDef always has a valid pixel size. tst_QFontMetrics::lineWidth() was added, wich failed before and passes after this patch. Task-Number: QTBUG-13009 Autotest: Passes Reviewed-By: Eskil --- src/gui/text/qfontdatabase_s60.cpp | 8 +++++++- tests/auto/qfontmetrics/tst_qfontmetrics.cpp | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) 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(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/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(); } +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" -- cgit v0.12 From 8bb62d3194a4de863b941c1f3716c66296d3eb5a Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 29 Sep 2010 13:32:27 +1000 Subject: Fixed failure of benchlibcallgrind selftest on some platforms. This test may be sensitive to the particular toolchain and valgrind versions on the test machine. We'll work around that. --- tests/auto/selftests/tst_selftests.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp index 0818b4c..4ee2996 100644 --- a/tests/auto/selftests/tst_selftests.cpp +++ b/tests/auto/selftests/tst_selftests.cpp @@ -339,12 +339,22 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QString const& logger, Q const QByteArray err(proc.readAllStandardError()); - /* Some platforms decides to output a message for uncaught exceptions. For instance, - * this is what windows platforms says: - * "This application has requested the Runtime to terminate it in an unusual way. - * Please contact the application's support team for more information." */ - if(subdir != QLatin1String("exceptionthrow") && subdir != QLatin1String("fetchbogus") - && subdir != QLatin1String("xunit")) + /* + Some tests may output unpredictable strings to stderr, which we'll ignore. + + For instance, uncaught exceptions on Windows might say (depending on Windows + version and JIT debugger settings): + "This application has requested the Runtime to terminate it in an unusual way. + Please contact the application's support team for more information." + + Also, tests which use valgrind may generate warnings if the toolchain is + newer than the valgrind version, such that valgrind can't understand the + debug information on the binary. + */ + if (subdir != QLatin1String("exceptionthrow") + && subdir != QLatin1String("fetchbogus") + && subdir != QLatin1String("xunit") + && subdir != QLatin1String("benchlibcallgrind")) QVERIFY2(err.isEmpty(), err.constData()); QList res = splitLines(out); -- cgit v0.12 From 6d980ae8985e3856ab87c4d0aaada3bcdc5fa1e5 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 29 Sep 2010 08:12:34 +0200 Subject: Skip tst_QFont::lastResortFont() for Q_WS_QWS QFont::lastResortFont() may abort with qFatal() on QWS if absolutely no font is found. Just as ducumented. This happens on our CI machines which run QWS autotests. --- tests/auto/qfont/tst_qfont.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/auto/qfont/tst_qfont.cpp b/tests/auto/qfont/tst_qfont.cpp index 296ed68..e498ebc 100644 --- a/tests/auto/qfont/tst_qfont.cpp +++ b/tests/auto/qfont/tst_qfont.cpp @@ -596,6 +596,11 @@ void tst_QFont::serializeSpacing() void tst_QFont::lastResortFont() { +#ifdef Q_WS_QWS + QSKIP("QFont::lastResortFont() may abort with qFatal() on QWS", SkipAll); + // ...if absolutely no font is found. Just as ducumented for QFont::lastResortFont(). + // This happens on our CI machines which run QWS autotests. +#endif QFont font; QVERIFY(!font.lastResortFont().isEmpty()); } -- cgit v0.12