From ff6dd0edef347838fa86cdfeee2037b9544e3e40 Mon Sep 17 00:00:00 2001 From: asl Date: Fri, 16 Oct 2015 12:32:37 +0300 Subject: [PATCH] writing difference image if they are not equal --- src/HYDRO_tests/TestViewer.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) 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; } -- 2.39.2