diff options
author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2010-02-11 12:00:44 (GMT) |
---|---|---|
committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2010-02-11 12:00:44 (GMT) |
commit | 86372d8d9bf081b2a1ab2df7942f41309b1842fa (patch) | |
tree | f9faafe776674bd919c319b05a2ff59439e9c608 /tests/auto | |
parent | f11b682818e0d6fbd9cc75ee59b51bc6d6723c19 (diff) | |
parent | 892d4b5e6e9495e29c4df40383e883fc19aa0baa (diff) | |
download | Qt-86372d8d9bf081b2a1ab2df7942f41309b1842fa.zip Qt-86372d8d9bf081b2a1ab2df7942f41309b1842fa.tar.gz Qt-86372d8d9bf081b2a1ab2df7942f41309b1842fa.tar.bz2 |
Merge remote branch 'origin/master' into master-mobility
Conflicts:
tests/auto/qlineedit/tst_qlineedit.cpp
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qdoublevalidator/tst_qdoublevalidator.cpp | 10 | ||||
-rw-r--r-- | tests/auto/qlabel/tst_qlabel.cpp | 24 | ||||
-rw-r--r-- | tests/auto/qlineedit/tst_qlineedit.cpp | 23 | ||||
-rw-r--r-- | tests/auto/qmainwindow/tst_qmainwindow.cpp | 40 | ||||
-rw-r--r-- | tests/auto/qtextedit/tst_qtextedit.cpp | 22 |
5 files changed, 114 insertions, 5 deletions
diff --git a/tests/auto/qdoublevalidator/tst_qdoublevalidator.cpp b/tests/auto/qdoublevalidator/tst_qdoublevalidator.cpp index 37dd6d8..26890b3 100644 --- a/tests/auto/qdoublevalidator/tst_qdoublevalidator.cpp +++ b/tests/auto/qdoublevalidator/tst_qdoublevalidator.cpp @@ -68,7 +68,7 @@ void tst_QDoubleValidator::validateThouSep_data() QTest::addColumn<QString>("value"); QTest::addColumn<QValidator::State>("result"); - QTest::newRow("1,000C") << "C" << QString("1,000") << INV; + QTest::newRow("1,000C") << "C" << QString("1,000") << ACC; QTest::newRow("1.000C") << "C" << QString("1.000") << ACC; QTest::newRow("1,000de") << "de" << QString("1,000") << ACC; @@ -160,9 +160,9 @@ void tst_QDoubleValidator::validate_data() QTest::newRow("data_de0") << "de" << 0.0 << 100.0 << 1 << QString("50,0") << ACC << ACC; QTest::newRow("data_de1") << "de" << 00.0 << 100.0 << 1 << QString("500,0") << ITM << ITM; QTest::newRow("data_de1a") << "de" << 00.0 << 100.0 << 1 << QString("5001,0") << ITM << INV; - QTest::newRow("data_de0C") << "de" << 0.0 << 100.0 << 1 << QString("50.0") << ACC << ACC; - QTest::newRow("data_de1C") << "de" << 00.0 << 100.0 << 1 << QString("500.0") << ITM << ITM; - QTest::newRow("data_de1aC") << "de" << 00.0 << 100.0 << 1 << QString("5001.0") << ITM << INV; + QTest::newRow("data_de0C") << "de" << 0.0 << 100.0 << 1 << QString("50,0") << ACC << ACC; + QTest::newRow("data_de1C") << "de" << 00.0 << 100.0 << 1 << QString("500,0") << ITM << ITM; + QTest::newRow("data_de1aC") << "de" << 00.0 << 100.0 << 1 << QString("5001,0") << ITM << INV; QTest::newRow("data_de2") << "de" << 00.0 << 100.0 << 1 << QString("-35,0") << INV << INV; QTest::newRow("data_de3") << "de" << 00.0 << 100.0 << 1 << QString("a") << INV << INV; QTest::newRow("data_de4") << "de" << 0.0 << 100.0 << 1 << QString("-") << INV << INV; @@ -172,7 +172,7 @@ void tst_QDoubleValidator::validate_data() QTest::newRow("data_de8") << "de" << -100.0 << 100.0 << 1 << QString("-100") << ACC << ACC; QTest::newRow("data_de9") << "de" << -100.0 << -10.0 << 1 << QString("10") << ITM << ITM; QTest::newRow("data_de10") << "de" << 0.3 << 0.5 << 5 << QString("0,34567") << ACC << ACC; - QTest::newRow("data_de11") << "de" << -0.3 << -0.5 << 5 << QString("-0,345678") << INV << INV; + QTest::newRow("data_de11") << "de" << -0.3 << -0.5 << 5 << QString("-0,345678") << ITM << INV; QTest::newRow("data_de12") << "de" << -0.32 << 0.32 << 1 << QString("0") << ACC << ACC; QTest::newRow("data_de13") << "de" << 0.0 << 100.0 << 1 << QString("3456a") << INV << INV; QTest::newRow("data_de14") << "de" << -100.0 << 100.0 << 1 << QString("-3456a") << INV << INV; diff --git a/tests/auto/qlabel/tst_qlabel.cpp b/tests/auto/qlabel/tst_qlabel.cpp index 7099917..153149e7 100644 --- a/tests/auto/qlabel/tst_qlabel.cpp +++ b/tests/auto/qlabel/tst_qlabel.cpp @@ -121,6 +121,10 @@ private slots: void mnemonic(); void selection(); +#ifndef QT_NO_CONTEXTMENU + void taskQTBUG_7902_contextMenuCrash(); +#endif + private: QLabel *testWidget; QPointer<Widget> test_box; @@ -582,5 +586,25 @@ void tst_QLabel::selection() QCOMPARE(label.selectionStart(), 6); } +#ifndef QT_NO_CONTEXTMENU +void tst_QLabel::taskQTBUG_7902_contextMenuCrash() +{ + QLabel *w = new QLabel("Test or crash?"); + w->setTextInteractionFlags(Qt::TextSelectableByMouse); + w->show(); + QTest::qWaitForWindowShown(w); + + QTimer ti; + w->connect(&ti, SIGNAL(timeout()), w, SLOT(deleteLater())); + ti.start(300); + + QContextMenuEvent *cme = new QContextMenuEvent(QContextMenuEvent::Mouse, w->rect().center()); + qApp->postEvent(w, cme); + + QTest::qWait(350); + // No crash, it's allright. +} +#endif + QTEST_MAIN(tst_QLabel) #include "tst_qlabel.moc" diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index ca84b38..2be68e6 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -272,6 +272,9 @@ private slots: void taskQTBUG_4679_moveToStartEndOfBlock(); void taskQTBUG_4679_selectToStartEndOfBlock(); void taskQTBUG_7395_readOnlyShortcut(); +#ifndef QT_NO_CONTEXTMENU + void taskQTBUG_7902_contextMenuCrash(); +#endif protected slots: #ifdef QT3_SUPPORT @@ -3658,5 +3661,25 @@ void tst_QLineEdit::taskQTBUG_7395_readOnlyShortcut() QCOMPARE(spy.count(), 1); } +#ifndef QT_NO_CONTEXTMENU +void tst_QLineEdit::taskQTBUG_7902_contextMenuCrash() +{ + // Would pass before the associated commit, but left as a guard. + QLineEdit *w = new QLineEdit; + w->show(); + QTest::qWaitForWindowShown(w); + + QTimer ti; + w->connect(&ti, SIGNAL(timeout()), w, SLOT(deleteLater())); + ti.start(200); + + QContextMenuEvent *cme = new QContextMenuEvent(QContextMenuEvent::Mouse, w->rect().center()); + qApp->postEvent(w, cme); + + QTest::qWait(300); + // No crash, it's allright. +} +#endif + QTEST_MAIN(tst_QLineEdit) #include "tst_qlineedit.moc" diff --git a/tests/auto/qmainwindow/tst_qmainwindow.cpp b/tests/auto/qmainwindow/tst_qmainwindow.cpp index b1c44be..1273e85 100644 --- a/tests/auto/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/qmainwindow/tst_qmainwindow.cpp @@ -108,6 +108,7 @@ private slots: void addToolbarAfterShow(); void centralWidgetSize(); void dockWidgetSize(); + void QTBUG2774_stylechange(); }; // Testing get/set functions @@ -1709,6 +1710,45 @@ void tst_QMainWindow::dockWidgetSize() } } +void tst_QMainWindow::QTBUG2774_stylechange() +{ + + QMainWindow mw; + QDockWidget *dockw = new QDockWidget(); + mw.addDockWidget(Qt::LeftDockWidgetArea, dockw); + mw.addDockWidget(Qt::LeftDockWidgetArea, new QDockWidget()); + QTextEdit *central = new QTextEdit(&mw); + mw.setCentralWidget(central); + dockw->resize(10,10); + mw.show(); + QTest::qWaitForWindowShown(&mw); + int centralOriginalWidth = central->width(); + + QVERIFY(!mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height() - 3))); + QVERIFY( mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height()))); + QVERIFY(!mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height() + 30))); + + + { + QTest::qWait(1000); + mw.setStyleSheet("QMainWindow::separator { width: 50px; height:50px; }"); + QTest::qWait(5000); + QApplication::processEvents(); + QVERIFY(central->width() < centralOriginalWidth); + QVERIFY( mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height()))); + QVERIFY( mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height() + 49))); + } + + { + mw.setStyleSheet("QMainWindow::separator { width: 0px; height: 0px; }"); + QApplication::processEvents(); + QVERIFY(central->width() > centralOriginalWidth); + QVERIFY(!mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height()))); + QVERIFY(!mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height() + 1))); + } +} + + QTEST_MAIN(tst_QMainWindow) #include "tst_qmainwindow.moc" diff --git a/tests/auto/qtextedit/tst_qtextedit.cpp b/tests/auto/qtextedit/tst_qtextedit.cpp index deb9379..101baa5 100644 --- a/tests/auto/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/qtextedit/tst_qtextedit.cpp @@ -201,6 +201,9 @@ private slots: void noWrapBackgrounds(); void preserveCharFormatAfterUnchangingSetPosition(); void twoSameInputMethodEvents(); +#ifndef QT_NO_CONTEXTMENU + void taskQTBUG_7902_contextMenuCrash(); +#endif private: void createSelection(); @@ -2202,5 +2205,24 @@ void tst_QTextEdit::twoSameInputMethodEvents() QCOMPARE(ed->document()->firstBlock().layout()->lineCount(), 1); } +#ifndef QT_NO_CONTEXTMENU +void tst_QTextEdit::taskQTBUG_7902_contextMenuCrash() +{ + QTextEdit *w = new QTextEdit; + w->show(); + QTest::qWaitForWindowShown(w); + + QTimer ti; + w->connect(&ti, SIGNAL(timeout()), w, SLOT(deleteLater())); + ti.start(200); + + QContextMenuEvent *cme = new QContextMenuEvent(QContextMenuEvent::Mouse, w->rect().center()); + qApp->postEvent(w->viewport(), cme); + + QTest::qWait(300); + // No crash, it's allright. +} +#endif + QTEST_MAIN(tst_QTextEdit) #include "tst_qtextedit.moc" |