Tests: Replace deprecated QPixmap::grabWidget() by QWidget::grab().
Change-Id: I5018cf5dd51c1781e7f17c7d205f3f60de7945be Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>bb10
parent
195df6e8e0
commit
6ae168f8ce
|
|
@ -444,7 +444,7 @@ void tst_QPixmap::fill_data()
|
|||
if (pm.x11PictureHandle()) {
|
||||
#elif defined (Q_OS_WINCE)
|
||||
QPixmap pixmap(1,1);
|
||||
if (QPixmap::grabWidget(QApplication::desktop()).depth() >= 24) {
|
||||
if (QApplication::desktop()->grab().depth() >= 24) {
|
||||
#else
|
||||
QPixmap pixmap(1, 1); {
|
||||
#endif
|
||||
|
|
@ -742,7 +742,7 @@ void tst_QPixmap::grabWindow()
|
|||
child.setAutoFillBackground(true);
|
||||
child.show();
|
||||
QTest::qWait(20);
|
||||
const QPixmap grabWidgetPixmap = QPixmap::grabWidget(&child);
|
||||
const QPixmap grabWidgetPixmap = child.grab();
|
||||
const WId childWinId = child.winId(); // Create native child
|
||||
QVERIFY(QTest::qWaitForWindowExposed(child.windowHandle()));
|
||||
const QPixmap grabWindowPixmap = QPixmap::grabWindow(childWinId);
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ void tst_BaselineExample::testBasicUsage()
|
|||
b.resize(100, 50);
|
||||
b.show();
|
||||
QTest::qWaitForWindowShown(&b);
|
||||
QImage img1 = QPixmap::grabWidget(&b).toImage();
|
||||
QImage img1 = b.grab().toImage();
|
||||
QVERIFY(!img1.isNull());
|
||||
|
||||
// Compare it to baseline on server:
|
||||
|
|
@ -85,11 +85,11 @@ void tst_BaselineExample::testMultipleImages()
|
|||
b.resize(100, 50);
|
||||
b.show();
|
||||
QTest::qWaitForWindowShown(&b);
|
||||
QBASELINE_CHECK(QPixmap::grabWidget(&b).toImage(), "text1");
|
||||
QBASELINE_CHECK(b.grab().toImage(), "text1");
|
||||
|
||||
b.setText("Kick me!");
|
||||
QTest::qWait(50);
|
||||
QBASELINE_CHECK(QPixmap::grabWidget(&b).toImage(), "text2");
|
||||
QBASELINE_CHECK(b.grab().toImage(), "text2");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ void tst_BaselineExample::testDataDriven()
|
|||
b.resize(100, 50);
|
||||
b.show();
|
||||
QTest::qWaitForWindowShown(&b);
|
||||
QBASELINE_TEST(QPixmap::grabWidget(&b).toImage());
|
||||
QBASELINE_TEST(b.grab().toImage());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ void tst_BaselineExample::testDataDrivenChecksum()
|
|||
b.resize(100, 50);
|
||||
b.show();
|
||||
QTest::qWaitForWindowShown(&b);
|
||||
QBASELINE_TEST(QPixmap::grabWidget(&b).toImage());
|
||||
QBASELINE_TEST(b.grab().toImage());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@
|
|||
|
||||
static QImage grabWidget(QWidget *window)
|
||||
{
|
||||
return QPixmap::grabWidget(window).toImage();
|
||||
return window->grab().toImage();
|
||||
}
|
||||
|
||||
class tst_QWizard : public QObject
|
||||
|
|
@ -1794,8 +1794,8 @@ public:
|
|||
|
||||
QImage createImage() const
|
||||
{
|
||||
return QPixmap::grabWidget(const_cast<TestWizard *>(this))
|
||||
.toImage().convertToFormat(QImage::Format_ARGB32);
|
||||
return const_cast<TestWizard *>(this)->grab()
|
||||
.toImage().convertToFormat(QImage::Format_ARGB32);
|
||||
}
|
||||
|
||||
QString operationsDescription() const { return opsDescr; }
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ void tst_QStyle::drawItemPixmap()
|
|||
testWidget->show();
|
||||
|
||||
QPixmap p(QString(SRCDIR) + "/task_25863.png", "PNG");
|
||||
QPixmap actualPix = QPixmap::grabWidget(testWidget);
|
||||
const QPixmap actualPix = testWidget->grab();
|
||||
|
||||
QCOMPARE(actualPix, p);
|
||||
testWidget->hide();
|
||||
|
|
@ -473,7 +473,7 @@ qDebug("TEST PAINTING");
|
|||
menu.show();
|
||||
menu.addAction(new QAction("Test 1", &menu));
|
||||
menu.addAction(new QAction("Test 2", &menu));
|
||||
QPixmap pixmap = QPixmap::grabWidget(&menu);
|
||||
QPixmap pixmap = menu.grab();
|
||||
comparePixmap(fileName, pixmap);
|
||||
|
||||
//Push button
|
||||
|
|
@ -481,7 +481,7 @@ qDebug("TEST PAINTING");
|
|||
QPushButton button("OK");
|
||||
button.setStyle(style);
|
||||
button.show();
|
||||
pixmap = QPixmap::grabWidget(&button);
|
||||
pixmap = button.grab();
|
||||
button.hide();
|
||||
comparePixmap(fileName, pixmap);
|
||||
|
||||
|
|
@ -490,7 +490,7 @@ qDebug("TEST PAINTING");
|
|||
QRadioButton radiobutton("Check");
|
||||
radiobutton.setStyle(style);
|
||||
radiobutton.show();
|
||||
pixmap = QPixmap::grabWidget(&radiobutton);
|
||||
pixmap = radiobutton.grab();
|
||||
radiobutton.hide();
|
||||
comparePixmap(fileName, pixmap);
|
||||
|
||||
|
|
@ -501,7 +501,7 @@ qDebug("TEST PAINTING");
|
|||
combobox.addItem("Test 1");
|
||||
combobox.addItem("Test 2");
|
||||
combobox.show();
|
||||
pixmap = QPixmap::grabWidget(&combobox);
|
||||
pixmap = combobox.grab();
|
||||
combobox.hide();
|
||||
comparePixmap(fileName, pixmap);
|
||||
|
||||
|
|
@ -511,7 +511,7 @@ qDebug("TEST PAINTING");
|
|||
spinbox.setLocale(QLocale(QLocale::English, QLocale::UnitedStates));
|
||||
spinbox.setStyle(style);
|
||||
spinbox.show();
|
||||
pixmap = QPixmap::grabWidget(&spinbox);
|
||||
pixmap = spinbox.grab();
|
||||
spinbox.hide();
|
||||
comparePixmap(fileName, pixmap);
|
||||
QLocale::setDefault(QLocale::system());
|
||||
|
|
@ -521,7 +521,7 @@ qDebug("TEST PAINTING");
|
|||
QSlider slider;
|
||||
slider.setStyle(style);
|
||||
slider.show();
|
||||
pixmap = QPixmap::grabWidget(&slider);
|
||||
pixmap = slider.grab();
|
||||
slider.hide();
|
||||
comparePixmap(fileName, pixmap);
|
||||
|
||||
|
|
@ -530,7 +530,7 @@ qDebug("TEST PAINTING");
|
|||
QLineEdit lineedit("Test text");
|
||||
lineedit.setStyle(style);
|
||||
lineedit.show();
|
||||
pixmap = QPixmap::grabWidget(&lineedit);
|
||||
pixmap = lineedit.grab();
|
||||
lineedit.hide();
|
||||
comparePixmap(fileName, pixmap);
|
||||
|
||||
|
|
@ -541,7 +541,7 @@ qDebug("TEST PAINTING");
|
|||
mdiArea.resize(200, 200);
|
||||
mdiArea.setStyle(style);
|
||||
mdiArea.show();
|
||||
pixmap = QPixmap::grabWidget(&mdiArea);
|
||||
pixmap = mdiArea.grab();
|
||||
mdiArea.hide();
|
||||
comparePixmap(fileName, pixmap);
|
||||
|
||||
|
|
@ -553,7 +553,7 @@ qDebug("TEST PAINTING");
|
|||
tb.setIcon(style->standardPixmap(QStyle::SP_DirHomeIcon));
|
||||
tb.setStyle(style);
|
||||
tb.show();
|
||||
pixmap = QPixmap::grabWidget(&tb);
|
||||
pixmap = tb.grab();
|
||||
tb.hide();
|
||||
comparePixmap(fileName, pixmap);
|
||||
|
||||
|
|
@ -772,7 +772,7 @@ void tst_QStyle::testDrawingShortcuts()
|
|||
DrawTextStyle *dts = new DrawTextStyle;
|
||||
w.show();
|
||||
tb->setStyle(dts);
|
||||
QPixmap::grabWidget(tb);
|
||||
tb->grab();
|
||||
QStyleOptionToolButton sotb;
|
||||
sotb.initFrom(tb);
|
||||
bool showMnemonic = dts->styleHint(QStyle::SH_UnderlineShortcut, &sotb, tb);
|
||||
|
|
@ -787,7 +787,7 @@ void tst_QStyle::testDrawingShortcuts()
|
|||
w.addWidget(tb);
|
||||
w.show();
|
||||
tb->setStyle(dts);
|
||||
QPixmap::grabWidget(tb);
|
||||
tb->grab();
|
||||
QStyleOptionToolButton sotb;
|
||||
sotb.initFrom(tb);
|
||||
bool showMnemonic = dts->styleHint(QStyle::SH_UnderlineShortcut, &sotb, tb);
|
||||
|
|
|
|||
|
|
@ -2196,7 +2196,7 @@ void tst_QTextEdit::noWrapBackgrounds()
|
|||
layout->addWidget(&edit);
|
||||
topLevel.show();
|
||||
|
||||
QImage img = QPixmap::grabWidget(edit.viewport()).toImage();
|
||||
const QImage img = edit.viewport()->grab().toImage();
|
||||
QCOMPARE(img, img.mirrored(true, false));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue