summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-12-08 14:56:27 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-12-08 14:56:27 (GMT)
commite5b6414f5b28a93c917380fb57f56d0ca46f2961 (patch)
treeecaed6ae09be0d141244d32156df7a5fbc9b2414 /tests
parent6b46ec56d15516bfae72561c872fa6835527c4f8 (diff)
parentb850c43896d60b4dda21b01fdbdb15013cca48fa (diff)
downloadQt-e5b6414f5b28a93c917380fb57f56d0ca46f2961.zip
Qt-e5b6414f5b28a93c917380fb57f56d0ca46f2961.tar.gz
Qt-e5b6414f5b28a93c917380fb57f56d0ca46f2961.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Check Qt::WA_TranslucentBackground instead of custom widget property. New translucency API for the meego graphics system. Support for 'qglTranslucent' in QGLWindowSurface. Use a different dither distribution matrix + a bit of rand. Fixed cubic bezier rendering bug in qgrayraster. Revert "qgrayraster: Speed up rendering of small cubic splines." Fix QWingedEdge memory usage issue Make sure QMeeGoGraphicsSystem::setTranslucent can't be called if surface already created. Prevent always deep-copying in QPixmap::toImage() for raster pixmaps. Fix text disappearing on GL when RGB-path is taken (no transformation) Fix for GCC on Windows x64. Fix crash in QTextDocument::markContentsDirty Make sure to do a deep copy of a QImage when it's being painted on.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qimage/tst_qimage.cpp16
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp27
2 files changed, 37 insertions, 6 deletions
diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp
index b446941..b2c59fc 100644
--- a/tests/auto/qimage/tst_qimage.cpp
+++ b/tests/auto/qimage/tst_qimage.cpp
@@ -142,6 +142,8 @@ private slots:
void rgbSwapped_data();
void rgbSwapped();
+
+ void deepCopyWhenPaintingActive();
};
tst_QImage::tst_QImage()
@@ -1886,5 +1888,19 @@ void tst_QImage::rgbSwapped()
QCOMPARE(memcmp(image.constBits(), imageSwappedTwice.constBits(), image.numBytes()), 0);
}
+void tst_QImage::deepCopyWhenPaintingActive()
+{
+ QImage image(64, 64, QImage::Format_ARGB32_Premultiplied);
+ image.fill(0);
+
+ QPainter painter(&image);
+ QImage copy = image;
+
+ painter.setBrush(Qt::black);
+ painter.drawEllipse(image.rect());
+
+ QVERIFY(copy != image);
+}
+
QTEST_MAIN(tst_QImage)
#include "tst_qimage.moc"
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 51e6cf5..419518a1 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -129,10 +129,7 @@ private slots:
void isNull();
void task_246446();
-#ifdef Q_WS_QWS
void convertFromImageNoDetach();
-#endif
-
void convertFromImageDetach();
#if defined(Q_WS_WIN)
@@ -185,6 +182,8 @@ private slots:
void preserveDepth();
void splash_crash();
+ void toImageDeepCopy();
+
void loadAsBitmapOrPixmap();
};
@@ -911,11 +910,13 @@ void tst_QPixmap::isNull()
}
}
-#ifdef Q_WS_QWS
void tst_QPixmap::convertFromImageNoDetach()
{
+ QPixmap randomPixmap(10, 10);
+ if (randomPixmap.pixmapData()->classId() != QPixmapData::RasterClass)
+ QSKIP("Test only valid for raster pixmaps", SkipAll);
+
//first get the screen format
- QPixmap randomPixmap(10,10);
QImage::Format screenFormat = randomPixmap.toImage().format();
QVERIFY(screenFormat != QImage::Format_Invalid);
@@ -930,7 +931,6 @@ void tst_QPixmap::convertFromImageNoDetach()
const QImage constCopy = copy;
QVERIFY(constOrig.bits() == constCopy.bits());
}
-#endif //Q_WS_QWS
void tst_QPixmap::convertFromImageDetach()
{
@@ -1751,6 +1751,21 @@ void tst_QPixmap::loadAsBitmapOrPixmap()
QVERIFY(bitmap.isQBitmap());
}
+void tst_QPixmap::toImageDeepCopy()
+{
+ QPixmap pixmap(64, 64);
+ pixmap.fill(Qt::white);
+
+ QPainter painter(&pixmap);
+ QImage first = pixmap.toImage();
+
+ painter.setBrush(Qt::black);
+ painter.drawEllipse(pixmap.rect());
+
+ QImage second = pixmap.toImage();
+
+ QVERIFY(first != second);
+}
QTEST_MAIN(tst_QPixmap)