From: asl Date: Fri, 16 Oct 2015 09:32:37 +0000 (+0300) Subject: writing difference image if they are not equal X-Git-Tag: v1.5~106 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ff6dd0edef347838fa86cdfeee2037b9544e3e40;p=modules%2Fhydro.git writing difference image if they are not equal --- diff --git a/src/HYDRO_tests/TestViewer.cxx b/src/HYDRO_tests/TestViewer.cxx index 96eaec90..cf15eea6 100644 --- a/src/HYDRO_tests/TestViewer.cxx +++ b/src/HYDRO_tests/TestViewer.cxx @@ -7,6 +7,7 @@ #include #include #include +#include #include OCCViewer_ViewManager* TestViewer::myViewManager = 0; @@ -117,5 +118,15 @@ bool TestViewer::AssertEqual( const QString& theUseCaseName ) anActualImage.save( aPath ); std::string aMessage = "The viewer contents does not correspond to the reference image: " + theUseCaseName.toStdString(); CPPUNIT_FAIL( aMessage.c_str() ); + + QImage aDiff( anExpectedRefImage.width(), anExpectedRefImage.height(), QImage::Format_ARGB32 ); + QPainter aPainter( &aDiff ); + aPainter.drawImage( 0, 0, anExpectedRefImage ); + aPainter.setCompositionMode( QPainter::RasterOp_SourceXorDestination ); + aPainter.drawImage( 0, 0, anActualImage ); + + QString aDiffFilePath = QDir::tempPath() + "/" + theUseCaseName + "_diff.png"; + aDiff.save( aPath ); + return false; }