From d714c0576cc9fa30537c390003203d79c8ab46d8 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Mon, 22 Jul 2013 13:22:29 +0200 Subject: Add changes-5.1.1 file Change-Id: I9062104d41ad4a4af352dc6366f550c09b3d8ebd Reviewed-by: Friedemann Kleint Reviewed-by: Alan Alpert --- dist/changes-5.1.1 | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 dist/changes-5.1.1 diff --git a/dist/changes-5.1.1 b/dist/changes-5.1.1 new file mode 100644 index 00000000..bb5e218a --- /dev/null +++ b/dist/changes-5.1.1 @@ -0,0 +1,26 @@ +Qt 5.1.1 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.1.0. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + + http://qt-project.org/doc/qt-5.1/ + +The Qt version 5.1 series is binary compatible with the 5.0.x series. +Applications compiled for 5.0 will continue to run with 5.1. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + + http://bugreports.qt-project.org/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + + +**************************************************************************** +* General * +**************************************************************************** + + - [QTBUG-31576] Fix regression from Qt 4 for deep group properties + - [QTBUG-32332] Use GET method for redirect in QDeclarativeXMLHttpRequest. -- cgit v1.2.3 From 08e621d3f7cbcf37b3f3d42fb06fa065bd6046bf Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Tue, 23 Jul 2013 12:03:34 +0200 Subject: Bump MODULE_VERSION to 5.1.2 Change-Id: I36783bb7f976375cbc9b64a371889a8784350110 Reviewed-by: Oswald Buddenhagen --- .qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.qmake.conf b/.qmake.conf index a7e09bff..89914d20 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,4 +1,4 @@ load(qt_build_config) CONFIG += qt_example_installs -MODULE_VERSION = 5.1.1 +MODULE_VERSION = 5.1.2 -- cgit v1.2.3 From 019066a7153c6eb99caf58bac61fe5a5b7f76c67 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 24 Jul 2013 10:41:56 +0200 Subject: Stabilize and fix tst_qdeclarativetextinput on Windows. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce a scoped pointer for the views to ensure cleanup after failing tests. Clear text in maxLength(). Move calls to QDeclarativeView::setFocus() below activation for it to set the "active" focus item correctly. Add message to obtain more information about failing tests. Task-number: QTBUG-32538 Change-Id: Id65afbdfb0f9fd70846958fcb28fdd0fe1bd70f7 Reviewed-by: Jan Arve Sæther --- .../tst_qdeclarativetextinput.cpp | 121 +++++++++++---------- 1 file changed, 62 insertions(+), 59 deletions(-) diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 7065c569..54b9f892 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -82,6 +82,33 @@ void sendPreeditText(const QString &text, int cursor) QApplication::sendEvent(qApp->focusObject(), &event); } +static inline QByteArray msgNotGreaterThan(int n1, int n2) +{ + return QByteArray::number(n1) + QByteArrayLiteral(" is not greater than ") + QByteArray::number(n2); +} + +static inline QByteArray msgNotLessThan(int n1, int n2) +{ + return QByteArray::number(n1) + QByteArrayLiteral(" is not less than ") + QByteArray::number(n2); +} + +static inline QByteArray msgNotEqual(int n1, int n2) +{ + return QByteArray::number(n1) + QByteArrayLiteral(" is not equal to ") + QByteArray::number(n2); +} + +static inline QByteArray msgNotNotEqual(int n1, int n2) +{ + return QByteArray::number(n1) + QByteArrayLiteral(" is equal to ") + QByteArray::number(n2); +} + +// A QScopedPointer which provides operator QDeclarativeView *, removing the +// need to write canvas.data() where a QDeclarativeView * is required. +class DeclarativeViewScopedPointer : public QScopedPointer { +public: + explicit inline DeclarativeViewScopedPointer(QDeclarativeView *v = 0) : QScopedPointer(v) {} + inline operator QDeclarativeView *() const { return data(); } +}; class tst_qdeclarativetextinput : public QObject @@ -953,7 +980,7 @@ void tst_qdeclarativetextinput::mouseSelection() QFETCH(QString, qmlfile); QFETCH(bool, expectSelection); - QDeclarativeView *canvas = createView(qmlfile); + DeclarativeViewScopedPointer canvas(createView(qmlfile)); canvas->show(); QApplication::setActiveWindow(canvas); @@ -984,8 +1011,6 @@ void tst_qdeclarativetextinput::mouseSelection() QTest::mouseClick(canvas->viewport(), Qt::LeftButton, Qt::NoModifier, canvas->mapFromScene(QPoint(x1,y))); QTest::mouseClick(canvas->viewport(), Qt::LeftButton, Qt::ShiftModifier, canvas->mapFromScene(QPoint(x2,y))); QCOMPARE(textInputObject->selectedText(), str); - - delete canvas; } void tst_qdeclarativetextinput::deferEnableSelectByMouse_data() @@ -1001,7 +1026,7 @@ void tst_qdeclarativetextinput::deferEnableSelectByMouse() // Verify text isn't selected if selectByMouse is enabled after the mouse button has been pressed. QFETCH(QString, qmlfile); - QDeclarativeView *canvas = createView(qmlfile); + DeclarativeViewScopedPointer canvas(createView(qmlfile)); canvas->show(); QApplication::setActiveWindow(canvas); @@ -1024,8 +1049,6 @@ void tst_qdeclarativetextinput::deferEnableSelectByMouse() QApplication::sendEvent(canvas->viewport(), &mv); QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x2,y))); QVERIFY(textInputObject->selectedText().isEmpty()); - - delete canvas; } void tst_qdeclarativetextinput::deferDisableSelectByMouse_data() @@ -1041,7 +1064,7 @@ void tst_qdeclarativetextinput::deferDisableSelectByMouse() // Verify text isn't selected if selectByMouse is enabled after the mouse button has been pressed. QFETCH(QString, qmlfile); - QDeclarativeView *canvas = createView(qmlfile); + DeclarativeViewScopedPointer canvas(createView(qmlfile)); canvas->show(); QApplication::setActiveWindow(canvas); @@ -1064,15 +1087,13 @@ void tst_qdeclarativetextinput::deferDisableSelectByMouse() QApplication::sendEvent(canvas->viewport(), &mv); QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x2,y))); QVERIFY(textInputObject->selectedText().length() > 3); - - delete canvas; } void tst_qdeclarativetextinput::dragMouseSelection() { QString qmlfile = SRCDIR "/data/mouseselection_true.qml"; - QDeclarativeView *canvas = createView(qmlfile); + DeclarativeViewScopedPointer canvas(createView(qmlfile)); canvas->show(); QApplication::setActiveWindow(canvas); @@ -1110,7 +1131,6 @@ void tst_qdeclarativetextinput::dragMouseSelection() QVERIFY(str2.length() > 3); QVERIFY(str1 != str2); // Verify the second press and drag is a new selection and doesn't not the first moved. - delete canvas; } void tst_qdeclarativetextinput::mouseSelectionMode_data() @@ -1131,7 +1151,7 @@ void tst_qdeclarativetextinput::mouseSelectionMode() QString text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - QDeclarativeView *canvas = createView(qmlfile); + DeclarativeViewScopedPointer canvas(createView(qmlfile)); canvas->show(); QApplication::setActiveWindow(canvas); @@ -1158,8 +1178,6 @@ void tst_qdeclarativetextinput::mouseSelectionMode() QVERIFY(str.length() > 3); QVERIFY(str != text); } - - delete canvas; } void tst_qdeclarativetextinput::horizontalAlignment_data() @@ -1177,7 +1195,7 @@ void tst_qdeclarativetextinput::horizontalAlignment() QFETCH(int, hAlign); QFETCH(QString, expectfile); - QDeclarativeView *canvas = createView(SRCDIR "/data/horizontalAlignment.qml"); + DeclarativeViewScopedPointer canvas(createView(SRCDIR "/data/horizontalAlignment.qml")); canvas->show(); QApplication::setActiveWindow(canvas); @@ -1198,13 +1216,11 @@ void tst_qdeclarativetextinput::horizontalAlignment() QImage expect(expectfile); QCOMPARE(actual,expect); - - delete canvas; } void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft() { - QDeclarativeView *canvas = createView(SRCDIR "/data/horizontalAlignment_RightToLeft.qml"); + DeclarativeViewScopedPointer canvas(createView(SRCDIR "/data/horizontalAlignment_RightToLeft.qml")); QDeclarativeTextInput *textInput = canvas->rootObject()->findChild("text"); QVERIFY(textInput != 0); canvas->show(); @@ -1303,7 +1319,7 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft() QVERIFY(-textInputPrivate->hscroll > canvas->width()/2); #endif - delete canvas; + canvas.reset(); #ifndef Q_OS_MAC // QTBUG-18040 // alignment of TextInput with no text set to it @@ -1319,15 +1335,16 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft() void tst_qdeclarativetextinput::positionAt() { - QDeclarativeView *canvas = createView(SRCDIR "/data/positionAt.qml"); + DeclarativeViewScopedPointer canvas(createView(SRCDIR "/data/positionAt.qml")); QVERIFY(canvas->rootObject() != 0); canvas->show(); - canvas->setFocus(); QApplication::setActiveWindow(canvas); QVERIFY(QTest::qWaitForWindowActive(canvas)); + canvas->setFocus(); QDeclarativeTextInput *textinputObject = qobject_cast(canvas->rootObject()); QVERIFY(textinputObject != 0); + QVERIFY(textinputObject->hasFocus()); // Check autoscrolled... QFontMetrics fm(textinputObject->font()); @@ -1371,18 +1388,17 @@ void tst_qdeclarativetextinput::positionAt() // Verify positioning returns to normal after the preedit text. QCOMPARE(textinputObject->positionAt(x1), 1); QCOMPARE(textinputObject->positionToRectangle(1).x(), x1); - - delete canvas; } void tst_qdeclarativetextinput::maxLength() { - QDeclarativeView *canvas = createView(SRCDIR "/data/maxLength.qml"); + DeclarativeViewScopedPointer canvas(createView(SRCDIR "/data/maxLength.qml")); + QVERIFY(canvas->rootObject() != 0); canvas->show(); - canvas->setFocus(); QApplication::setActiveWindow(canvas); QVERIFY(QTest::qWaitForWindowActive(canvas)); + canvas->setFocus(); QDeclarativeTextInput *textinputObject = qobject_cast(canvas->rootObject()); QVERIFY(textinputObject != 0); @@ -1394,7 +1410,7 @@ void tst_qdeclarativetextinput::maxLength() QVERIFY(textinputObject->text().length() <= 10); } - textinputObject->setText(""); + textinputObject->setText(QString()); QTRY_VERIFY(textinputObject->hasActiveFocus() == true); for(int i=0; i<20; i++){ QCOMPARE(textinputObject->text().length(), qMin(i,10)); @@ -1402,17 +1418,17 @@ void tst_qdeclarativetextinput::maxLength() QTest::keyPress(canvas, Qt::Key_A); QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); } - - delete canvas; } void tst_qdeclarativetextinput::masks() { //Not a comprehensive test of the possible masks, that's done elsewhere (QLineEdit) //QString componentStr = "import QtQuick 1.0\nTextInput { inputMask: 'HHHHhhhh'; }"; - QDeclarativeView *canvas = createView(SRCDIR "/data/masks.qml"); + DeclarativeViewScopedPointer canvas(createView(SRCDIR "/data/masks.qml")); canvas->show(); - canvas->setFocus(); + QApplication::setActiveWindow(canvas); + QVERIFY(QTest::qWaitForWindowActive(canvas)); + canvas->setFocus(); // Set focus after activation for the active focus. QVERIFY(canvas->rootObject() != 0); QDeclarativeTextInput *textinputObject = qobject_cast(canvas->rootObject()); QVERIFY(textinputObject != 0); @@ -1426,8 +1442,6 @@ void tst_qdeclarativetextinput::masks() QTest::keyPress(canvas, Qt::Key_A); QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); } - - delete canvas; } void tst_qdeclarativetextinput::validators() @@ -1436,8 +1450,10 @@ void tst_qdeclarativetextinput::validators() // so you may need to run their tests first. All validators are checked // here to ensure that their exposure to QML is working. - QDeclarativeView *canvas = createView(SRCDIR "/data/validators.qml"); + DeclarativeViewScopedPointer canvas(createView(SRCDIR "/data/validators.qml")); canvas->show(); + QApplication::setActiveWindow(canvas); + QVERIFY(QTest::qWaitForWindowActive(canvas)); canvas->setFocus(); QVERIFY(canvas->rootObject() != 0); @@ -1454,6 +1470,7 @@ void tst_qdeclarativetextinput::validators() QTest::keyRelease(canvas, Qt::Key_2, Qt::NoModifier ,10); QCOMPARE(intInput->text(), QLatin1String("1")); QCOMPARE(intInput->hasAcceptableInput(), false); + QVERIFY(intInput->hasFocus()); QTest::keyPress(canvas, Qt::Key_1); QTest::keyRelease(canvas, Qt::Key_1, Qt::NoModifier ,10); QCOMPARE(intInput->text(), QLatin1String("11")); @@ -1520,13 +1537,11 @@ void tst_qdeclarativetextinput::validators() QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); QCOMPARE(strInput->text(), QLatin1String("aaaa")); QCOMPARE(strInput->hasAcceptableInput(), true); - - delete canvas; } void tst_qdeclarativetextinput::inputMethods() { - QDeclarativeView *canvas = createView(SRCDIR "/data/inputmethods.qml"); + DeclarativeViewScopedPointer canvas(createView(SRCDIR "/data/inputmethods.qml")); canvas->show(); canvas->setFocus(); QApplication::setActiveWindow(canvas); @@ -1569,8 +1584,6 @@ void tst_qdeclarativetextinput::inputMethods() QApplication::sendEvent(canvas, &event); QCOMPARE(input->text(), QString("Our Goodbye world!")); QCOMPARE(input->cursorPosition(), 7); - - delete canvas; } /* @@ -1580,7 +1593,7 @@ the extent of the text, then they should ignore the keys. */ void tst_qdeclarativetextinput::navigation() { - QDeclarativeView *canvas = createView(SRCDIR "/data/navigation.qml"); + DeclarativeViewScopedPointer canvas(createView(SRCDIR "/data/navigation.qml")); canvas->show(); canvas->setFocus(); @@ -1627,13 +1640,11 @@ void tst_qdeclarativetextinput::navigation() QCOMPARE(input->hasActiveFocus(), false); simulateKey(canvas, Qt::Key_Left); QCOMPARE(input->hasActiveFocus(), true); - - delete canvas; } void tst_qdeclarativetextinput::navigation_RTL() { - QDeclarativeView *canvas = createView(SRCDIR "/data/navigation.qml"); + DeclarativeViewScopedPointer canvas(createView(SRCDIR "/data/navigation.qml")); canvas->show(); canvas->setFocus(); @@ -1666,8 +1677,6 @@ void tst_qdeclarativetextinput::navigation_RTL() // move back simulateKey(canvas, Qt::Key_Right); QVERIFY(input->hasActiveFocus() == true); - - delete canvas; } void tst_qdeclarativetextinput::copyAndPaste() { @@ -1954,7 +1963,7 @@ void tst_qdeclarativetextinput::cursorRectangle() void tst_qdeclarativetextinput::readOnly() { - QDeclarativeView *canvas = createView(SRCDIR "/data/readOnly.qml"); + DeclarativeViewScopedPointer canvas(createView(SRCDIR "/data/readOnly.qml")); canvas->show(); canvas->setFocus(); @@ -1972,18 +1981,16 @@ void tst_qdeclarativetextinput::readOnly() simulateKey(canvas, Qt::Key_Space); simulateKey(canvas, Qt::Key_Escape); QCOMPARE(input->text(), initial); - - delete canvas; } void tst_qdeclarativetextinput::echoMode() { - QDeclarativeView *canvas = createView(SRCDIR "/data/echoMode.qml"); + DeclarativeViewScopedPointer canvas(createView(SRCDIR "/data/echoMode.qml")); canvas->show(); - canvas->setFocus(); QApplication::setActiveWindow(canvas); QVERIFY(QTest::qWaitForWindowActive(canvas)); QCOMPARE(QApplication::activeWindow(), static_cast(canvas)); + canvas->setFocus(); QVERIFY(canvas->rootObject() != 0); @@ -2081,15 +2088,13 @@ void tst_qdeclarativetextinput::echoMode() ref &= ~(Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText); QCOMPARE(input->inputMethodHints(), ref); QCOMPARE(input->imHints(), Qt::ImhHiddenText | Qt::ImhDialableCharactersOnly); - - delete canvas; } #ifdef QT_GUI_PASSWORD_ECHO_DELAY void tst_qdeclarativetextinput::passwordEchoDelay() { - QDeclarativeView *canvas = createView(SRCDIR "/data/echoMode.qml"); + DeclarativeViewScopedPointer canvas(createView(SRCDIR "/data/echoMode.qml")); canvas->show(); canvas->setFocus(); QApplication::setActiveWindow(canvas); @@ -2135,8 +2140,6 @@ void tst_qdeclarativetextinput::passwordEchoDelay() ev.setCommitString(QLatin1String("7")); QApplication::sendEvent(canvas, &ev); QCOMPARE(input->displayText(), QString(7, fillChar) + QLatin1Char('7')); - - delete canvas; } #endif @@ -2473,7 +2476,7 @@ void tst_qdeclarativetextinput::preeditAutoScroll() // test the text is scrolled so the preedit is visible. sendPreeditText(preeditText.mid(0, 3), 1); - QVERIFY(input.positionAt(0) != 0); + QVERIFY2(input.positionAt(0) != 0, msgNotNotEqual(input.positionAt(0), 0).constData()); QVERIFY(input.cursorRectangle().left() < input.boundingRect().width()); QVERIFY(cursorRectangleSpy.count() > cursorRectangleChanges); cursorRectangleChanges = cursorRectangleSpy.count(); @@ -2591,7 +2594,7 @@ void tst_qdeclarativetextinput::preeditMicroFocus() ic.clear(); sendPreeditText(preeditText, i); currentRect = input.inputMethodQuery(Qt::ImMicroFocus).toRect(); - QVERIFY(previousRect.left() < currentRect.left()); + QVERIFY2(previousRect.left() < currentRect.left(), msgNotLessThan(previousRect.left(), currentRect.left()).constData()); #if defined(Q_WS_X11) QVERIFY(ic.updateCallCount > 0); #endif @@ -2698,7 +2701,7 @@ void tst_qdeclarativetextinput::inputMethodComposing() void tst_qdeclarativetextinput::cursorRectangleSize() { - QDeclarativeView *canvas = createView(SRCDIR "/data/positionAt.qml"); + DeclarativeViewScopedPointer canvas(createView(SRCDIR "/data/positionAt.qml")); QVERIFY(canvas->rootObject() != 0); canvas->show(); canvas->setFocus(); @@ -2718,12 +2721,12 @@ void tst_qdeclarativetextinput::cursorRectangleSize() void tst_qdeclarativetextinput::deselect() { - QDeclarativeView *canvas = createView(SRCDIR "/data/positionAt.qml"); + DeclarativeViewScopedPointer canvas(createView(SRCDIR "/data/positionAt.qml")); QVERIFY(canvas->rootObject() != 0); canvas->show(); - canvas->setFocus(); QApplication::setActiveWindow(canvas); QVERIFY(QTest::qWaitForWindowActive(canvas)); + canvas->setFocus(); QDeclarativeTextInput *textInput = qobject_cast(canvas->rootObject()); QVERIFY(textInput != 0); -- cgit v1.2.3 From a77201b597b908097e6abc763d8ec275cf99774f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 24 Jul 2013 10:39:02 +0200 Subject: Stabilize and fix tst_qdeclarativetextedit. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce a scoped pointer for the views to ensure cleanup after failing tests. Fix calculation in positionAt() to use a QPaintDevice and the first line of the text. Move calls to QDeclarativeView::setFocus() below activation for it to set the "active" focus item correctly. Task-number: QTBUG-32538 Change-Id: Ibf10d00b9bddd587f5721d5b5011f6eafc617f39 Reviewed-by: Jan Arve Sæther --- .../tst_qdeclarativetextedit.cpp | 90 ++++++++++------------ 1 file changed, 41 insertions(+), 49 deletions(-) diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 19ad45e5..2a057f91 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -90,6 +90,13 @@ void sendPreeditText(const QString &text, int cursor) QApplication::sendEvent(qApp->focusObject(), &event); } +// A QScopedPointer which provides operator QDeclarativeView *, removing the +// need to write canvas.data() where a QDeclarativeView * is required. +class DeclarativeViewScopedPointer : public QScopedPointer { +public: + explicit inline DeclarativeViewScopedPointer(QDeclarativeView *v = 0) : QScopedPointer(v) {} + inline operator QDeclarativeView *() const { return data(); } +}; class tst_qdeclarativetextedit : public QDeclarativeDataTest @@ -416,7 +423,7 @@ void tst_qdeclarativetextedit::alignments() + QDir::toNativeSeparators(referenceImage) + QStringLiteral("' does not exist."))); - QDeclarativeView *canvas = createView(testFile("alignments.qml")); + DeclarativeViewScopedPointer canvas(createView(testFile("alignments.qml"))); setFrameless(canvas); canvas->show(); @@ -438,8 +445,6 @@ void tst_qdeclarativetextedit::alignments() QVERIFY(!expect.isNull()); QCOMPARE(actual,expect); - - delete canvas; } @@ -480,7 +485,7 @@ void tst_qdeclarativetextedit::hAlign() void tst_qdeclarativetextedit::hAlign_RightToLeft() { - QDeclarativeView *canvas = createView(testFile("horizontalAlignment_RightToLeft.qml")); + DeclarativeViewScopedPointer canvas(createView(testFile("horizontalAlignment_RightToLeft.qml"))); QDeclarativeTextEdit *textEdit = canvas->rootObject()->findChild("text"); QVERIFY(textEdit != 0); canvas->show(); @@ -588,7 +593,7 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft() QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2); #endif - delete canvas; + canvas.reset(); #ifndef Q_OS_MAC // QTBUG-18040 // alignment of TextEdit with no text set to it @@ -971,7 +976,7 @@ void tst_qdeclarativetextedit::isRightToLeft() void tst_qdeclarativetextedit::keySelection() { - QDeclarativeView *canvas = createView(testFile("navigation.qml")); + DeclarativeViewScopedPointer canvas(createView(testFile("navigation.qml"))); canvas->show(); QApplication::setActiveWindow(canvas); QVERIFY(QTest::qWaitForWindowActive(canvas)); @@ -1015,8 +1020,6 @@ void tst_qdeclarativetextedit::keySelection() QVERIFY(input->hasActiveFocus() == false); QCOMPARE(input->selectedText(), QString()); QCOMPARE(spy.count(), 4); - - delete canvas; } void tst_qdeclarativetextedit::moveCursorSelection_data() @@ -1385,7 +1388,7 @@ void tst_qdeclarativetextedit::mouseSelection() QFETCH(int, to); QFETCH(QString, selectedText); - QDeclarativeView *canvas = createView(qmlfile); + DeclarativeViewScopedPointer canvas(createView(qmlfile)); canvas->show(); QApplication::setActiveWindow(canvas); @@ -1411,13 +1414,11 @@ void tst_qdeclarativetextedit::mouseSelection() QTest::mouseClick(canvas->viewport(), Qt::LeftButton, Qt::NoModifier, p1); QTest::mouseClick(canvas->viewport(), Qt::LeftButton, Qt::ShiftModifier, p2); QCOMPARE(textEditObject->selectedText(), selectedText); - - delete canvas; } void tst_qdeclarativetextedit::multilineMouseSelection() { - QDeclarativeView *canvas = createView(testFile("mouseselection_multiline.qml")); + DeclarativeViewScopedPointer canvas(createView(testFile("mouseselection_multiline.qml"))); canvas->show(); QApplication::setActiveWindow(canvas); QVERIFY(QTest::qWaitForWindowActive(canvas)); @@ -1445,8 +1446,6 @@ void tst_qdeclarativetextedit::multilineMouseSelection() QString str2 = textEditObject->selectedText(); QVERIFY(str1 != str2); QVERIFY(str2.length() > 3); - - delete canvas; } void tst_qdeclarativetextedit::deferEnableSelectByMouse_data() @@ -1462,7 +1461,7 @@ void tst_qdeclarativetextedit::deferEnableSelectByMouse() // Verify text isn't selected if selectByMouse is enabled after the mouse button has been pressed. QFETCH(QString, qmlfile); - QDeclarativeView *canvas = createView(qmlfile); + DeclarativeViewScopedPointer canvas(createView(qmlfile)); canvas->show(); QApplication::setActiveWindow(canvas); @@ -1485,8 +1484,6 @@ void tst_qdeclarativetextedit::deferEnableSelectByMouse() QApplication::sendEvent(canvas->viewport(), &mv); QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x2,y))); QVERIFY(textEditObject->selectedText().isEmpty()); - - delete canvas; } void tst_qdeclarativetextedit::deferDisableSelectByMouse_data() @@ -1502,7 +1499,7 @@ void tst_qdeclarativetextedit::deferDisableSelectByMouse() // Verify text isn't selected if selectByMouse is enabled after the mouse button has been pressed. QFETCH(QString, qmlfile); - QDeclarativeView *canvas = createView(qmlfile); + DeclarativeViewScopedPointer canvas(createView(qmlfile)); canvas->show(); QApplication::setActiveWindow(canvas); @@ -1525,15 +1522,13 @@ void tst_qdeclarativetextedit::deferDisableSelectByMouse() QApplication::sendEvent(canvas->viewport(), &mv); QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x2,y))); QVERIFY(textEditObject->selectedText().length() > 3); - - delete canvas; } void tst_qdeclarativetextedit::dragMouseSelection() { QString qmlfile = testFile("mouseselection_true.qml"); - QDeclarativeView *canvas = createView(qmlfile); + DeclarativeViewScopedPointer canvas(createView(qmlfile)); canvas->show(); QApplication::setActiveWindow(canvas); @@ -1572,8 +1567,6 @@ void tst_qdeclarativetextedit::dragMouseSelection() QVERIFY(str2.length() > 3); QVERIFY(str1 != str2); // Verify the second press and drag is a new selection and doesn't not the first moved. - - delete canvas; } void tst_qdeclarativetextedit::mouseSelectionMode_data() @@ -1594,7 +1587,7 @@ void tst_qdeclarativetextedit::mouseSelectionMode() QString text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - QDeclarativeView *canvas = createView(qmlfile); + DeclarativeViewScopedPointer canvas(createView(qmlfile)); canvas->show(); QApplication::setActiveWindow(canvas); @@ -1627,13 +1620,11 @@ void tst_qdeclarativetextedit::mouseSelectionMode() QTest::mouseClick(canvas->viewport(), Qt::LeftButton, Qt::NoModifier, canvas->mapFromScene(QPoint(x1,y))); QTest::mouseClick(canvas->viewport(), Qt::LeftButton, Qt::ShiftModifier, canvas->mapFromScene(QPoint(x2,y))); QCOMPARE(textEditObject->selectedText(), str); - - delete canvas; } void tst_qdeclarativetextedit::inputMethodHints() { - QDeclarativeView *canvas = createView(testFile("inputmethodhints.qml")); + DeclarativeViewScopedPointer canvas(createView(testFile("inputmethodhints.qml"))); setFrameless(canvas); canvas->show(); canvas->setFocus(); @@ -1644,25 +1635,30 @@ void tst_qdeclarativetextedit::inputMethodHints() QVERIFY(textEditObject->inputMethodHints() & Qt::ImhNoPredictiveText); textEditObject->setInputMethodHints(Qt::ImhUppercaseOnly); QVERIFY(textEditObject->inputMethodHints() & Qt::ImhUppercaseOnly); +} - delete canvas; +static QByteArray msgFont(const QFont &f) +{ + QString s; + QDebug(&s) << f; + return s.toLocal8Bit(); } void tst_qdeclarativetextedit::positionAt() { - QDeclarativeView *canvas = createView(testFile("positionAt.qml")); + DeclarativeViewScopedPointer canvas(createView(testFile("positionAt.qml"))); QVERIFY(canvas->rootObject() != 0); setFrameless(canvas); canvas->show(); - canvas->setFocus(); QApplication::setActiveWindow(canvas); QVERIFY(QTest::qWaitForWindowActive(canvas)); + canvas->setFocus(); QDeclarativeTextEdit *texteditObject = qobject_cast(canvas->rootObject()); QVERIFY(texteditObject != 0); /* - QFontMetrics fm(texteditObject->font()); + QFontMetrics fm(texteditObject->font(), canvas); const int y0 = fm.height() / 2; const int y1 = fm.height() * 3 / 2; @@ -1676,11 +1672,13 @@ void tst_qdeclarativetextedit::positionAt() QVERIFY(diff < 5); #endif */ - QTextLayout layout(texteditObject->text()); - layout.setFont(texteditObject->font()); + const QFont font = texteditObject->font(); + const QString text = texteditObject->text(); + QTextLayout layout(text.left(text.indexOf('\n')), font, canvas); layout.beginLayout(); QTextLine line = layout.createLine(); + QVERIFY(line.isValid()); layout.endLayout(); const int y0 = line.height() / 2; @@ -1692,8 +1690,10 @@ void tst_qdeclarativetextedit::positionAt() int widthEnd = ceil(line.cursorToX(pos + 1)); const int halfObjectWidth = texteditObject->width() / 2; - QVERIFY2(widthBegin <= halfObjectWidth, msgComparison(widthBegin, halfObjectWidth).constData()); - QVERIFY2(widthEnd >= halfObjectWidth, msgComparison(widthEnd, halfObjectWidth).constData()); + QVERIFY2(widthBegin <= halfObjectWidth, + (msgComparison(widthBegin, halfObjectWidth) + ' ' + msgFont(font)).constData()); + QVERIFY2(widthEnd >= halfObjectWidth, + (msgComparison(widthEnd, halfObjectWidth) + ' ' + msgFont(font)).constData()); const qreal x0 = texteditObject->positionToRectangle(pos).x(); const qreal x1 = texteditObject->positionToRectangle(pos + 1).x(); @@ -1715,8 +1715,6 @@ void tst_qdeclarativetextedit::positionAt() QCOMPARE(texteditObject->positionToRectangle(1).x(), x1); QVERIFY(texteditObject->positionAt(x0 / 2, y1) > 0); - - delete canvas; } void tst_qdeclarativetextedit::cursorDelegate() @@ -1897,7 +1895,7 @@ void tst_qdeclarativetextedit::delegateLoading() server.serveDirectory(testFile("httpslow"), TestHTTPServer::Delay); server.serveDirectory(testFile("http")); - QDeclarativeView* view = new QDeclarativeView(0); + QScopedPointer view(new QDeclarativeView(0)); view->setSource(QUrl(QLatin1String("http://localhost:42332/") + qmlfile)); view->show(); @@ -1928,8 +1926,6 @@ void tst_qdeclarativetextedit::delegateLoading() //###This was only needed for code coverage, and could be a case of overzealous defensive programming //delegate = view->rootObject()->findChild("delegateErrorB"); //QVERIFY(!delegate); - - delete view; } /* @@ -1938,7 +1934,7 @@ the extent of the text, then they should ignore the keys. */ void tst_qdeclarativetextedit::navigation() { - QDeclarativeView *canvas = createView(testFile("navigation.qml")); + DeclarativeViewScopedPointer canvas(createView(testFile("navigation.qml"))); canvas->show(); canvas->setFocus(); @@ -1968,8 +1964,6 @@ void tst_qdeclarativetextedit::navigation() QCOMPARE(input->hasActiveFocus(), true); simulateKey(canvas, Qt::Key_Left); QCOMPARE(input->hasActiveFocus(), false); - - delete canvas; } void tst_qdeclarativetextedit::copyAndPaste() { @@ -2070,7 +2064,7 @@ void tst_qdeclarativetextedit::canPasteEmpty() { void tst_qdeclarativetextedit::readOnly() { - QDeclarativeView *canvas = createView(testFile("readOnly.qml")); + DeclarativeViewScopedPointer canvas(createView(testFile("readOnly.qml"))); canvas->show(); canvas->setFocus(); @@ -2088,8 +2082,6 @@ void tst_qdeclarativetextedit::readOnly() simulateKey(canvas, Qt::Key_Space); simulateKey(canvas, Qt::Key_Escape); QCOMPARE(edit->text(), initial); - - delete canvas; } void tst_qdeclarativetextedit::simulateKey(QDeclarativeView *view, int key, Qt::KeyboardModifiers modifiers) @@ -2611,7 +2603,7 @@ void tst_qdeclarativetextedit::inputMethodComposing() void tst_qdeclarativetextedit::cursorRectangleSize() { - QDeclarativeView *canvas = createView(testFile("CursorRect.qml")); + DeclarativeViewScopedPointer canvas(createView(testFile("CursorRect.qml"))); setFrameless(canvas); QVERIFY(canvas->rootObject() != 0); canvas->show(); @@ -2632,13 +2624,13 @@ void tst_qdeclarativetextedit::cursorRectangleSize() void tst_qdeclarativetextedit::deselect() { - QDeclarativeView *canvas = createView(testFile("CursorRect.qml")); + DeclarativeViewScopedPointer canvas(createView(testFile("CursorRect.qml"))); setFrameless(canvas); QVERIFY(canvas->rootObject() != 0); canvas->show(); - canvas->setFocus(); QApplication::setActiveWindow(canvas); QVERIFY(QTest::qWaitForWindowActive(canvas)); + canvas->setFocus(); QDeclarativeTextEdit *textEdit = qobject_cast(canvas->rootObject()); QVERIFY(textEdit != 0); -- cgit v1.2.3 From b6a75d831009688b24633d1c0591029ff3cd0d74 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 29 Jul 2013 11:44:38 +0200 Subject: Fail tst_qdeclarativeborderimage::mirror() on Windows. As expected. The test was using an invalid URL and thus successfully comparing 2 empty images. Task-number: QTBUG-32661 Change-Id: If6f0ad23454673b4b4fb2bc0a73da2b50663f171 Reviewed-by: Sergio Ahumada --- .../qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp index f38a95a1..6c2e0312 100644 --- a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp +++ b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp @@ -219,7 +219,11 @@ void tst_qdeclarativeborderimage::smooth() void tst_qdeclarativeborderimage::mirror() { - QString componentStr = "import QtQuick 1.0\nBorderImage { source: \"" SRCDIR "/data/heart200.png\"; smooth: true; width: 300; height: 300; border { top: 50; right: 50; bottom: 50; left: 50 } }"; + const QString imagePath = QLatin1String(SRCDIR) + QStringLiteral("/data/heart200.png"); + QVERIFY(QFileInfo(imagePath).exists()); + const QString componentStr = QStringLiteral("import QtQuick 1.0\nBorderImage { source: \"") + + QUrl::fromLocalFile(imagePath).toString() + + QStringLiteral("\"; smooth: true; width: 300; height: 300; border { top: 50; right: 50; bottom: 50; left: 50 } }"); QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast(component.create()); -- cgit v1.2.3 From f9df0b99470f905289126f253ede978b611d6333 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Mon, 15 Jul 2013 21:54:04 -0700 Subject: Keyboard input documentation: an event accepted does NOT bubble up Add missing negation for the code snippet demonstrating accepting a key event Change-Id: Ia4c1cc4f207df9fb6e041ff088c6da2a63cd47b9 Reviewed-by: Alan Alpert --- src/doc/src/declarative/focus.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/src/declarative/focus.qdoc b/src/doc/src/declarative/focus.qdoc index 7ed80b05..3d0dde98 100644 --- a/src/doc/src/declarative/focus.qdoc +++ b/src/doc/src/declarative/focus.qdoc @@ -56,8 +56,8 @@ is delivered to it. Otherwise, regular Qt key handling continues. stops. Otherwise the event is "bubbled up", by recursively passing it to each Item's parent until either the event is accepted, or the root Item is reached. -If the \c {Rectangle} element in the following example has active focus and the \c A key is pressed, -it will bubble up to its parent. However, pressing the \c B key will bubble up to the root +If the \c {Rectangle} type in the following example has active focus and the \c A key is pressed, +the event will not be propagated further. Pressing the \c B key the event will propagate to the root item and thus subsequently be ignored. \snippet doc/src/snippets/declarative/focus/rectangle.qml simple key event -- cgit v1.2.3