summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-05-26 12:07:18 +0200
committerAllan Sandfeld Jensen <allan.jensen@digia.com>2014-07-04 14:03:46 +0200
commit3acd4b546ded7523f65d60cee6f3809113a91a16 (patch)
treeac526a90c4b39229ea5ec4c80b779ca8a4b66c24 /tests/auto/gui
parent715b41ce48c9dd78eec3223606e9ca5193cf5bad (diff)
QImage support for RGB30 formats
Adds basic support for 10-bit per color channel formats to QImage and the XCB plugin. This will make it possible to paint to and from these formats, but only at 8-bit per color channel accuracy. This also fixes Qt5 applications on X11 with native 30bit depth. [ChangeLog][QtGui][QImage] Added support for 10-bit per color channel image formats. Task-number: QTBUG-25998 Change-Id: I93ccd3c74bfbb0bd94b352476e5fe58a94119e1f Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp31
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp28
2 files changed, 58 insertions, 1 deletions
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 0a4456e22a..e2135ad6f0 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -766,6 +766,13 @@ void tst_QImage::convertToFormat_data()
<< int(QImage::Format_ARGB32_Premultiplied) << 0x7f7f7f7fu;
QTest::newRow("semiblack rgba8888 -> argb pm") << int(QImage::Format_RGBA8888) << 0x7f000000u
<< int(QImage::Format_ARGB32_Premultiplied) << 0x7f000000u;
+
+ QTest::newRow("red rgb30 -> argb32") << int(QImage::Format_RGB30) << 0xffff0000
+ << int(QImage::Format_ARGB32) << 0xffff0000;
+ QTest::newRow("green rgb30 -> argb32") << int(QImage::Format_RGB30) << 0xff00ff00
+ << int(QImage::Format_ARGB32) << 0xff00ff00;
+ QTest::newRow("blue rgb30 -> argb32") << int(QImage::Format_RGB30) << 0xff0000ff
+ << int(QImage::Format_ARGB32) << 0xff0000ff;
}
@@ -1218,6 +1225,18 @@ void tst_QImage::setPixel_data()
QTest::newRow("RGBA8888 blue") << int(QImage::Format_RGBA8888)
<< 0xff0000ffu << 0xffff0000u;
#endif
+ QTest::newRow("A2BGR30_Premultiplied red") << int(QImage::Format_A2BGR30_Premultiplied)
+ << 0xffff0000u << 0xc00003ffu;
+ QTest::newRow("A2BGR30_Premultiplied green") << int(QImage::Format_A2BGR30_Premultiplied)
+ << 0xff00ff00u << 0xc00ffc00u;
+ QTest::newRow("A2BGR30_Premultiplied blue") << int(QImage::Format_A2BGR30_Premultiplied)
+ << 0xff0000ffu << 0xfff00000u;
+ QTest::newRow("RGB30 red") << int(QImage::Format_RGB30)
+ << 0xffff0000u << 0xfff00000u;
+ QTest::newRow("RGB30 green") << int(QImage::Format_RGB30)
+ << 0xff00ff00u << 0xc00ffc00u;
+ QTest::newRow("RGB30 blue") << int(QImage::Format_RGB30)
+ << 0xff0000ffu << 0xc00003ffu;
}
void tst_QImage::setPixel()
@@ -1244,6 +1263,8 @@ void tst_QImage::setPixel()
case int(QImage::Format_RGBX8888):
case int(QImage::Format_RGBA8888):
case int(QImage::Format_RGBA8888_Premultiplied):
+ case int(QImage::Format_A2BGR30_Premultiplied):
+ case int(QImage::Format_RGB30):
{
for (int y = 0; y < h; ++y) {
const quint32 *row = (const quint32*)(img.scanLine(y));
@@ -1963,6 +1984,8 @@ void tst_QImage::fillColor_data()
"ARGB4444pm",
"RGBx8888",
"RGBA8888pm",
+ "BGR30",
+ "A2RGB30pm",
0
};
@@ -1982,6 +2005,8 @@ void tst_QImage::fillColor_data()
QImage::Format_ARGB4444_Premultiplied,
QImage::Format_RGBX8888,
QImage::Format_RGBA8888_Premultiplied,
+ QImage::Format_BGR30,
+ QImage::Format_A2RGB30_Premultiplied,
};
for (int i=0; names[i] != 0; ++i) {
@@ -2000,6 +2025,7 @@ void tst_QImage::fillColor_data()
QTest::newRow("ARGB32, transparent") << QImage::Format_ARGB32 << Qt::transparent << 0x00000000u;
QTest::newRow("ARGB32pm, transparent") << QImage::Format_ARGB32_Premultiplied << Qt::transparent << 0x00000000u;
QTest::newRow("RGBA8888pm, transparent") << QImage::Format_RGBA8888_Premultiplied << Qt::transparent << 0x00000000u;
+ QTest::newRow("A2RGB30pm, transparent") << QImage::Format_A2RGB30_Premultiplied << Qt::transparent << 0x00000000u;
}
void tst_QImage::fillColor()
@@ -2116,6 +2142,8 @@ void tst_QImage::rgbSwapped_data()
QTest::newRow("Format_RGB444") << QImage::Format_RGB444;
QTest::newRow("Format_RGBX8888") << QImage::Format_RGBX8888;
QTest::newRow("Format_RGBA8888_Premultiplied") << QImage::Format_RGBA8888_Premultiplied;
+ QTest::newRow("Format_A2BGR30_Premultiplied") << QImage::Format_A2BGR30_Premultiplied;
+ QTest::newRow("Format_RGB30") << QImage::Format_RGB30;
}
void tst_QImage::rgbSwapped()
@@ -2184,6 +2212,8 @@ void tst_QImage::mirrored_data()
QTest::newRow("Format_RGB444, vertical") << QImage::Format_RGB444 << true << false << 16 << 16;
QTest::newRow("Format_RGBX8888, vertical") << QImage::Format_RGBX8888 << true << false << 16 << 16;
QTest::newRow("Format_RGBA8888_Premultiplied, vertical") << QImage::Format_RGBA8888_Premultiplied << true << false << 16 << 16;
+ QTest::newRow("Format_A2BGR30_Premultiplied, vertical") << QImage::Format_A2BGR30_Premultiplied << true << false << 16 << 16;
+ QTest::newRow("Format_RGB30, vertical") << QImage::Format_RGB30 << true << false << 16 << 16;
QTest::newRow("Format_Indexed8, vertical") << QImage::Format_Indexed8 << true << false << 16 << 16;
QTest::newRow("Format_Mono, vertical") << QImage::Format_Mono << true << false << 16 << 16;
QTest::newRow("Format_MonoLSB, vertical") << QImage::Format_MonoLSB << true << false << 16 << 16;
@@ -2283,6 +2313,7 @@ void tst_QImage::inplaceRgbSwapped_data()
QTest::newRow("Format_ARGB32_Premultiplied") << QImage::Format_ARGB32_Premultiplied;
QTest::newRow("Format_RGBA8888") << QImage::Format_RGBA8888;
+ QTest::newRow("Format_A2RGB30_Premultiplied") << QImage::Format_A2RGB30_Premultiplied;
QTest::newRow("Format_RGB888") << QImage::Format_RGB888;
QTest::newRow("Format_RGB16") << QImage::Format_RGB16;
QTest::newRow("Format_Indexed8") << QImage::Format_Indexed8;
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index 4604f840da..5af5b1a269 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -1136,6 +1136,8 @@ void tst_QPainter::fillRect2_data()
QTest::newRow("argb32pm") << QImage::Format_ARGB32_Premultiplied;
QTest::newRow("rgba8888") << QImage::Format_RGBA8888;
QTest::newRow("rgba8888pm") << QImage::Format_RGBA8888_Premultiplied;
+ QTest::newRow("a2rgb30pm") << QImage::Format_A2RGB30_Premultiplied;
+ QTest::newRow("a2bgr30pm") << QImage::Format_A2BGR30_Premultiplied;
}
void tst_QPainter::fillRect2()
@@ -1528,6 +1530,8 @@ void tst_QPainter::qimageFormats_data()
QTest::newRow("Qimage::Format_RGB555") << QImage::Format_RGB555;
QTest::newRow("Qimage::Format_ARGB8555_Premultiplied") << QImage::Format_ARGB8555_Premultiplied;
QTest::newRow("Qimage::Format_RGB888") << QImage::Format_RGB888;
+ QTest::newRow("Qimage::Format_A2RGB30_Premultiplied") << QImage::Format_A2RGB30_Premultiplied;
+ QTest::newRow("Qimage::Format_RGB30") << QImage::Format_RGB30;
}
/*
@@ -2344,6 +2348,26 @@ void tst_QPainter::setOpacity_data()
QTest::newRow("RGB32 on RGBx8888") << QImage::Format_RGB32
<< QImage::Format_RGBX8888;
+
+ QTest::newRow("A2RGB30P on A2RGB30P") << QImage::Format_A2RGB30_Premultiplied
+ << QImage::Format_A2RGB30_Premultiplied;
+
+ QTest::newRow("ARGB32P on A2RGB30P") << QImage::Format_ARGB32_Premultiplied
+ << QImage::Format_A2RGB30_Premultiplied;
+
+
+ QTest::newRow("RGB32 on A2BGR30P") << QImage::Format_ARGB32_Premultiplied
+ << QImage::Format_A2BGR30_Premultiplied;
+
+ QTest::newRow("A2RGB30P on A2BGR30P") << QImage::Format_A2RGB30_Premultiplied
+ << QImage::Format_A2BGR30_Premultiplied;
+
+ QTest::newRow("ARGB32P on BGR30") << QImage::Format_ARGB32_Premultiplied
+ << QImage::Format_BGR30;
+
+ QTest::newRow("ARGB32P on RGB30") << QImage::Format_A2RGB30_Premultiplied
+ << QImage::Format_RGB30;
+
}
void tst_QPainter::setOpacity()
@@ -2432,7 +2456,9 @@ void tst_QPainter::drawhelper_blend_untransformed()
dest.bytesPerLine(), dest.format());
if (dest.format() == QImage::Format_ARGB8565_Premultiplied ||
- dest.format() == QImage::Format_ARGB8555_Premultiplied) {
+ dest.format() == QImage::Format_ARGB8555_Premultiplied ||
+ dest.format() == QImage::Format_A2BGR30_Premultiplied ||
+ dest.format() == QImage::Format_A2RGB30_Premultiplied ) {
// Test skipped due to rounding errors...
continue;
}