diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-09-08 08:45:57 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-09-08 08:49:39 (GMT) |
commit | fa889cf4b80868249c70715275069eb150b597cc (patch) | |
tree | ab98dc0979d7c2874902e7f2a9812843104e1c49 /tests/auto/qgridlayout | |
parent | deff8fcf0ed060b949c3ec0fa0ec4bd81c253825 (diff) | |
download | Qt-fa889cf4b80868249c70715275069eb150b597cc.zip Qt-fa889cf4b80868249c70715275069eb150b597cc.tar.gz Qt-fa889cf4b80868249c70715275069eb150b597cc.tar.bz2 |
Try to make test more robust.
By using QTRY_{COMPARE,VERIFY} instead of waiting an arbitrary amount of
time waiting for the window manager to do his job.
Also use QApplication::setActiveWindow which seems to be more robust
then QWidget::activateWindow
Diffstat (limited to 'tests/auto/qgridlayout')
-rw-r--r-- | tests/auto/qgridlayout/tst_qgridlayout.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/auto/qgridlayout/tst_qgridlayout.cpp b/tests/auto/qgridlayout/tst_qgridlayout.cpp index 13d79b1..590bafa 100644 --- a/tests/auto/qgridlayout/tst_qgridlayout.cpp +++ b/tests/auto/qgridlayout/tst_qgridlayout.cpp @@ -51,6 +51,8 @@ #include <QtGui/QWindowsStyle> #include <QStyleFactory> +#include "../../shared/util.h" + //TESTED_CLASS= //TESTED_FILES=gui/kernel/qlayout.cpp gui/kernel/qlayout.h @@ -788,8 +790,8 @@ void tst_QGridLayout::minMaxSize_data() QTest::addColumn<QSize>("fixedSize"); //input and expected output QTest::addColumn<SizeInfoList>("sizeinfos"); - - QTest::newRow("3x1 grid, extend to minimumSize") << QString() << 3 << 1 + + QTest::newRow("3x1 grid, extend to minimumSize") << QString() << 3 << 1 << int(QSizePolicy::Minimum) << QSize(152, 50) << (SizeInfoList() << SizeInfo(QRect(10, 10, 43, 30), QSize( 75, 75), QSize(0,0)) << SizeInfo(QRect(10 + 45, 10, 43, 30), QSize(75, 75), QSize( 0, 0)) @@ -917,13 +919,14 @@ void tst_QGridLayout::minMaxSize() #if defined(Q_WS_X11) qt_x11_wait_for_window_manager(m_toplevel); // wait for the show #endif + QTest::qWait(20); m_toplevel->adjustSize(); - QTest::qWait(200); // wait for the implicit adjustSize + QTest::qWait(20); // wait for the implicit adjustSize // If the following fails we might have to wait longer. // If that does not help there is likely a problem with the implicit adjustSize in show() if (!fixedSize.isValid()) { // Note that this can fail if the desktop has large fonts on windows. - QCOMPARE(m_toplevel->size(), m_toplevel->sizeHint()); + QTRY_COMPARE(m_toplevel->size(), m_toplevel->sizeHint()); } // We are relying on the order here... for (int pi = 0; pi < sizehinters.count(); ++pi) { |