diff options
author | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-09-28 13:00:54 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-09-28 13:00:54 (GMT) |
commit | f3a36a7e59b24bc388ed15372f941bf649bc5ae4 (patch) | |
tree | 5486e561a12afc189ad0451c4cadf0f85e105328 /tests | |
parent | b0885663f2192eb5eb27f8a8032e7e05b19e3736 (diff) | |
parent | f9d6862d13ae38c59ec4a58092c8126620801e0b (diff) | |
download | Qt-f3a36a7e59b24bc388ed15372f941bf649bc5ae4.zip Qt-f3a36a7e59b24bc388ed15372f941bf649bc5ae4.tar.gz Qt-f3a36a7e59b24bc388ed15372f941bf649bc5ae4.tar.bz2 |
Merge commit 'origin/4.5' into 4.6
Reviewed-by: Joao
Conflicts:
src/gui/graphicsview/qgraphicsview.cpp
src/gui/widgets/qspinbox.cpp
tests/auto/qgraphicsview/tst_qgraphicsview.cpp
Diffstat (limited to 'tests')
-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 |
5 files changed, 101 insertions, 13 deletions
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(); |