summaryrefslogtreecommitdiffstats
path: root/tests/auto/qimage
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-07-28 11:43:13 +0200
committerOlivier Goffart <olivier.goffart@nokia.com>2010-07-28 11:43:13 +0200
commit84294f47e55073914bcbcdbaf85df1a0e2e2d845 (patch)
tree1166be97fcfcc6a71b9603443ef6360d33aef276 /tests/auto/qimage
parent80e13f5bd418395bd64396e359a288b748ae1dfb (diff)
parent7b10151cb6550fe8060217fad8549950eadd5fca (diff)
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts: src/gui/kernel/qapplication.cpp tests/auto/qfileinfo/tst_qfileinfo.cpp tools/qdoc3/test/assistant.qdocconf tools/qdoc3/test/designer.qdocconf tools/qdoc3/test/linguist.qdocconf tools/qdoc3/test/qmake.qdocconf tools/qdoc3/test/qt-build-docs.qdocconf tools/qdoc3/test/qt.qdocconf
Diffstat (limited to 'tests/auto/qimage')
-rw-r--r--tests/auto/qimage/tst_qimage.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp
index 4219920ad8..517c18167f 100644
--- a/tests/auto/qimage/tst_qimage.cpp
+++ b/tests/auto/qimage/tst_qimage.cpp
@@ -83,6 +83,8 @@ private slots:
void convertToFormat_data();
void convertToFormat();
+ void convertToFormatRgb888ToRGB32();
+
void createAlphaMask_data();
void createAlphaMask();
#ifndef QT_NO_IMAGE_HEURISTIC_MASK
@@ -799,6 +801,26 @@ void tst_QImage::convertToFormat()
QFile::remove(QLatin1String("expected2.xpm"));
}
+void tst_QImage::convertToFormatRgb888ToRGB32()
+{
+ // 545 so width % 4 != 0. This ensure there is padding at the end of the scanlines
+ const int height = 545;
+ const int width = 545;
+ QImage source(width, height, QImage::Format_RGB888);
+ for (int y = 0; y < height; ++y) {
+ uchar *srcPixels = source.scanLine(y);
+ for (int x = 0; x < width * 3; ++x)
+ srcPixels[x] = x;
+ }
+
+ QImage rgb32Image = source.convertToFormat(QImage::Format_RGB888);
+ QCOMPARE(rgb32Image.format(), QImage::Format_RGB888);
+ for (int x = 0; x < width; ++x) {
+ for (int y = 0; y < height; ++y)
+ QCOMPARE(rgb32Image.pixel(x, y), source.pixel(x, y));
+ }
+}
+
void tst_QImage::createAlphaMask_data()
{
QTest::addColumn<int>("x");