diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-05-29 10:37:04 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-05-29 10:37:04 (GMT) |
commit | eaf85eb428bc1336c16187b5e4df61f63a19068c (patch) | |
tree | ea017ac92bea46c6ec10f75775c4a2d18330cf23 /tests/auto/qimage/tst_qimage.cpp | |
parent | 429cd0ee393ad2eef9cea253f7e4dc8940e0cad7 (diff) | |
parent | 766cf07cbe7ebfda01dad163bb070fff7e3077d5 (diff) | |
download | Qt-eaf85eb428bc1336c16187b5e4df61f63a19068c.zip Qt-eaf85eb428bc1336c16187b5e4df61f63a19068c.tar.gz Qt-eaf85eb428bc1336c16187b5e4df61f63a19068c.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'tests/auto/qimage/tst_qimage.cpp')
-rw-r--r-- | tests/auto/qimage/tst_qimage.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp index c6b0560..b7199f3 100644 --- a/tests/auto/qimage/tst_qimage.cpp +++ b/tests/auto/qimage/tst_qimage.cpp @@ -131,6 +131,8 @@ private slots: void nullSize(); void premultipliedAlphaConsistency(); + + void compareIndexed(); }; tst_QImage::tst_QImage() @@ -1762,5 +1764,31 @@ void tst_QImage::premultipliedAlphaConsistency() } } +void tst_QImage::compareIndexed() +{ + QImage img(256, 1, QImage::Format_Indexed8); + + QVector<QRgb> colorTable(256); + for (int i = 0; i < 256; ++i) + colorTable[i] = qRgb(i, i, i); + img.setColorTable(colorTable); + + for (int i = 0; i < 256; ++i) { + img.setPixel(i, 0, i); + } + + QImage imgInverted(256, 1, QImage::Format_Indexed8); + QVector<QRgb> invertedColorTable(256); + for (int i = 0; i < 256; ++i) + invertedColorTable[255-i] = qRgb(i, i, i); + imgInverted.setColorTable(invertedColorTable); + + for (int i = 0; i < 256; ++i) { + imgInverted.setPixel(i, 0, (255-i)); + } + + QCOMPARE(img, imgInverted); +} + QTEST_MAIN(tst_QImage) #include "tst_qimage.moc" |