diff options
-rw-r--r-- | src/gui/kernel/qapplication_win.cpp | 3 | ||||
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 14 | ||||
-rw-r--r-- | src/multimedia/video/qabstractvideobuffer_p.h | 3 | ||||
-rw-r--r-- | src/network/socket/qlocalsocket_win.cpp | 19 | ||||
-rw-r--r-- | tests/auto/linguist/lconvert/tst_lconvert.cpp | 2 | ||||
-rw-r--r-- | tests/auto/linguist/lupdate/tst_lupdate.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qtextlayout/tst_qtextlayout.cpp | 19 | ||||
-rw-r--r-- | tests/auto/qtimeline/tst_qtimeline.cpp | 12 | ||||
-rw-r--r-- | tests/auto/qwidget/tst_qwidget.cpp | 27 | ||||
-rw-r--r-- | tests/auto/qwidgetaction/tst_qwidgetaction.cpp | 6 |
10 files changed, 66 insertions, 41 deletions
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 0edb8fb..2a85fdc 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -955,6 +955,9 @@ const QString qt_reg_winclass(QWidget *w) // register window class if (qt_widget_private(w)->isGLWidget) { cname = QLatin1String("QGLWidget"); style = CS_DBLCLKS; +#ifndef Q_WS_WINCE + style |= CS_OWNDC; +#endif icon = true; } else if (flags & Qt::MSWindowsOwnDC) { cname = QLatin1String("QWidgetOwnDC"); diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index ddf9411..fec9ecc 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1661,7 +1661,7 @@ namespace { { LineBreakHelper() : glyphCount(0), maxGlyphs(0), currentPosition(0), fontEngine(0), logClusters(0), - manualWrap(false) + manualWrap(false), whiteSpaceOrObject(true) { } @@ -1684,6 +1684,7 @@ namespace { const unsigned short *logClusters; bool manualWrap; + bool whiteSpaceOrObject; bool checkFullOtherwiseExtend(QScriptLine &line); @@ -1693,8 +1694,10 @@ namespace { } inline glyph_t currentGlyph() const - { + { Q_ASSERT(currentPosition > 0); + Q_ASSERT(logClusters[currentPosition - 1] < glyphs.numGlyphs); + return glyphs.glyphs[logClusters[currentPosition - 1]]; } @@ -1829,6 +1832,7 @@ void QTextLine::layout_helper(int maxGlyphs) lbh.tmpData.descent = qMax(lbh.tmpData.descent, current.descent); if (current.analysis.flags == QScriptAnalysis::Tab && (alignment & (Qt::AlignLeft | Qt::AlignRight | Qt::AlignCenter | Qt::AlignJustify))) { + lbh.whiteSpaceOrObject = true; if (lbh.checkFullOtherwiseExtend(line)) goto found; @@ -1845,6 +1849,7 @@ void QTextLine::layout_helper(int maxGlyphs) if (lbh.checkFullOtherwiseExtend(line)) goto found; } else if (current.analysis.flags == QScriptAnalysis::LineOrParagraphSeparator) { + lbh.whiteSpaceOrObject = true; // if the line consists only of the line separator make sure // we have a sane height if (!line.length && !lbh.tmpData.length) @@ -1858,6 +1863,7 @@ void QTextLine::layout_helper(int maxGlyphs) line += lbh.tmpData; goto found; } else if (current.analysis.flags == QScriptAnalysis::Object) { + lbh.whiteSpaceOrObject = true; lbh.tmpData.length++; QTextFormat format = eng->formats()->format(eng->formatIndex(&eng->layoutData->items[item])); @@ -1871,6 +1877,7 @@ void QTextLine::layout_helper(int maxGlyphs) if (lbh.checkFullOtherwiseExtend(line)) goto found; } else if (attributes[lbh.currentPosition].whiteSpace) { + lbh.whiteSpaceOrObject = true; while (lbh.currentPosition < end && attributes[lbh.currentPosition].whiteSpace) addNextCluster(lbh.currentPosition, end, lbh.spaceData, lbh.glyphCount, current, lbh.logClusters, lbh.glyphs); @@ -1880,6 +1887,7 @@ void QTextLine::layout_helper(int maxGlyphs) goto found; } } else { + lbh.whiteSpaceOrObject = false; bool sb_or_ws = false; do { addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount, @@ -1941,7 +1949,7 @@ void QTextLine::layout_helper(int maxGlyphs) LB_DEBUG("reached end of line"); lbh.checkFullOtherwiseExtend(line); found: - if (lbh.rightBearing > 0) // If right bearing has not yet been adjusted + if (lbh.rightBearing > 0 && !lbh.whiteSpaceOrObject) // If right bearing has not yet been adjusted lbh.adjustRightBearing(); line.textAdvance = line.textWidth; line.textWidth -= qMin(QFixed(), lbh.rightBearing); diff --git a/src/multimedia/video/qabstractvideobuffer_p.h b/src/multimedia/video/qabstractvideobuffer_p.h index c72f303..3303b36 100644 --- a/src/multimedia/video/qabstractvideobuffer_p.h +++ b/src/multimedia/video/qabstractvideobuffer_p.h @@ -65,6 +65,9 @@ public: : handleType(QAbstractVideoBuffer::NoHandle) {} + virtual ~QAbstractVideoBufferPrivate() + {} + QAbstractVideoBuffer::HandleType handleType; }; diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp index 5486f47..4907f2c 100644 --- a/src/network/socket/qlocalsocket_win.cpp +++ b/src/network/socket/qlocalsocket_win.cpp @@ -280,6 +280,12 @@ void QLocalSocketPrivate::startAsyncRead() case ERROR_IO_PENDING: // This is not an error. We're getting notified, when data arrives. return; + case ERROR_MORE_DATA: + // This is not an error. The synchronous read succeeded. + // We're connected to a message mode pipe and the message + // didn't fit into the pipe's system buffer. + completeAsyncRead(); + break; case ERROR_PIPE_NOT_CONNECTED: { // It may happen, that the other side closes the connection directly @@ -309,9 +315,18 @@ bool QLocalSocketPrivate::completeAsyncRead() DWORD bytesRead; if (!GetOverlappedResult(handle, &overlapped, &bytesRead, TRUE)) { - if (GetLastError() != ERROR_PIPE_NOT_CONNECTED) + switch (GetLastError()) { + case ERROR_MORE_DATA: + // This is not an error. We're connected to a message mode + // pipe and the message didn't fit into the pipe's system + // buffer. We will read the remaining data in the next call. + break; + case ERROR_PIPE_NOT_CONNECTED: setErrorString(QLatin1String("QLocalSocketPrivate::completeAsyncRead")); - return false; + // fall through + default: + return false; + } } actualReadBufferSize += bytesRead; diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp index 054da4a..998f588 100644 --- a/tests/auto/linguist/lconvert/tst_lconvert.cpp +++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp @@ -153,7 +153,7 @@ void tst_lconvert::verifyReadFail(const QString &fn) { QProcess cvt; cvt.start(binDir + "/lconvert", QStringList() << (dataDir + fn)); - QVERIFY(cvt.waitForFinished(1000)); + QVERIFY(cvt.waitForFinished(10000)); QVERIFY(cvt.exitStatus() == QProcess::NormalExit); QVERIFY2(cvt.exitCode() == 2, "Accepted invalid input"); } diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index c179462..5ba6c52 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -288,7 +288,7 @@ void tst_lupdate::good() proc.setWorkingDirectory(workDir); proc.setProcessChannelMode(QProcess::MergedChannels); proc.start(m_cmdLupdate + ' ' + lupdatecmd, QIODevice::ReadWrite | QIODevice::Text); - QVERIFY2(proc.waitForFinished(5000), qPrintable(lupdatecmd)); + QVERIFY2(proc.waitForFinished(30000), qPrintable(lupdatecmd)); QByteArray output = proc.readAll(); QVERIFY2(proc.exitStatus() == QProcess::NormalExit, "\"lupdate " + lupdatecmd.toLatin1() + "\" crashed\n" + output); diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index a631f3d..f798faf 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -112,6 +112,7 @@ private slots: void columnWrapWithTabs(); void boundingRectForUnsetLineWidth(); void boundingRectForSetLineWidth(); + void glyphLessItems(); // QTextLine stuff void setNumColumnsWrapAtWordBoundaryOrAnywhere(); @@ -1339,6 +1340,24 @@ void tst_QTextLayout::lineWidthFromBOM() // Don't spin into an infinite loop } +void tst_QTextLayout::glyphLessItems() +{ + { + QTextLayout layout; + layout.setText("\t\t"); + layout.beginLayout(); + layout.createLine(); + layout.endLayout(); + } + + { + QTextLayout layout; + layout.setText(QString::fromLatin1("AA") + QChar(QChar::LineSeparator)); + layout.beginLayout(); + layout.createLine(); + layout.endLayout(); + } +} QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" diff --git a/tests/auto/qtimeline/tst_qtimeline.cpp b/tests/auto/qtimeline/tst_qtimeline.cpp index b15d2a4..47d0550 100644 --- a/tests/auto/qtimeline/tst_qtimeline.cpp +++ b/tests/auto/qtimeline/tst_qtimeline.cpp @@ -247,11 +247,7 @@ void tst_QTimeLine::frameRate() void tst_QTimeLine::value() { -#ifdef Q_OS_WINCE //On WinCE timer resolution is bad - use longer times QTimeLine timeLine(2000); -#else - QTimeLine timeLine(200); -#endif QVERIFY(timeLine.currentValue() == 0.0); // Default speed @@ -270,19 +266,11 @@ void tst_QTimeLine::value() timeLine.setCurrentTime(100); timeLine.start(); // Let it update on its own -#ifdef Q_OS_WINCE QTest::qWait(500); -#else - QTest::qWait(50); -#endif QCOMPARE(timeLine.state(), QTimeLine::Running); qreal value = timeLine.currentValue(); timeLine.setDirection(QTimeLine::Backward); -#ifdef Q_OS_WINCE QTest::qWait(1000); -#else - QTest::qWait(100); -#endif QVERIFY(timeLine.currentValue() < value); timeLine.stop(); } diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 045216a..2d559c8 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -151,16 +151,6 @@ bool macHasAccessToWindowsServer() #undef Bool #endif -// Will try to wait for the condition while allowing event processing -// for a maximum of 2 seconds. -#define WAIT_FOR_CONDITION(expr, expected) \ - do { \ - const int step = 100; \ - for (int i = 0; i < 2000 && expr != expected; i+=step) { \ - QTest::qWait(step); \ - } \ - } while(0) - //TESTED_CLASS= //TESTED_FILES= @@ -1665,13 +1655,11 @@ void tst_QWidget::focusChainOnHide() child->setFocus(); qApp->processEvents(); - WAIT_FOR_CONDITION(child->hasFocus(), true); - QCOMPARE(child->hasFocus(), true); + QTRY_COMPARE(child->hasFocus(), true); child->hide(); qApp->processEvents(); - WAIT_FOR_CONDITION(parent->hasFocus(), true); - QCOMPARE(parent->hasFocus(), true); + QTRY_COMPARE(parent->hasFocus(), true); QCOMPARE(parent, qApp->focusWidget()); delete parent; @@ -9241,7 +9229,8 @@ void tst_QWidget::syntheticEnterLeave() QCOMPARE(grandChild->numLeaveEvents, 0); QCOMPARE(child1->numLeaveEvents, 0); - QCOMPARE(window.numEnterEvents, 1); + // This event arrives asynchronously + QTRY_COMPARE(window.numEnterEvents, 1); QCOMPARE(child2->numEnterEvents, 1); QCOMPARE(grandChild->numEnterEvents, 1); QCOMPARE(child1->numEnterEvents, 0); @@ -9332,7 +9321,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() child.show(); // Make sure the child gets enter event and no mouse move event. - QCOMPARE(child.numEnterEvents, 1); + QTRY_COMPARE(child.numEnterEvents, 1); QCOMPARE(child.numMouseMoveEvents, 0); child.hide(); @@ -9343,7 +9332,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() // Make sure the child gets enter event and mouse move event. // Note that we verify event->button() and event->buttons() // in SELChild::mouseMoveEvent(). - QCOMPARE(child.numEnterEvents, 1); + QTRY_COMPARE(child.numEnterEvents, 1); QCOMPARE(child.numMouseMoveEvents, 1); // Sending synthetic enter/leave trough the parent's mousePressEvent handler. @@ -9354,7 +9343,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() QTest::mouseClick(&parent, Qt::LeftButton); // Make sure the child gets enter event and one mouse move event. - QCOMPARE(child.numEnterEvents, 1); + QTRY_COMPARE(child.numEnterEvents, 1); QCOMPARE(child.numMouseMoveEvents, 1); child.hide(); @@ -9363,7 +9352,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() QTest::mouseClick(&parent, Qt::LeftButton); // Make sure the child gets enter event and no mouse move event. - QCOMPARE(child.numEnterEvents, 1); + QTRY_COMPARE(child.numEnterEvents, 1); QCOMPARE(child.numMouseMoveEvents, 0); } #endif diff --git a/tests/auto/qwidgetaction/tst_qwidgetaction.cpp b/tests/auto/qwidgetaction/tst_qwidgetaction.cpp index 53dc4b5..efe4838 100644 --- a/tests/auto/qwidgetaction/tst_qwidgetaction.cpp +++ b/tests/auto/qwidgetaction/tst_qwidgetaction.cpp @@ -187,12 +187,12 @@ void tst_QWidgetAction::visibilityUpdate() action->setDefaultWidget(combo); tb.addAction(action); - qApp->processEvents(); //the call to show is delayed by the toolbar layout - QVERIFY(combo->isVisible()); + //the call to show is delayed by the toolbar layout + QTRY_VERIFY(combo->isVisible()); QVERIFY(action->isVisible()); action->setVisible(false); - qApp->processEvents(); //the call to hide is delayed by the toolbar layout + //the call to hide is delayed by the toolbar layout QTRY_VERIFY(!combo->isVisible()); delete action; |