diff options
author | Paul Olav Tvete <paul.tvete@nokia.com> | 2009-09-28 11:56:24 (GMT) |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@nokia.com> | 2009-09-28 11:59:03 (GMT) |
commit | a6e987c07b790493c44c970d99b9822d0fcff85c (patch) | |
tree | 125d927966ddee9111f4d214947537e0b42d6792 /tests/auto/qwidget | |
parent | e058304cc2adc1115ccc3c557b3a16c6e1c1fa86 (diff) | |
download | Qt-a6e987c07b790493c44c970d99b9822d0fcff85c.zip Qt-a6e987c07b790493c44c970d99b9822d0fcff85c.tar.gz Qt-a6e987c07b790493c44c970d99b9822d0fcff85c.tar.bz2 |
Make the test pass on both large and small screens.
Reviewed-by: Joerg
Diffstat (limited to 'tests/auto/qwidget')
-rw-r--r-- | tests/auto/qwidget/tst_qwidget.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index a9fa9bc..4cf9e8f 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -9154,38 +9154,38 @@ void tst_QWidget::destroyBackingStore() void tst_QWidget::rectOutsideCoordinatesLimit_task144779() { - QWidget main; + QApplication::setOverrideCursor(Qt::BlankCursor); //keep the cursor out of screen grabs + QWidget main(0,0,Qt::FramelessWindowHint); //don't get confused by the size of the window frame QPalette palette; palette.setColor(QPalette::Window, Qt::red); main.setPalette(palette); + QDesktopWidget desktop; QRect desktopDimensions = desktop.availableGeometry(&main); - main.setGeometry(desktopDimensions); + QSize mainSize(400, 400); + mainSize = mainSize.boundedTo(desktopDimensions.size()); + main.resize(mainSize); QWidget *offsetWidget = new QWidget(&main); - offsetWidget->setGeometry(0, -14600, desktopDimensions.width(), 15000); + offsetWidget->setGeometry(0, -(15000 - mainSize.height()), mainSize.width(), 15000); // big widget is too big for the coordinates, it must be limited by wrect // if wrect is not at the right position because of offsetWidget, bigwidget // is not painted correctly QWidget *bigWidget = new QWidget(offsetWidget); - - bigWidget->setGeometry(0, 0, desktopDimensions.width(), 50000); + bigWidget->setGeometry(0, 0, mainSize.width(), 50000); palette.setColor(QPalette::Window, Qt::green); bigWidget->setPalette(palette); bigWidget->setAutoFillBackground(true); main.show(); QTest::qWaitForWindowShown(&main); - QTest::qWait(50); - QCursor::setPos(main.pos()); //get the cursor out of the picture - QTest::qWait(50); QPixmap correct(main.size()); correct.fill(Qt::green); - QRect center(desktopDimensions.width()/4,desktopDimensions.width()/4, desktopDimensions.width()/2, desktopDimensions.width()/2); // to avoid the decorations - QTRY_COMPARE(QPixmap::grabWindow(main.winId()).toImage().copy(center), correct.toImage().copy(center)); + QTRY_COMPARE(QPixmap::grabWindow(main.winId()).toImage(), correct.toImage()); + QApplication::restoreOverrideCursor(); } void tst_QWidget::inputFocus_task257832() |