diff options
author | Ariya Hidayat <ariya.hidayat@nokia.com> | 2009-09-14 14:14:54 (GMT) |
---|---|---|
committer | Ariya Hidayat <ariya.hidayat@nokia.com> | 2009-09-14 14:58:08 (GMT) |
commit | 886feff55f48ebdff0440278e611f822e6326c91 (patch) | |
tree | fe65fd694ff38ab493cbc4a307e636bfa82bac2a /tests/auto/qgraphicseffect | |
parent | 3ecf8f5de029e0a67ec90f6eba60754078374f01 (diff) | |
download | Qt-886feff55f48ebdff0440278e611f822e6326c91.zip Qt-886feff55f48ebdff0440278e611f822e6326c91.tar.gz Qt-886feff55f48ebdff0440278e611f822e6326c91.tar.bz2 |
Add filter strength to QGraphics[Colorize,Grayscale]Effect.
Autotest: included
Reviewed-by: Bjørn Erik Nilsen
Diffstat (limited to 'tests/auto/qgraphicseffect')
-rw-r--r-- | tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp index 5363fd6..d5205cd 100644 --- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp @@ -388,6 +388,26 @@ void tst_QGraphicsEffect::grayscale() painter.end(); QCOMPARE(image.pixel(10, 10), qRgb(148, 148, 148)); + + effect->setStrength(0.5); + + image.fill(0); + painter.begin(&image); + painter.setRenderHint(QPainter::Antialiasing); + scene.render(&painter); + painter.end(); + + QCOMPARE(image.pixel(10, 10), qRgb(135, 171, 107)); + + effect->setStrength(0.0); + + image.fill(0); + painter.begin(&image); + painter.setRenderHint(QPainter::Antialiasing); + scene.render(&painter); + painter.end(); + + QCOMPARE(image.pixel(10, 10), qRgb(122, 193, 66)); } void tst_QGraphicsEffect::colorize() @@ -412,6 +432,26 @@ void tst_QGraphicsEffect::colorize() painter.end(); QCOMPARE(image.pixel(10, 10), qRgb(191, 212, 169)); + + effect->setStrength(0.5); + + image.fill(0); + painter.begin(&image); + painter.setRenderHint(QPainter::Antialiasing); + scene.render(&painter); + painter.end(); + + QCOMPARE(image.pixel(10, 10), qRgb(156, 203, 117)); + + effect->setStrength(0.0); + + image.fill(0); + painter.begin(&image); + painter.setRenderHint(QPainter::Antialiasing); + scene.render(&painter); + painter.end(); + + QCOMPARE(image.pixel(10, 10), qRgb(122, 193, 66)); } QTEST_MAIN(tst_QGraphicsEffect) |