summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/image/qpixmap
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-03-20 13:46:57 +0100
committerOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-03-20 13:49:28 +0100
commit76c0be34cd4ff4564693162fa7528463e23ce9d8 (patch)
treef165b7bc319548fb0082365411a871028f92e89e /tests/auto/gui/image/qpixmap
parent27b4fe96b59e9e63d1e570e802c072e9afdfb2d4 (diff)
parent36cb3f3f655a9090c82de609010cbfb88651a0f3 (diff)
Merge branch 'dev' into stable
This starts Qt 5.1 release cycle Conflicts: src/gui/text/qfontdatabase.cpp src/gui/text/qharfbuzz_copy_p.h src/widgets/kernel/qapplication.cpp src/widgets/kernel/qcoreapplication.cpp Change-Id: I72fbf83ab3c2206aeea1b089428b0fc2a89bd62b
Diffstat (limited to 'tests/auto/gui/image/qpixmap')
-rw-r--r--tests/auto/gui/image/qpixmap/tst_qpixmap.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
index 61f53a5073..531ec68fdc 100644
--- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
@@ -114,6 +114,7 @@ private slots:
void convertFromImageNoDetach();
void convertFromImageDetach();
+ void convertFromImageCacheKey();
#if defined(Q_OS_WIN)
void toWinHBITMAP_data();
@@ -782,6 +783,28 @@ void tst_QPixmap::convertFromImageDetach()
QVERIFY(copy.isDetached());
}
+void tst_QPixmap::convertFromImageCacheKey()
+{
+ QPixmap randomPixmap(10, 10);
+ if (randomPixmap.handle()->classId() != QPlatformPixmap::RasterClass)
+ QSKIP("Test only valid for raster pixmaps");
+
+ //first get the screen format
+ QImage::Format screenFormat = randomPixmap.toImage().format();
+ QVERIFY(screenFormat != QImage::Format_Invalid);
+
+ QImage orig(100,100, screenFormat);
+ orig.fill(0);
+
+ QPixmap pix = QPixmap::fromImage(orig);
+ QImage copy = pix.toImage();
+
+ QVERIFY(copy.format() == screenFormat);
+
+ QCOMPARE(orig.cacheKey(), pix.cacheKey());
+ QCOMPARE(copy.cacheKey(), pix.cacheKey());
+}
+
#if defined(Q_OS_WIN)
QT_BEGIN_NAMESPACE