diff options
author | Andreas Kling <andreas.kling@nokia.com> | 2010-01-20 08:34:08 (GMT) |
---|---|---|
committer | Andreas Kling <andreas.kling@nokia.com> | 2010-01-20 08:34:08 (GMT) |
commit | 01f733a64e45363e74bea62e4cae8a658bc09383 (patch) | |
tree | ea39b38552a063e7e10bd432b1155a7abae61620 /tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp | |
parent | fdf463ba74b2e00ba5f9db10f43585e8b15054f7 (diff) | |
parent | b906feddf1593a837785bc41d65e837e64d31284 (diff) | |
download | Qt-01f733a64e45363e74bea62e4cae8a658bc09383.zip Qt-01f733a64e45363e74bea62e4cae8a658bc09383.tar.gz Qt-01f733a64e45363e74bea62e4cae8a658bc09383.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6
Diffstat (limited to 'tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp')
-rw-r--r-- | tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp b/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp index b9d9d7e..d846615 100644 --- a/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp +++ b/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp @@ -64,6 +64,7 @@ private slots: void screenNumberForQWidget(); void screenNumberForQPoint(); void availableGeometry(); + void screenGeometry(); }; tst_QDesktopWidget::tst_QDesktopWidget() @@ -98,6 +99,9 @@ void tst_QDesktopWidget::primaryScreen() void tst_QDesktopWidget::availableGeometry() { QDesktopWidget desktop; + QTest::ignoreMessage(QtWarningMsg, "QDesktopWidget::availableGeometry(): Attempt " + "to get the available geometry of a null widget"); + desktop.availableGeometry((QWidget *)0); QRect total; QRect available; @@ -158,6 +162,27 @@ void tst_QDesktopWidget::screenNumberForQPoint() QVERIFY(screen >= 0 && screen < desktopWidget->numScreens()); } +void tst_QDesktopWidget::screenGeometry() +{ + QDesktopWidget *desktopWidget = QApplication::desktop(); + QTest::ignoreMessage(QtWarningMsg, "QDesktopWidget::screenGeometry(): Attempt " + "to get the screen geometry of a null widget"); + QRect r = desktopWidget->screenGeometry((QWidget *)0); + QVERIFY(r.isNull()); + QWidget widget; + widget.show(); + QTest::qWaitForWindowShown(&widget); + r = desktopWidget->screenGeometry(&widget); + + QRect total; + QRect available; + for (int i = 0; i < desktopWidget->screenCount(); ++i) { + total = desktopWidget->screenGeometry(i); + available = desktopWidget->availableGeometry(i); + } + QVERIFY(total.contains(r)); +} + QTEST_MAIN(tst_QDesktopWidget) #include "tst_qdesktopwidget.moc" |