test: Use QWidget::grab() instead of QPixmap::grabWidget()
Removing warnings from the test function as QPixmap::grabWidget() is being deprecated. Change-Id: I26ad1e9def0bebe8e4ee997068ba593245d0cd05 Reviewed-by: Jo Asplin <jo.asplin@nokia.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
parent
26a1b84ae0
commit
780a03191f
@ -1834,7 +1834,7 @@ void tst_QMdiSubWindow::setFont()
|
||||
opt.initFrom(subWindow);
|
||||
const int titleBarHeight = subWindow->style()->pixelMetric(QStyle::PM_TitleBarHeight, &opt);
|
||||
const QRect titleBarRect = QRect(0, 0, subWindow->width(), titleBarHeight);
|
||||
const QImage originalTitleBar = QPixmap::grabWidget(subWindow, titleBarRect).toImage();
|
||||
const QImage originalTitleBar = subWindow->grab(titleBarRect).toImage();
|
||||
|
||||
QFont newFont(QLatin1String("Helvetica"), 16);
|
||||
newFont.setBold(true);
|
||||
@ -1844,13 +1844,13 @@ void tst_QMdiSubWindow::setFont()
|
||||
QCOMPARE(swFont.family(), newFont.family());
|
||||
QCOMPARE(swFont.pointSize(), newFont.pointSize());
|
||||
QCOMPARE(swFont.weight(), newFont.weight());
|
||||
QImage newTitleBar = QPixmap::grabWidget(subWindow, titleBarRect).toImage();
|
||||
QImage newTitleBar = subWindow->grab(titleBarRect).toImage();
|
||||
QVERIFY(newTitleBar != originalTitleBar);
|
||||
|
||||
subWindow->setFont(originalFont);
|
||||
qApp->processEvents();
|
||||
QCOMPARE(subWindow->font(), originalFont);
|
||||
newTitleBar = QPixmap::grabWidget(subWindow, titleBarRect).toImage();
|
||||
newTitleBar = subWindow->grab(titleBarRect).toImage();
|
||||
QCOMPARE(newTitleBar, originalTitleBar);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user