From 079dde144fd372ba76a5639fe69fca4e13c91ad7 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 16:04:31 +1000 Subject: Remove mention of Q_ASSERT in comments This will make it easier to check for stray Q_ASSERT's in the future. Change-Id: I5ddafe1bf26819566460920deae8ff448008c93f Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit b2db13f245f09f1d14af64d2199284c78cbb5b6e) --- tests/auto/qwidget/tst_qwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto/qwidget/tst_qwidget.cpp') diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index f282b5d7d3..9ce0849c4d 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -10422,7 +10422,7 @@ void tst_QWidget::taskQTBUG_7532_tabOrderWithFocusProxy() w.setFocusProxy(fp); QWidget::setTabOrder(&w, fp); - // No Q_ASSERT, then it's allright. + // In debug mode, no assertion failure means it's alright. } void tst_QWidget::movedAndResizedAttributes() -- cgit v1.2.3 From 6e50394c4eac9b3e91f6df7e944181cf7f54b0fe Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 18 May 2011 10:44:47 +1000 Subject: Reduce usage of Q_ASSERT in autotests. Using Q_ASSERT does nothing in release-mode builds, and in debug builds it causes tests to terminate prematurely. It is much better to use QVERIFY or QCOMPARE. Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit 3475168550c1a804f04f2a4edfeb30c04cd36551) Change-Id: Ic39972b685ca35a9a71d9c8d03e8dae31481fb19 --- tests/auto/qwidget/tst_qwidget.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tests/auto/qwidget/tst_qwidget.cpp') diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 9ce0849c4d..e9cb480b9b 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -7234,8 +7234,7 @@ void tst_QWidget::render_systemClip2() QFETCH(bool, usePaintEvent); QFETCH(QColor, expectedColor); - Q_ASSERT_X(expectedColor != QColor(Qt::red), Q_FUNC_INFO, - "Qt::red is the reference color for the image, pick another color"); + QVERIFY2(expectedColor != QColor(Qt::red), "Qt::red is the reference color for the image, pick another color"); class MyWidget : public QWidget { -- cgit v1.2.3 From 49babe02f0a00fe2baff3950fbdcb725ce20d772 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 17 May 2011 13:43:30 +1000 Subject: Remove autotest code for Qt3Support library. This commit deals with the simple cases -- mostly just removing blocks of code enclosed in #ifdef QT3_SUPPORT. Later commits will deal with the trickier cases. Change-Id: I280dea25b3754be175efe62fc7e5e4e7c304e658 Task-number: QTBUG-19325 Reviewed-by: Rohan McGovern --- tests/auto/qwidget/tst_qwidget.cpp | 131 +------------------------------------ 1 file changed, 1 insertion(+), 130 deletions(-) (limited to 'tests/auto/qwidget/tst_qwidget.cpp') diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index e9cb480b9b..8bafd4d8ee 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -40,10 +40,6 @@ ****************************************************************************/ -#if defined(QT3_SUPPORT) -#include -#include -#endif #include #include #include @@ -169,7 +165,6 @@ public: tst_QWidget(); virtual ~tst_QWidget(); - public slots: void initTestCase(); void cleanupTestCase(); @@ -189,10 +184,8 @@ private slots: void isVisibleTo(); void isHidden(); void fonts(); - void mapToGlobal(); void mapFromAndTo_data(); void mapFromAndTo(); - void checkFocus(); void focusChainOnHide(); void focusChainOnReparent(); void setTabOrder(); @@ -650,9 +643,6 @@ void tst_QWidget::initTestCase() // Create the test class testWidget = new BezierViewer( 0, "testObject"); testWidget->resize(200,200); -#ifdef QT3_SUPPORT - qApp->setMainWidget(testWidget); -#endif testWidget->show(); QTest::qWaitForWindowShown(testWidget); QTest::qWait(50); @@ -1343,27 +1333,6 @@ void tst_QWidget::fonts() QVERIFY( cleanTestWidget->font() == originalFont ); } -void tst_QWidget::mapToGlobal() -{ -#if !defined(QT3_SUPPORT) - QSKIP("No Qt3 Support", SkipAll); -#else - QPoint vis = testWidget->mapToGlobal(QPoint(0,0)); - testWidget->hide(); - QCOMPARE(testWidget->mapToGlobal(QPoint(0,0)), vis); - testWidget->show(); - - // test in a layout and witha move - Q3HBox * qhb = new Q3HBox(testWidget); - QWidget * qw = new QWidget(qhb); - qw->move(6,12); - QPoint wVis = qw->mapToGlobal(QPoint(0,0)); - qw->hide(); - QCOMPARE(qw->mapToGlobal(QPoint(0,0)), wVis); - delete qhb; -#endif // QT3_SUPPORT -} - void tst_QWidget::mapFromAndTo_data() { QTest::addColumn("windowHidden"); @@ -1654,36 +1623,6 @@ void tst_QWidget::focusChainOnHide() testWidget->show(); //don't disturb later tests } -void tst_QWidget::checkFocus() -{ -#if !defined(QT3_SUPPORT) - QSKIP("No Qt3 Support", SkipAll); -#else - // This is a very specific test for a specific bug, the bug was - // that when setEnabled(FALSE) then setEnabled(TRUE) was called on - // the parent of a child widget which had focus while hidden, then - // when the widget was shown, the focus would be in the wrong place. - - Q3HBox widget; - QLineEdit *focusWidget = new QLineEdit( &widget ); - new QLineEdit( &widget ); - new QPushButton( &widget ); - focusWidget->setFocus(); - widget.setEnabled( FALSE ); - widget.setEnabled( TRUE ); - widget.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&widget); -#endif - QTest::qWait( 100 ); - widget.activateWindow(); - // next call is necessary since the window manager may not give the focus to the widget when - // it is shown, which causes the QVERIFY to fail - QApplication::setActiveWindow(&widget); - QVERIFY( qApp->focusWidget() == focusWidget ); -#endif // QT3_SUPPORT -} - class Container : public QWidget { public: @@ -2014,28 +1953,6 @@ void tst_QWidget::showMaximized() widget.showMaximized(); QTRY_VERIFY(widget.size().width() > 20 && widget.size().height() > 20); } - -#ifdef QT3_SUPPORT -#if !defined(Q_WS_QWS) -//embedded respects max/min sizes by design -- maybe wrong design, but that's the way it is now. - { - Q3HBox box; - QWidget widget(&box); - widget.setMinimumSize(500, 500); - box.showMaximized(); - QVERIFY(box.isMaximized()); - } - - { - Q3HBox box; - QWidget widget(&box); - widget.setMaximumSize(500, 500); - - box.showMaximized(); - QVERIFY(box.isMaximized()); - } -#endif -#endif // QT3_SUPPORT } void tst_QWidget::showFullScreen() @@ -2107,28 +2024,6 @@ void tst_QWidget::showFullScreen() widget.showFullScreen(); QVERIFY(widget.isFullScreen()); } - -#ifdef QT3_SUPPORT -#if !defined(Q_WS_QWS) -//embedded respects max/min sizes by design -- maybe wrong design, but that's the way it is now. - { - Q3HBox box; - QWidget widget(&box); - widget.setMinimumSize(500, 500); - box.showFullScreen(); - QVERIFY(box.isFullScreen()); - } - - { - Q3HBox box; - QWidget widget(&box); - widget.setMaximumSize(500, 500); - - box.showFullScreen(); - QVERIFY(box.isFullScreen()); - } -#endif -#endif // QT3_SUPPORT } class ResizeWidget : public QWidget { @@ -6374,11 +6269,6 @@ void tst_QWidget::compatibilityChildInsertedEvents() QCoreApplication::sendPostedEvents(); expected = EventRecorder::EventList() -#ifdef QT_HAS_QT3SUPPORT - << qMakePair(&widget, QEvent::ChildInsertedRequest) - << qMakePair(&widget, QEvent::ChildInserted) - << qMakePair(&widget, QEvent::ChildInserted) -#endif << qMakePair(&widget, QEvent::PolishRequest) << qMakePair(&widget, QEvent::Polish) << qMakePair(&widget, QEvent::ChildPolished) @@ -6414,10 +6304,6 @@ void tst_QWidget::compatibilityChildInsertedEvents() EventRecorder::EventList() << qMakePair(&widget, QEvent::WinIdChange) << qMakePair(&widget, QEvent::Polish) -#ifdef QT_HAS_QT3SUPPORT - << qMakePair(&widget, QEvent::ChildInserted) - << qMakePair(&widget, QEvent::ChildInserted) -#endif << qMakePair(&widget, QEvent::ChildPolished) << qMakePair(&widget, QEvent::ChildPolished) << qMakePair(&widget, QEvent::Move) @@ -6433,9 +6319,6 @@ void tst_QWidget::compatibilityChildInsertedEvents() QCoreApplication::sendPostedEvents(); expected = EventRecorder::EventList() -#ifdef QT_HAS_QT3SUPPORT - << qMakePair(&widget, QEvent::ChildInsertedRequest) -#endif << qMakePair(&widget, QEvent::PolishRequest) << qMakePair(&widget, QEvent::Type(QEvent::User + 1)) << qMakePair(&widget, QEvent::Type(QEvent::User + 2)); @@ -6476,10 +6359,6 @@ void tst_QWidget::compatibilityChildInsertedEvents() QCoreApplication::sendPostedEvents(); expected = EventRecorder::EventList() -#ifdef QT_HAS_QT3SUPPORT - << qMakePair(&widget, QEvent::ChildInsertedRequest) - << qMakePair(&widget, QEvent::ChildInserted) -#endif << qMakePair(&widget, QEvent::PolishRequest) << qMakePair(&widget, QEvent::Polish) << qMakePair(&widget, QEvent::ChildPolished) @@ -6516,9 +6395,6 @@ void tst_QWidget::compatibilityChildInsertedEvents() EventRecorder::EventList() << qMakePair(&widget, QEvent::WinIdChange) << qMakePair(&widget, QEvent::Polish) -#ifdef QT_HAS_QT3SUPPORT - << qMakePair(&widget, QEvent::ChildInserted) -#endif << qMakePair(&widget, QEvent::ChildPolished) << qMakePair(&widget, QEvent::Move) << qMakePair(&widget, QEvent::Resize) @@ -6533,9 +6409,6 @@ void tst_QWidget::compatibilityChildInsertedEvents() QCoreApplication::sendPostedEvents(); expected = EventRecorder::EventList() -#ifdef QT_HAS_QT3SUPPORT - << qMakePair(&widget, QEvent::ChildInsertedRequest) -#endif << qMakePair(&widget, QEvent::PolishRequest) << qMakePair(&widget, QEvent::Type(QEvent::User + 1)) << qMakePair(&widget, QEvent::Type(QEvent::User + 2)); @@ -6996,9 +6869,7 @@ void tst_QWidget::renderWithPainter() void tst_QWidget::render_task188133() { QMainWindow mainWindow; -#if defined(QT3_SUPPORT) - mainWindow.setCentralWidget(new Q3TextEdit); -#endif + // Make sure QWidget::render does not trigger QWidget::repaint/update // and asserts for Qt::WA_WState_Created. QPixmap pixmap = QPixmap::grabWidget(&mainWindow); -- cgit v1.2.3