diff options
author | Janne Anttila <janne.anttila@digia.com> | 2009-09-28 13:14:00 (GMT) |
---|---|---|
committer | Janne Anttila <janne.anttila@digia.com> | 2009-09-28 13:14:00 (GMT) |
commit | 58b40ab2220b9af4d2e679f23f07e425f9075dbd (patch) | |
tree | b1da974247685a5034a2516a1bac457329baa127 | |
parent | c9efa5704ba89736e90d7a28e07687a826874232 (diff) | |
parent | 726ce1dcba37d85bc743559e1b882a72413d1d82 (diff) | |
download | Qt-58b40ab2220b9af4d2e679f23f07e425f9075dbd.zip Qt-58b40ab2220b9af4d2e679f23f07e425f9075dbd.tar.gz Qt-58b40ab2220b9af4d2e679f23f07e425f9075dbd.tar.bz2 |
Merge branch '4.6' of git@scm.dev.troll.no:qt/qt into 4.6
-rw-r--r-- | dist/changes-4.5.3 | 55 | ||||
-rw-r--r-- | doc/src/development/designer-manual.qdoc | 4 | ||||
-rw-r--r-- | doc/src/qt4-intro.qdoc | 2 | ||||
-rw-r--r-- | src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp | 4 | ||||
-rw-r--r-- | src/3rdparty/javascriptcore/VERSION | 4 | ||||
-rw-r--r-- | src/gui/image/qpixmap_s60.cpp | 4 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper_mmx.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper_mmx3dnow.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/qspinbox.cpp | 214 | ||||
-rw-r--r-- | src/gui/widgets/qtabbar.cpp | 2 | ||||
-rw-r--r-- | src/network/kernel/qhostaddress.cpp | 3 | ||||
-rw-r--r-- | src/testlib/qtestcase.cpp | 2 | ||||
-rw-r--r-- | tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qdom/tst_qdom.cpp | 15 | ||||
-rw-r--r-- | tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp | 42 | ||||
-rw-r--r-- | tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 47 | ||||
-rw-r--r-- | tests/auto/qspinbox/tst_qspinbox.cpp | 8 | ||||
-rw-r--r-- | tests/auto/qstatemachine/tst_qstatemachine.cpp | 77 |
18 files changed, 250 insertions, 240 deletions
diff --git a/dist/changes-4.5.3 b/dist/changes-4.5.3 index df282b0..d797b4c 100644 --- a/dist/changes-4.5.3 +++ b/dist/changes-4.5.3 @@ -33,11 +33,49 @@ Third party components * Library * **************************************************************************** +- QDirIterator + * [258230] Fixed inconsistencies in value returned from + QDirIterator::next(). + +- QColorDialog + * [256164] Fixed the setting of alpha values in QColorDialog. + +- QDoubleSpinBox + * [255019] Fixed a crash when using large value for decimals. + +- QInputDialog + * [255502] Fixed bug in getDouble() + +- QNetworkAccessManager + * [256240] Proper handling of HTTP redirect in AlwaysCache mode. + * [257662] Fix timing issues that could trigger double sending of an + HTTP request. + * [256630] Fix usage of QProgressDialog together with QNetworkReply. + +- QSslCertificate + * [256066] Fix loading of a PEM when the length was a multiple of 64. + +- QTemporaryFile + * [260165] Fixed a bug where temporary files would be left behind when + copying a file to a non-existing directory. **************************************************************************** * Database Drivers * **************************************************************************** - +- [QT-353] (ODBC) Fixed issue of forward only datasets failing when not + explicitly set so. +- [222678] Fixed QSqlTableModel: trying to delete the wrong row. +- (Interbase) Fixed crash when calling numRows on unknown query type. +- Fixed several database autotests. +- Fixed determination of end of odbc string on deficient driver. +- Fixed formatting of date strings in psql driver. +- Fixed mysql queries automatically getting prepared. Now have to explicitly + prepare them if you want that functionality. +- Fixed failure when QSqlTableModel has null fields to update. +- Fixed missing isnan/isinf on some platforms (needed for postgres driver) +- Fixed ::record for dialect 3 named tables in interbase/firebird. +- Fixed invalid length for numeric fields in oracle. +- (ODBC) Fixed non-unicode strings should be strings, not bytearrays. **************************************************************************** * Platform Specific Changes * @@ -46,6 +84,10 @@ Third party components Qt for Linux/X11 ---------------- +- Fixed a bug where an empty KDEDIRS variable would bring /share into the icon + search path. +- [KDE 191759] Plasma spinning in endless loop. + Qt for Windows -------------- @@ -53,7 +95,16 @@ Qt for Windows Qt for Mac OS X --------------- +[252088] Drag and drop events will now consider the WA_TransparentForMouseEvents + in Cocoa port. +[255428] Fixed an an issue when Calling QWidget::raise() on hidden windows making + them visible in Cocoa port. +[256269] Window resize events triggered from QWidget::adjustSize() will now + be sent as non-spontaneous event in the Cocoa port. +[258822] Fixed a crash when inserting the same menu twice in a menubar in Cocoa port. +- Fixed the wizard background images for Snow Leopard. + Qt for Embedded Linux --------------------- @@ -61,7 +112,7 @@ Qt for Embedded Linux Qt for Windows CE ----------------- - +[260702] Fixed restoring of minimized Windows. **************************************************************************** * Compiler Specific Changes * diff --git a/doc/src/development/designer-manual.qdoc b/doc/src/development/designer-manual.qdoc index 0c5bf83..4f4db85 100644 --- a/doc/src/development/designer-manual.qdoc +++ b/doc/src/development/designer-manual.qdoc @@ -61,8 +61,8 @@ \l{Getting To Know Qt Designer} document. For a quick tutorial on how to use \QD, refer to \l{A Quick Start to Qt Designer}. - Qt Designer 4.5 boasts a long list of improvements. For a detailed list of - what is new, refer \l{What's New in Qt Designer 4.5}. + Qt Designer 4.6 boasts a long list of improvements. For a detailed list of + what is new, refer \l{What's New in Qt Designer 4.6}. \image designer-multiple-screenshot.png diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc index 0177d35..03d9b29 100644 --- a/doc/src/qt4-intro.qdoc +++ b/doc/src/qt4-intro.qdoc @@ -784,7 +784,7 @@ these settings when you edit forms. More information about these improvements can be found in the - \l{What's New in Qt Designer 4.5} overview. + \l{What's New in Qt Designer 4.6} overview. \section1 Qt Linguist Improvements diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp index ec242cc..c31216b 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp @@ -435,7 +435,7 @@ void Interpreter::dumpRegisters(CallFrame* callFrame) printf("[ReturnPC] | %10p | %p \n", it, (*it).vPC()); ++it; printf("[ReturnValueRegister] | %10p | %d \n", it, (*it).i()); ++it; printf("[ArgumentCount] | %10p | %d \n", it, (*it).i()); ++it; - printf("[Callee] | %10p | %p \n", it, (*it).function()); ++it; + printf("[Callee] | %10p | %p \n", it, (*it).object()); ++it; printf("[OptionalCalleeArguments] | %10p | %p \n", it, (*it).arguments()); ++it; printf("-----------------------------------------------------------------------------\n"); @@ -3113,7 +3113,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi exceptionValue = createStackOverflowError(callFrame); goto vm_throw; } - ASSERT(!callFrame->callee()->isHostFunction()); + ASSERT(!asFunction(callFrame->callee())->isHostFunction()); int32_t expectedParams = static_cast<JSFunction*>(callFrame->callee())->jsExecutable()->parameterCount(); int32_t inplaceArgs = min(argCount, expectedParams); int32_t i = 0; diff --git a/src/3rdparty/javascriptcore/VERSION b/src/3rdparty/javascriptcore/VERSION index 6160986..ae70d26 100644 --- a/src/3rdparty/javascriptcore/VERSION +++ b/src/3rdparty/javascriptcore/VERSION @@ -4,8 +4,8 @@ This is a snapshot of JavaScriptCore from The commit imported was from the - jsc-for-qtscript-4.6-staging-24092009 branch/tag + jsc-for-qtscript-4.6-staging-28092009 branch/tag and has the sha1 checksum - 6906f46c84e6b20612db58018334cb6823d0a18a + b98dec961e9389ddd5e10d7c4086de9a297cb984 diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index d5ba589..dccc691 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -67,6 +67,7 @@ const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08, /*! \class QSymbianFbsClient \since 4.6 + \internal Symbian Font And Bitmap server client that is used to lock the global bitmap heap. Only used in @@ -147,6 +148,7 @@ void QSymbianFbsHeapLock::relock() /*! \class QSymbianBitmapDataAccess \since 4.6 + \internal Data access class that is used to locks/unlocks pixel data when drawing or modifying CFbsBitmap pixel data. @@ -725,7 +727,7 @@ void QS60PixmapData::endDataAccess(bool readOnly) const /*! \since 4.6 - Returns a QPixmap that wraps given \c RSgImage \a graphics resource. + Returns a QPixmap that wraps given \a sgImage graphics resource. The data should be valid even when original RSgImage handle has been closed. diff --git a/src/gui/painting/qdrawhelper_mmx.cpp b/src/gui/painting/qdrawhelper_mmx.cpp index 0dcc3dd..d81e2a9 100644 --- a/src/gui/painting/qdrawhelper_mmx.cpp +++ b/src/gui/painting/qdrawhelper_mmx.cpp @@ -128,7 +128,7 @@ void qt_blend_rgb32_on_rgb32_mmx(uchar *destPixels, int dbpl, } } +QT_END_NAMESPACE #endif // QT_HAVE_MMX -QT_END_NAMESPACE diff --git a/src/gui/painting/qdrawhelper_mmx3dnow.cpp b/src/gui/painting/qdrawhelper_mmx3dnow.cpp index 0db89f0..2d40ae3 100644 --- a/src/gui/painting/qdrawhelper_mmx3dnow.cpp +++ b/src/gui/painting/qdrawhelper_mmx3dnow.cpp @@ -101,6 +101,7 @@ void qt_blend_color_argb_mmx3dnow(int count, const QSpan *spans, void *userData) (CompositionFunctionSolid*)qt_functionForModeSolid_MMX3DNOW); } +QT_END_NAMESPACE + #endif // QT_HAVE_3DNOW -QT_END_NAMESPACE diff --git a/src/gui/widgets/qspinbox.cpp b/src/gui/widgets/qspinbox.cpp index e682364..9eb07ac 100644 --- a/src/gui/widgets/qspinbox.cpp +++ b/src/gui/widgets/qspinbox.cpp @@ -61,8 +61,6 @@ QT_BEGIN_NAMESPACE # define QSBDEBUG if (false) qDebug #endif -static bool isIntermediateValueHelper(qint64 num, qint64 minimum, qint64 maximum, qint64 *match = 0); - class QSpinBoxPrivate : public QAbstractSpinBoxPrivate { Q_DECLARE_PUBLIC(QSpinBox) @@ -74,7 +72,6 @@ public: virtual QString textFromValue(const QVariant &n) const; QVariant validateAndInterpret(QString &input, int &pos, QValidator::State &state) const; - bool isIntermediateValue(const QString &str) const; QChar thousand; inline void init() { @@ -90,7 +87,6 @@ class QDoubleSpinBoxPrivate : public QAbstractSpinBoxPrivate public: QDoubleSpinBoxPrivate(QWidget *parent = 0); void emitSignals(EmitPolicy ep, const QVariant &); - bool isIntermediateValue(const QString &str) const; virtual QVariant valueFromText(const QString &n) const; virtual QString textFromValue(const QVariant &n) const; @@ -991,51 +987,6 @@ QVariant QSpinBoxPrivate::valueFromText(const QString &text) const /*! - \internal - - Return true if str can become a number which is between minimum and - maximum or false if this is not possible. -*/ - -bool QSpinBoxPrivate::isIntermediateValue(const QString &str) const -{ - const int num = locale.toInt(str, 0, 10); - const int min = minimum.toInt(); - const int max = maximum.toInt(); - - int numDigits = 0; - int digits[10]; - int tmp = num; - if (tmp == 0) { - numDigits = 1; - digits[0] = 0; - } else { - tmp = num; - for (int i=0; tmp != 0; ++i) { - digits[numDigits++] = qAbs(tmp % 10); - tmp /= 10; - } - } - - int failures = 0; - for (int number=min; /*number<=max*/; ++number) { - tmp = number; - for (int i=0; tmp != 0;) { - if (digits[i] == qAbs(tmp % 10)) { - if (++i == numDigits) - return true; - } - tmp /= 10; - } - if (failures++ == 500000) //upper bound - return true; - if (number == max) // needed for INT_MAX - break; - } - return false; -} - -/*! \internal Multi purpose function that parses input, sets state to the appropriate state and returns the value it will be interpreted as. @@ -1089,9 +1040,8 @@ QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, state = QValidator::Invalid; QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; } else { - state = isIntermediateValue(copy) ? QValidator::Intermediate : QValidator::Invalid; - QSBDEBUG() << __FILE__ << __LINE__<< "state is set to " - << (state == QValidator::Intermediate ? "Intermediate" : "Acceptable"); + state = QValidator::Intermediate; + QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Intermediate"; } } } @@ -1151,105 +1101,6 @@ void QDoubleSpinBoxPrivate::emitSignals(EmitPolicy ep, const QVariant &old) } -bool QDoubleSpinBoxPrivate::isIntermediateValue(const QString &str) const -{ - QSBDEBUG() << "input is" << str << minimum << maximum; - qint64 dec = 1; - for (int i=0; i<decimals; ++i) - dec *= 10; - - const QLatin1Char dot('.'); - - // I know QString::number() uses CLocale so I use dot - const QString minstr = QString::number(minimum.toDouble(), 'f', decimals); - bool ok; - qint64 min_left = minstr.left(minstr.indexOf(dot)).toLongLong(&ok); - if (!ok) - return false; - qint64 min_right = minstr.mid(minstr.indexOf(dot) + 1).toLongLong(); - - const QString maxstr = QString::number(maximum.toDouble(), 'f', decimals); - qint64 max_left = maxstr.left(maxstr.indexOf(dot)).toLongLong(&ok); - if (!ok) - return true; - qint64 max_right = maxstr.mid(maxstr.indexOf(dot) + 1).toLongLong(); - - const int dotindex = str.indexOf(delimiter); - const bool negative = maximum.toDouble() < 0; - qint64 left = 0, right = 0; - bool doleft = true; - bool doright = true; - if (dotindex == -1) { - left = str.toLongLong(); - doright = false; - } else if (dotindex == 0 || (dotindex == 1 && str.at(0) == QLatin1Char('+'))) { - if (negative) { - QSBDEBUG() << __FILE__ << __LINE__ << "returns false"; - return false; - } - doleft = false; - right = str.mid(dotindex + 1).toLongLong(); - } else if (dotindex == 1 && str.at(0) == QLatin1Char('-')) { - if (!negative) { - QSBDEBUG() << __FILE__ << __LINE__ << "returns false"; - return false; - } - doleft = false; - right = str.mid(dotindex + 1).toLongLong(); - } else { - left = str.left(dotindex).toLongLong(); - if (dotindex == str.size() - 1) { - doright = false; - } else { - right = str.mid(dotindex + 1).toLongLong(); - } - } - if ((left >= 0 && max_left < 0 && !str.startsWith(QLatin1Char('-'))) || (left < 0 && min_left >= 0)) { - QSBDEBUG("returns false 0"); - return false; - } - - qint64 match = min_left; - if (doleft && !isIntermediateValueHelper(left, min_left, max_left, &match)) { - QSBDEBUG() << __FILE__ << __LINE__ << "returns false"; - return false; - } - if (doright) { - QSBDEBUG() << "match" << match << "min_left" << min_left << "max_left" << max_left; - if (!doleft) { - if (min_left == max_left) { - const bool ret = isIntermediateValueHelper(qAbs(left), - negative ? max_right : min_right, - negative ? min_right : max_right); - QSBDEBUG() << __FILE__ << __LINE__ << "returns" << ret; - return ret; - } else if (qAbs(max_left - min_left) == 1) { - const bool ret = isIntermediateValueHelper(qAbs(left), min_right, negative ? 0 : dec) - || isIntermediateValueHelper(qAbs(left), negative ? dec : 0, max_right); - QSBDEBUG() << __FILE__ << __LINE__ << "returns" << ret; - return ret; - } else { - const bool ret = isIntermediateValueHelper(qAbs(left), 0, dec); - QSBDEBUG() << __FILE__ << __LINE__ << "returns" << ret; - return ret; - } - } - if (match != min_left) { - min_right = negative ? dec : 0; - } - if (match != max_left) { - max_right = negative ? 0 : dec; - } - qint64 tmpl = negative ? max_right : min_right; - qint64 tmpr = negative ? min_right : max_right; - const bool ret = isIntermediateValueHelper(right, tmpl, tmpr); - QSBDEBUG() << __FILE__ << __LINE__ << "returns" << ret; - return ret; - } - QSBDEBUG() << __FILE__ << __LINE__ << "returns true"; - return true; -} - /*! \internal \reimp @@ -1415,9 +1266,8 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, state = QValidator::Invalid; QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; } else { - state = isIntermediateValue(copy) ? QValidator::Intermediate : QValidator::Invalid; - QSBDEBUG() << __FILE__ << __LINE__<< "state is set to " - << (state == QValidator::Intermediate ? "Intermediate" : "Acceptable"); + state = QValidator::Intermediate; + QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Intermediate"; } } } @@ -1475,62 +1325,6 @@ QString QDoubleSpinBoxPrivate::textFromValue(const QVariant &f) const Use minimum() instead. */ -/*! - \internal Returns whether \a str is a string which value cannot be - parsed but still might turn into something valid. -*/ - -static bool isIntermediateValueHelper(qint64 num, qint64 min, qint64 max, qint64 *match) -{ - QSBDEBUG() << num << min << max; - - if (num >= min && num <= max) { - if (match) - *match = num; - QSBDEBUG("returns true 0"); - return true; - } - qint64 tmp = num; - - int numDigits = 0; - int digits[10]; - if (tmp == 0) { - numDigits = 1; - digits[0] = 0; - } else { - tmp = qAbs(num); - for (int i=0; tmp > 0; ++i) { - digits[numDigits++] = tmp % 10; - tmp /= 10; - } - } - - int failures = 0; - qint64 number; - for (number=max; number>=min; --number) { - tmp = qAbs(number); - for (int i=0; tmp > 0;) { - if (digits[i] == (tmp % 10)) { - if (++i == numDigits) { - if (match) - *match = number; - QSBDEBUG("returns true 1"); - return true; - } - } - tmp /= 10; - } - if (failures++ == 500000) { //upper bound - if (match) - *match = num; - QSBDEBUG("returns true 2"); - return true; - } - } - QSBDEBUG("returns false"); - return false; -} - /*! \reimp */ bool QSpinBox::event(QEvent *event) { diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp index 92e4eb4..6c9761c 100644 --- a/src/gui/widgets/qtabbar.cpp +++ b/src/gui/widgets/qtabbar.cpp @@ -1100,7 +1100,7 @@ QVariant QTabBar::tabData(int index) const } /*! - Returns the visual rectangle of the of the tab at position \a + Returns the visual rectangle of the tab at position \a index, or a null rectangle if \a index is out of range. */ QRect QTabBar::tabRect(int index) const diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp index 5d94dc9..0e5cd1e 100644 --- a/src/network/kernel/qhostaddress.cpp +++ b/src/network/kernel/qhostaddress.cpp @@ -432,6 +432,9 @@ void QNetmaskAddress::setPrefixLength(QAbstractSocket::NetworkLayerProtocol prot using isIPv4Address() or isIPv6Address(), and retrieved with toIPv4Address(), toIPv6Address(), or toString(). + \note Please note that QHostAddress does not do DNS lookups. + QHostInfo is needed for that. + The class also supports common predefined addresses: \l Null, \l LocalHost, \l LocalHostIPv6, \l Broadcast, and \l Any. diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 1768fe6..a2f0179 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -736,7 +736,7 @@ QT_BEGIN_NAMESPACE /*! \fn void QTest::qWaitForWindowShown(QWidget *window) - Waits until the window is shown in the screen. This is mainly useful for + Waits until the \a window is shown in the screen. This is mainly useful for asynchronous systems like X11, where a window will be mapped to screen some time after being asked to show itself on the screen. diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp index cbbab41..6b580df 100644 --- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp +++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp @@ -646,7 +646,7 @@ void tst_Q3SqlCursor::select() } #ifdef QT_DEBUG - // for people too stupid to read docs we had to insert this debugging message. + // Ignore debugging message advising users of a potential pitfall. QTest::ignoreMessage(QtDebugMsg, "Q3SqlCursor::setValue(): This will not affect actual database values. Use primeInsert(), primeUpdate() or primeDelete()."); #endif cur4.setValue( "id", 1 ); diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/qdom/tst_qdom.cpp index 79c0cef..6637202 100644 --- a/tests/auto/qdom/tst_qdom.cpp +++ b/tests/auto/qdom/tst_qdom.cpp @@ -130,6 +130,8 @@ private slots: void setContentWhitespace() const; void setContentWhitespace_data() const; + void taskQTBUG4595_dontAssertWhenDocumentSpecifiesUnknownEncoding() const; + void cleanupTestCase() const; private: @@ -1897,5 +1899,18 @@ void tst_QDom::setContentWhitespace_data() const QTest::newRow("") << QString::fromLatin1("\t\t\t\t<?xml version='1.0' ?><e/>") << false; } +void tst_QDom::taskQTBUG4595_dontAssertWhenDocumentSpecifiesUnknownEncoding() const +{ + QString xmlWithUnknownEncoding("<?xml version='1.0' encoding='unknown-encoding'?>" + "<foo>" + " <bar>How will this sentence be handled?</bar>" + "</foo>"); + QDomDocument d; + QVERIFY(d.setContent(xmlWithUnknownEncoding)); + + QString dontAssert = d.toString(); // this should not assert + QVERIFY(true); +} + QTEST_MAIN(tst_QDom) #include "tst_qdom.moc" diff --git a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp index 502e983..f4ea985 100644 --- a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp @@ -145,6 +145,7 @@ private slots: void task224497_fltMax(); void task221221(); + void task255471_decimalsValidation(); public slots: void valueChangedHelper(const QString &); @@ -668,7 +669,7 @@ void tst_QDoubleSpinBox::valueFromTextAndValidate_data() QTest::addColumn<int>("language"); QTest::addColumn<QString>("expectedText"); // if empty we don't check - QTest::newRow("data0") << QString("2.2") << Invalid << 3.0 << 5.0 << (int)QLocale::C << QString(); + QTest::newRow("data0") << QString("2.2") << Intermediate << 3.0 << 5.0 << (int)QLocale::C << QString(); QTest::newRow("data1") << QString() << Intermediate << 0.0 << 100.0 << (int)QLocale::C << QString(); QTest::newRow("data2") << QString("asd") << Invalid << 0.0 << 100.0 << (int)QLocale::C << QString(); QTest::newRow("data3") << QString("2.2") << Acceptable << 0.0 << 100.0 << (int)QLocale::C << QString(); @@ -685,20 +686,20 @@ void tst_QDoubleSpinBox::valueFromTextAndValidate_data() QTest::newRow("data14") << QString("1, ") << Acceptable << 0.0 << 100.0 << (int)QLocale::Norwegian << QString("1,"); QTest::newRow("data15") << QString("1, ") << Invalid << 0.0 << 100.0 << (int)QLocale::C << QString(); QTest::newRow("data16") << QString("2") << Intermediate << 100.0 << 102.0 << (int)QLocale::C << QString(); - QTest::newRow("data17") << QString("22.0") << Invalid << 100.0 << 102.0 << (int)QLocale::C << QString(); + QTest::newRow("data17") << QString("22.0") << Intermediate << 100.0 << 102.0 << (int)QLocale::C << QString(); QTest::newRow("data18") << QString("12.0") << Intermediate << 100.0 << 102.0 << (int)QLocale::C << QString(); - QTest::newRow("data19") << QString("12.2") << Invalid << 100. << 102.0 << (int)QLocale::C << QString(); - QTest::newRow("data20") << QString("21.") << Invalid << 100.0 << 102.0 << (int)QLocale::C << QString(); - QTest::newRow("data21") << QString("-21.") << Invalid << -102.0 << -100.0 << (int)QLocale::C << QString(); + QTest::newRow("data19") << QString("12.2") << Intermediate << 100. << 102.0 << (int)QLocale::C << QString(); + QTest::newRow("data20") << QString("21.") << Intermediate << 100.0 << 102.0 << (int)QLocale::C << QString(); + QTest::newRow("data21") << QString("-21.") << Intermediate << -102.0 << -100.0 << (int)QLocale::C << QString(); QTest::newRow("data22") << QString("-12.") << Intermediate << -102.0 << -100.0 << (int)QLocale::C << QString(); - QTest::newRow("data23") << QString("-11.11") << Invalid << -102.0 << -101.2 << (int)QLocale::C << QString(); + QTest::newRow("data23") << QString("-11.11") << Intermediate << -102.0 << -101.2 << (int)QLocale::C << QString(); QTest::newRow("data24") << QString("-11.4") << Intermediate << -102.0 << -101.3 << (int)QLocale::C << QString(); QTest::newRow("data25") << QString("11.400") << Invalid << 0.0 << 100.0 << (int)QLocale::C << QString(); QTest::newRow("data26") << QString(".4") << Intermediate << 0.45 << 0.5 << (int)QLocale::C << QString(); QTest::newRow("data27") << QString("+.4") << Intermediate << 0.45 << 0.5 << (int)QLocale::C << QString(); QTest::newRow("data28") << QString("-.4") << Intermediate << -0.5 << -0.45 << (int)QLocale::C << QString(); QTest::newRow("data29") << QString(".4") << Intermediate << 1.0 << 2.4 << (int)QLocale::C << QString(); - QTest::newRow("data30") << QString("-.4") << Invalid << -2.3 << -1.9 << (int)QLocale::C << QString(); + QTest::newRow("data30") << QString("-.4") << Intermediate << -2.3 << -1.9 << (int)QLocale::C << QString(); QTest::newRow("data31") << QString("-42") << Invalid << -2.43 << -1.0 << (int)QLocale::C << QString(); QTest::newRow("data32") << QString("-4") << Invalid << -1.4 << -1.0 << (int)QLocale::C << QString(); QTest::newRow("data33") << QString("-42") << Invalid << -1.4 << -1.0 << (int)QLocale::C << QString(); @@ -712,7 +713,7 @@ void tst_QDoubleSpinBox::valueFromTextAndValidate_data() QTest::newRow("data41") << QString("103.") << Invalid << -102.0 << 11.0 << (int)QLocale::C << QString(); QTest::newRow("data42") << QString("122") << Invalid << 10.0 << 12.2 << (int)QLocale::C << QString(); QTest::newRow("data43") << QString("-2.2") << Intermediate << -12.2 << -3.2 << (int)QLocale::C << QString(); - QTest::newRow("data44") << QString("-2.20") << Invalid << -12.1 << -3.2 << (int)QLocale::C << QString(); + QTest::newRow("data44") << QString("-2.20") << Intermediate << -12.1 << -3.2 << (int)QLocale::C << QString(); QTest::newRow("data45") << QString("200,2") << Invalid << 0.0 << 1000.0 << (int)QLocale::C << QString(); QTest::newRow("data46") << QString("200,2") << Acceptable << 0.0 << 1000.0 << (int)QLocale::German << QString(); QTest::newRow("data47") << QString("2.2") << Acceptable << 0.0 << 1000.0 << (int)QLocale::C << QString(); @@ -1008,6 +1009,31 @@ void tst_QDoubleSpinBox::task221221() QCOMPARE(spin.text(), QLatin1String("1")); } +void tst_QDoubleSpinBox::task255471_decimalsValidation() +{ + // QDoubleSpinBox shouldn't crash with large numbers of decimals. Even if + // the results are useless ;-) + for (int i = 0; i < 32; ++i) + { + QDoubleSpinBox spinBox; + spinBox.setDecimals(i); + spinBox.setMinimum(0.3); + spinBox.setMaximum(12); + + spinBox.show(); + QTRY_VERIFY(spinBox.isVisible()); + spinBox.setFocus(); + QTRY_VERIFY(spinBox.hasFocus()); + + QTest::keyPress(&spinBox, Qt::Key_Right); + QTest::keyPress(&spinBox, Qt::Key_Right); + QTest::keyPress(&spinBox, Qt::Key_Delete); + + // Don't crash! + QTest::keyPress(&spinBox, Qt::Key_2); + } +} + QTEST_MAIN(tst_QDoubleSpinBox) #include "tst_qdoublespinbox.moc" diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 1aa515c..95a038b 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -224,6 +224,8 @@ private slots: void task253415_reconnectUpdateSceneOnSceneChanged(); void task255529_transformationAnchorMouseAndViewportMargins(); void task259503_scrollingArtifacts(); + void QTBUG_4151_clipAndIgnore_data(); + void QTBUG_4151_clipAndIgnore(); }; void tst_QGraphicsView::initTestCase() @@ -3733,5 +3735,50 @@ void tst_QGraphicsView::task259503_scrollingArtifacts() QTest::qWait(10); } +void tst_QGraphicsView::QTBUG_4151_clipAndIgnore_data() +{ + QTest::addColumn<bool>("clip"); + QTest::addColumn<bool>("ignoreTransformations"); + QTest::addColumn<int>("numItems"); + + QTest::newRow("none") << false << false << 3; + QTest::newRow("clip") << true << false << 3; + QTest::newRow("ignore") << false << true << 3; + QTest::newRow("clip+ignore") << true << true << 3; +} + +void tst_QGraphicsView::QTBUG_4151_clipAndIgnore() +{ + QFETCH(bool, clip); + QFETCH(bool, ignoreTransformations); + QFETCH(int, numItems); + + QGraphicsScene scene; + + QGraphicsRectItem *parent = new QGraphicsRectItem(QRectF(0, 0, 50, 50), 0); + QGraphicsRectItem *child = new QGraphicsRectItem(QRectF(-10, -10, 40, 40), parent); + QGraphicsRectItem *ignore = new QGraphicsRectItem(QRectF(60, 60, 50, 50), 0); + + if (clip) + parent->setFlags(QGraphicsItem::ItemClipsChildrenToShape); + if (ignoreTransformations) + ignore->setFlag(QGraphicsItem::ItemIgnoresTransformations); + + parent->setBrush(Qt::red); + child->setBrush(QColor(0, 0, 255, 128)); + ignore->setBrush(Qt::green); + + scene.addItem(parent); + scene.addItem(ignore); + + QGraphicsView view(&scene); + view.setFrameStyle(0); + view.resize(75, 75); + view.show(); + QTRY_COMPARE(QApplication::activeWindow(), (QWidget *)&view); + + QCOMPARE(view.items(view.rect()).size(), numItems); +} + QTEST_MAIN(tst_QGraphicsView) #include "tst_qgraphicsview.moc" diff --git a/tests/auto/qspinbox/tst_qspinbox.cpp b/tests/auto/qspinbox/tst_qspinbox.cpp index 69347c4..4829b6b 100644 --- a/tests/auto/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/qspinbox/tst_qspinbox.cpp @@ -653,21 +653,21 @@ void tst_QSpinBox::valueFromTextAndValidate_data() QTest::addColumn<int>("maxi"); QTest::addColumn<QString>("expectedText"); // if empty we don't check - QTest::newRow("data0") << QString("2") << Invalid << 3 << 5 << QString(); + QTest::newRow("data0") << QString("2") << Intermediate << 3 << 5 << QString(); QTest::newRow("data1") << QString() << Intermediate << 0 << 100 << QString(); QTest::newRow("data2") << QString("asd") << Invalid << 0 << 100 << QString(); QTest::newRow("data3") << QString("2") << Acceptable << 0 << 100 << QString(); QTest::newRow("data4") << QString() << Intermediate << 0 << 1 << QString(); QTest::newRow("data5") << QString() << Invalid << 0 << 0 << QString(); QTest::newRow("data5") << QString("5") << Intermediate << 2004 << 2005 << QString(); - QTest::newRow("data6") << QString("50") << Invalid << 2004 << 2005 << QString(); + QTest::newRow("data6") << QString("50") << Intermediate << 2004 << 2005 << QString(); QTest::newRow("data7") << QString("205") << Intermediate << 2004 << 2005 << QString(); QTest::newRow("data8") << QString("2005") << Acceptable << 2004 << 2005 << QString(); - QTest::newRow("data9") << QString("3") << Invalid << 2004 << 2005 << QString(); + QTest::newRow("data9") << QString("3") << Intermediate << 2004 << 2005 << QString(); QTest::newRow("data10") << QString("-") << Intermediate << -20 << -10 << QString(); QTest::newRow("data11") << QString("-1") << Intermediate << -20 << -10 << QString(); QTest::newRow("data12") << QString("-5") << Intermediate << -20 << -10 << QString(); - QTest::newRow("data13") << QString("-5") << Invalid << -20 << -16 << QString(); + QTest::newRow("data13") << QString("-5") << Intermediate << -20 << -16 << QString(); QTest::newRow("data14") << QString("-2") << Intermediate << -20 << -16 << QString(); QTest::newRow("data15") << QString("2") << Invalid << -20 << -16 << QString(); QTest::newRow("data16") << QString() << Intermediate << -20 << -16 << QString(); diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index 1fae92b..7244d72 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -1742,11 +1742,18 @@ class TestSignalTransition : public QSignalTransition { public: TestSignalTransition(QState *sourceState = 0) - : QSignalTransition(sourceState) {} + : QSignalTransition(sourceState), m_sender(0) + {} TestSignalTransition(QObject *sender, const char *signal, QAbstractState *target) - : QSignalTransition(sender, signal) + : QSignalTransition(sender, signal), m_sender(0) { setTargetState(target); } + QObject *senderReceived() const { + return m_sender; + } + int signalIndexReceived() const { + return m_signalIndex; + } QVariantList argumentsReceived() const { return m_args; } @@ -1755,10 +1762,14 @@ protected: if (!QSignalTransition::eventTest(e)) return false; QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e); - const_cast<TestSignalTransition*>(this)->m_args = se->arguments(); + m_sender = se->sender(); + m_signalIndex = se->signalIndex(); + m_args = se->arguments(); return true; } private: + QObject *m_sender; + int m_signalIndex; QVariantList m_args; }; @@ -1870,6 +1881,8 @@ void tst_QStateMachine::signalTransitions() emitter.emitSignalWithIntArg(123); QTRY_COMPARE(finishedSpy.count(), 1); + QCOMPARE(trans->senderReceived(), (QObject*)&emitter); + QCOMPARE(trans->signalIndexReceived(), emitter.metaObject()->indexOfSignal("signalWithIntArg(int)")); QCOMPARE(trans->argumentsReceived().size(), 1); QCOMPARE(trans->argumentsReceived().at(0).toInt(), 123); } @@ -1890,6 +1903,8 @@ void tst_QStateMachine::signalTransitions() emitter.emitSignalWithStringArg(testString); QTRY_COMPARE(finishedSpy.count(), 1); + QCOMPARE(trans->senderReceived(), (QObject*)&emitter); + QCOMPARE(trans->signalIndexReceived(), emitter.metaObject()->indexOfSignal("signalWithStringArg(QString)")); QCOMPARE(trans->argumentsReceived().size(), 1); QCOMPARE(trans->argumentsReceived().at(0).toString(), testString); } @@ -2028,6 +2043,38 @@ void tst_QStateMachine::signalTransitions() } } +class TestEventTransition : public QEventTransition +{ +public: + TestEventTransition(QState *sourceState = 0) + : QEventTransition(sourceState), + m_eventSource(0), m_eventType(QEvent::None) + {} + TestEventTransition(QObject *object, QEvent::Type type, + QAbstractState *target) + : QEventTransition(object, type), + m_eventSource(0), m_eventType(QEvent::None) + { setTargetState(target); } + QObject *eventSourceReceived() const { + return m_eventSource; + } + QEvent::Type eventTypeReceived() const { + return m_eventType; + } +protected: + bool eventTest(QEvent *e) { + if (!QEventTransition::eventTest(e)) + return false; + QStateMachine::WrappedEvent *we = static_cast<QStateMachine::WrappedEvent*>(e); + m_eventSource = we->object(); + m_eventType = we->event()->type(); + return true; + } +private: + QObject *m_eventSource; + QEvent::Type m_eventType; +}; + void tst_QStateMachine::eventTransitions() { QPushButton button; @@ -2274,6 +2321,30 @@ void tst_QStateMachine::eventTransitions() QTest::ignoreMessage(QtWarningMsg, "QObject event transitions are not supported for custom types"); QTRY_COMPARE(startedSpy.count(), 1); } + // custom transition + { + QStateMachine machine; + QState *s0 = new QState(&machine); + QFinalState *s1 = new QFinalState(&machine); + + TestEventTransition *trans = new TestEventTransition(&button, QEvent::MouseButtonPress, s1); + s0->addTransition(trans); + QCOMPARE(trans->eventSourceReceived(), (QObject*)0); + QCOMPARE(trans->eventTypeReceived(), QEvent::None); + + QSignalSpy finishedSpy(&machine, SIGNAL(finished())); + machine.setInitialState(s0); + machine.start(); + QCoreApplication::processEvents(); + + QTest::mousePress(&button, Qt::LeftButton); + QCoreApplication::processEvents(); + + QTRY_COMPARE(finishedSpy.count(), 1); + + QCOMPARE(trans->eventSourceReceived(), (QObject*)&button); + QCOMPARE(trans->eventTypeReceived(), QEvent::MouseButtonPress); + } } void tst_QStateMachine::historyStates() |