]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
writing difference image if they are not equal
authorasl <asl@opencascade.com>
Fri, 16 Oct 2015 09:32:37 +0000 (12:32 +0300)
committerasl <asl@opencascade.com>
Fri, 16 Oct 2015 09:32:37 +0000 (12:32 +0300)
src/HYDRO_tests/TestViewer.cxx

index 96eaec9030fb8af7154b31e822d530c164c64bc6..cf15eea6c4225e0adabb53779dedb5f27fe8dbaf 100644 (file)
@@ -7,6 +7,7 @@
 #include <AIS_Shape.hxx>
 #include <TopoDS_Iterator.hxx>
 #include <QDir>
+#include <QPainter>
 #include <cppunit/TestAssert.h>
 
 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;
 }