summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-11-16 07:37:38 +0100
committerLiang Qi <liang.qi@qt.io>2016-11-16 12:35:36 +0100
commit90c425642dfeae4564b43dacf15f80479962e910 (patch)
tree7e51683195210b3c70c04a8a0753ee272af1cd4c /tests/auto/widgets
parent1a43199fcea1bcec1ebf1a1a12cd3dcb942d67b4 (diff)
parent9808b53fde1dfc65ad3757cc6720e430c3cc89a2 (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts: mkspecs/common/linux-android.conf src/gui/opengl/qopengl.h src/network/socket/qnativesocketengine_winrt.cpp src/network/socket/qnativesocketengine_winrt_p.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/eglfs/api/qeglfsintegration.cpp src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp sync.profile Change-Id: If70aaf2c49df91157b864cf0d7d9513546c9bec4
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp19
-rw-r--r--tests/auto/widgets/widgets/qlabel/red@2x.pngbin0 -> 105 bytes
-rw-r--r--tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp24
3 files changed, 28 insertions, 15 deletions
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
index 00693ba6f7..0bb2c50b9d 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -1057,6 +1057,10 @@ static QSet<QString> fileListUnderIndex(const QFileSystemModel *model, const QMo
void tst_QFileSystemModel::specialFiles()
{
+#ifndef Q_OS_UNIX
+ QSKIP("Not implemented");
+#endif
+
QFileSystemModel model;
model.setFilter(QDir::AllEntries | QDir::System | QDir::Hidden);
@@ -1065,23 +1069,8 @@ void tst_QFileSystemModel::specialFiles()
// as it will always return a valid index for existing files,
// even if the file is not visible with the given filter.
-#if defined(Q_OS_UNIX)
const QModelIndex rootIndex = model.setRootPath(QStringLiteral("/dev/"));
const QString testFileName = QStringLiteral("null");
-#elif defined(Q_OS_WIN)
- const QModelIndex rootIndex = model.setRootPath(flatDirTestPath);
-
- const QString testFileName = QStringLiteral("linkSource.lnk");
-
- QFile file(flatDirTestPath + QLatin1String("/linkTarget.txt"));
- QVERIFY(file.open(QIODevice::WriteOnly));
- file.close();
- QVERIFY(file.link(flatDirTestPath + '/' + testFileName));
-#else
- QSKIP("Not implemented");
- QModelIndex rootIndex;
- QString testFileName;
-#endif
QTRY_VERIFY(fileListUnderIndex(&model, rootIndex).contains(testFileName));
diff --git a/tests/auto/widgets/widgets/qlabel/red@2x.png b/tests/auto/widgets/widgets/qlabel/red@2x.png
new file mode 100644
index 0000000000..4a843e744f
--- /dev/null
+++ b/tests/auto/widgets/widgets/qlabel/red@2x.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
index ad971c6b5f..6363d0c673 100644
--- a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
+++ b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
@@ -96,6 +96,9 @@ private Q_SLOTS:
void taskQTBUG_7902_contextMenuCrash();
#endif
+ void taskQTBUG_48157_dprPixmap();
+ void taskQTBUG_48157_dprMovie();
+
private:
QLabel *testWidget;
QPointer<Widget> test_box;
@@ -541,5 +544,26 @@ void tst_QLabel::taskQTBUG_7902_contextMenuCrash()
}
#endif
+void tst_QLabel::taskQTBUG_48157_dprPixmap()
+{
+ QLabel label;
+ QPixmap pixmap;
+ pixmap.load(QFINDTESTDATA(QStringLiteral("red@2x.png")));
+ QCOMPARE(pixmap.devicePixelRatio(), 2.0);
+ label.setPixmap(pixmap);
+ QCOMPARE(label.sizeHint(), pixmap.rect().size() / pixmap.devicePixelRatio());
+}
+
+void tst_QLabel::taskQTBUG_48157_dprMovie()
+{
+ QLabel label;
+ QMovie movie;
+ movie.setFileName(QFINDTESTDATA(QStringLiteral("red@2x.png")));
+ movie.start();
+ QCOMPARE(movie.currentPixmap().devicePixelRatio(), 2.0);
+ label.setMovie(&movie);
+ QCOMPARE(label.sizeHint(), movie.currentPixmap().size() / movie.currentPixmap().devicePixelRatio());
+}
+
QTEST_MAIN(tst_QLabel)
#include "tst_qlabel.moc"