tst_QStyle: Remove unused baseline images (Windows Vista/macOS)
The test contained outdated baseline images for 1) Windows Vista: They were only used for OS version Vista and do not match any more. 2) macOS: They were apparently were not in use any more Remove the testing and image comparison code. Task-number: QTBUG-76493 Change-Id: I91cec5113db8d1845b43f97ad2987e63d9f86ac7 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>bb10
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 953 B |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 722 B |
|
Before Width: | Height: | Size: 809 B |
|
Before Width: | Height: | Size: 530 B |
|
Before Width: | Height: | Size: 646 B |
|
Before Width: | Height: | Size: 844 B |
|
Before Width: | Height: | Size: 575 B |
|
Before Width: | Height: | Size: 583 B |
|
|
@ -2,8 +2,3 @@ CONFIG += testcase
|
|||
TARGET = tst_qstyle
|
||||
QT += widgets testlib testlib-private
|
||||
SOURCES += tst_qstyle.cpp
|
||||
|
||||
android:!android-embedded {
|
||||
RESOURCES += \
|
||||
testdata.qrc
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>images/mac/button.png</file>
|
||||
<file>images/mac/combobox.png</file>
|
||||
<file>images/mac/lineedit.png</file>
|
||||
<file>images/mac/mdi.png</file>
|
||||
<file>images/mac/menu.png</file>
|
||||
<file>images/mac/radiobutton.png</file>
|
||||
<file>images/mac/slider.png</file>
|
||||
<file>images/mac/spinbox.png</file>
|
||||
<file>images/vista/button.png</file>
|
||||
<file>images/vista/combobox.png</file>
|
||||
<file>images/vista/lineedit.png</file>
|
||||
<file>images/vista/menu.png</file>
|
||||
<file>images/vista/radiobutton.png</file>
|
||||
<file>images/vista/slider.png</file>
|
||||
<file>images/vista/spinbox.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
@ -73,7 +73,6 @@ public:
|
|||
private:
|
||||
bool testAllFunctions(QStyle *);
|
||||
bool testScrollBarSubControls();
|
||||
void testPainting(QStyle *style, const QString &platform);
|
||||
private slots:
|
||||
void drawItemPixmap();
|
||||
void init();
|
||||
|
|
@ -333,141 +332,15 @@ void tst_QStyle::testWindowsStyle()
|
|||
delete wstyle;
|
||||
}
|
||||
|
||||
void writeImage(const QString &fileName, QImage image)
|
||||
{
|
||||
QImageWriter imageWriter(fileName);
|
||||
imageWriter.setFormat("png");
|
||||
qDebug() << "result " << imageWriter.write(image);
|
||||
}
|
||||
|
||||
QImage readImage(const QString &fileName)
|
||||
{
|
||||
QImageReader reader(fileName);
|
||||
return reader.read();
|
||||
}
|
||||
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSVISTA) && !defined(Q_OS_WINRT)
|
||||
void tst_QStyle::testWindowsVistaStyle()
|
||||
{
|
||||
QStyle *vistastyle = QStyleFactory::create("WindowsVista");
|
||||
QVERIFY(testAllFunctions(vistastyle));
|
||||
|
||||
if (QOperatingSystemVersion::current().majorVersion()
|
||||
== QOperatingSystemVersion::WindowsVista.majorVersion()
|
||||
&& QOperatingSystemVersion::current().minorVersion()
|
||||
== QOperatingSystemVersion::WindowsVista.minorVersion())
|
||||
testPainting(vistastyle, "vista");
|
||||
delete vistastyle;
|
||||
}
|
||||
#endif
|
||||
|
||||
void comparePixmap(const QString &filename, const QPixmap &pixmap)
|
||||
{
|
||||
QImage oldFile = readImage(filename);
|
||||
QPixmap oldPixmap = QPixmap::fromImage(oldFile);
|
||||
if (!oldFile.isNull())
|
||||
QCOMPARE(pixmap, oldPixmap);
|
||||
else
|
||||
writeImage(filename, pixmap.toImage());
|
||||
}
|
||||
|
||||
void tst_QStyle::testPainting(QStyle *style, const QString &platform)
|
||||
{
|
||||
qDebug("TEST PAINTING");
|
||||
//Test Menu
|
||||
QString fileName = "images/" + platform + "/menu.png";
|
||||
QMenu menu;
|
||||
menu.setStyle(style);
|
||||
menu.show();
|
||||
menu.addAction(new QAction("Test 1", &menu));
|
||||
menu.addAction(new QAction("Test 2", &menu));
|
||||
QPixmap pixmap = menu.grab();
|
||||
comparePixmap(fileName, pixmap);
|
||||
|
||||
//Push button
|
||||
fileName = "images/" + platform + "/button.png";
|
||||
QPushButton button("OK");
|
||||
button.setStyle(style);
|
||||
button.show();
|
||||
pixmap = button.grab();
|
||||
button.hide();
|
||||
comparePixmap(fileName, pixmap);
|
||||
|
||||
//Push button
|
||||
fileName = "images/" + platform + "/radiobutton.png";
|
||||
QRadioButton radiobutton("Check");
|
||||
radiobutton.setStyle(style);
|
||||
radiobutton.show();
|
||||
pixmap = radiobutton.grab();
|
||||
radiobutton.hide();
|
||||
comparePixmap(fileName, pixmap);
|
||||
|
||||
//Combo box
|
||||
fileName = "images/" + platform + "/combobox.png";
|
||||
QComboBox combobox;
|
||||
combobox.setStyle(style);
|
||||
combobox.addItem("Test 1");
|
||||
combobox.addItem("Test 2");
|
||||
combobox.show();
|
||||
pixmap = combobox.grab();
|
||||
combobox.hide();
|
||||
comparePixmap(fileName, pixmap);
|
||||
|
||||
//Spin box
|
||||
fileName = "images/" + platform + "/spinbox.png";
|
||||
QDoubleSpinBox spinbox;
|
||||
spinbox.setLocale(QLocale(QLocale::English, QLocale::UnitedStates));
|
||||
spinbox.setStyle(style);
|
||||
spinbox.show();
|
||||
pixmap = spinbox.grab();
|
||||
spinbox.hide();
|
||||
comparePixmap(fileName, pixmap);
|
||||
QLocale::setDefault(QLocale::system());
|
||||
|
||||
//Slider
|
||||
fileName = "images/" + platform + "/slider.png";
|
||||
QSlider slider;
|
||||
slider.setStyle(style);
|
||||
slider.show();
|
||||
pixmap = slider.grab();
|
||||
slider.hide();
|
||||
comparePixmap(fileName, pixmap);
|
||||
|
||||
//Line edit
|
||||
fileName = "images/" + platform + "/lineedit.png";
|
||||
QLineEdit lineedit("Test text");
|
||||
lineedit.setStyle(style);
|
||||
lineedit.show();
|
||||
pixmap = lineedit.grab();
|
||||
lineedit.hide();
|
||||
comparePixmap(fileName, pixmap);
|
||||
|
||||
//MDI
|
||||
fileName = "images/" + platform + "/mdi.png";
|
||||
QMdiArea mdiArea;
|
||||
mdiArea.addSubWindow(new QWidget(&mdiArea));
|
||||
mdiArea.resize(200, 200);
|
||||
mdiArea.setStyle(style);
|
||||
mdiArea.show();
|
||||
pixmap = mdiArea.grab();
|
||||
mdiArea.hide();
|
||||
comparePixmap(fileName, pixmap);
|
||||
|
||||
// QToolButton
|
||||
fileName = "images/" + platform + "/toolbutton.png";
|
||||
QToolButton tb;
|
||||
tb.setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
tb.setText("AaQqPpXx");
|
||||
tb.setIcon(style->standardPixmap(QStyle::SP_DirHomeIcon));
|
||||
tb.setStyle(style);
|
||||
tb.show();
|
||||
pixmap = tb.grab();
|
||||
tb.hide();
|
||||
comparePixmap(fileName, pixmap);
|
||||
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
void tst_QStyle::testMacStyle()
|
||||
{
|
||||
|
|
|
|||