From c40bde9a5a0840614502cc0e56b253b2d3648236 Mon Sep 17 00:00:00 2001 From: asl Date: Fri, 16 Oct 2015 14:52:16 +0300 Subject: [PATCH] new randomizer equivalent for 32 and 64 bits platform --- src/HYDRO_tests/CMakeLists.txt | 2 + src/HYDRO_tests/TestViewer.cxx | 76 ++++++++++++------ src/HYDRO_tests/TestViewer.h | 18 ++++- src/HYDRO_tests/random.cxx | 18 +++++ src/HYDRO_tests/random.h | 5 ++ .../reference_data/LandCoverMap_Split_1.png | Bin 7761 -> 7716 bytes src/HYDRO_tests/test_HYDROData_Bathymetry.cxx | 17 ++-- .../test_HYDROData_LandCoverMap.cxx | 24 +++--- src/HYDRO_tests/test_HYDROData_Main.cxx | 4 +- 9 files changed, 116 insertions(+), 48 deletions(-) create mode 100644 src/HYDRO_tests/random.cxx create mode 100644 src/HYDRO_tests/random.h diff --git a/src/HYDRO_tests/CMakeLists.txt b/src/HYDRO_tests/CMakeLists.txt index 8916171a..30e87f5b 100644 --- a/src/HYDRO_tests/CMakeLists.txt +++ b/src/HYDRO_tests/CMakeLists.txt @@ -18,6 +18,7 @@ set(PROJECT_HEADERS TestViewer.h TestLib_Listener.h TestLib_Runner.h + random.h ) set(PROJECT_SOURCES @@ -38,6 +39,7 @@ set(PROJECT_SOURCES TestViewer.cxx TestLib_Listener.cxx TestLib_Runner.cxx + random.cxx ) add_definitions( diff --git a/src/HYDRO_tests/TestViewer.cxx b/src/HYDRO_tests/TestViewer.cxx index 7f891922..1a5e0bf9 100644 --- a/src/HYDRO_tests/TestViewer.cxx +++ b/src/HYDRO_tests/TestViewer.cxx @@ -1,17 +1,35 @@ #include +#include #include +#ifdef WIN32 + #pragma warning ( disable: 4251 ) +#endif #include +#ifdef WIN32 + #pragma warning ( disable: 4251 ) +#endif #include +#ifdef WIN32 + #pragma warning ( disable: 4251 ) +#endif #include #include #include + #include #include +#include + +#ifdef WIN32 + #pragma warning ( default: 4251 ) +#endif + #include OCCViewer_ViewManager* TestViewer::myViewManager = 0; OCCViewer_ViewWindow* TestViewer::myViewWindow = 0; +QString TestViewer::myKey = ""; OCCViewer_ViewManager* TestViewer::viewManager() { @@ -47,41 +65,51 @@ Handle(AIS_InteractiveContext) context() return TestViewer::viewer()->getAISContext(); } -void TestViewer::show( const TopoDS_Shape& theShape, const QColor& theColor, int theMode ) +QColor randomColor() { - QColor aColor = theColor; - if( !aColor.isValid() ) - { - // random color - int aHue = rand()%255; - aColor = QColor::fromHsl( aHue, 255, 128 ); - } + int aHue = rand()%255; + QColor aColor = QColor::fromHsl( aHue, 255, 128 ); + return aColor; +} - double r = aColor.red() / 255.0; - double g = aColor.green() / 255.0; - double b = aColor.blue() / 255.0; +void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const QColor& theColor ) +{ + double r = theColor.red() / 255.0; + double g = theColor.green() / 255.0; + double b = theColor.blue() / 255.0; Handle(AIS_Shape) aShape = new AIS_Shape( theShape ); aShape->SetMaterial( Graphic3d_NOM_PLASTIC ); aShape->SetColor( Quantity_Color( r, g, b, Quantity_TOC_RGB ) ); context()->Display( aShape, theMode, 0, Standard_False ); + + if( isFitAll ) + { + viewWindow()->onTopView(); + viewWindow()->onFitAll(); + } } -void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll ) +void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, char* theKey ) { context()->EraseAll(); + myKey = theKey; + test_srand( qHash( theKey ) ); if( theShape.ShapeType()==TopAbs_COMPOUND ) { TopoDS_Iterator anIt( theShape ); for( ; anIt.More(); anIt.Next() ) - show( anIt.Value(), QColor(), theMode ); + show( anIt.Value(), theMode, false, randomColor() ); } else - show( theShape, QColor(), theMode ); + show( theShape, theMode, false, randomColor() ); - viewWindow()->onTopView(); - viewWindow()->onFitAll(); + if( isFitAll ) + { + viewWindow()->onTopView(); + viewWindow()->onFitAll(); + } } bool AreImagesEqual( const QImage& theImage1, const QImage& theImage2, double theTolerance ) @@ -106,21 +134,24 @@ bool AreImagesEqual( const QImage& theImage1, const QImage& theImage2, double th return true; } -bool TestViewer::AssertEqual( const QString& theUseCaseName ) +bool TestViewer::AssertImages( QString& theMessage ) { QImage anActualImage = viewWindow()->dumpView(); QString anExpectedRefFilePath = qgetenv( "HYDRO_REFERENCE_DATA" ); - anExpectedRefFilePath += "/" + theUseCaseName + ".png"; + anExpectedRefFilePath += "/" + myKey + ".png"; QImage anExpectedRefImage; anExpectedRefImage.load( anExpectedRefFilePath ); - if( AreImagesEqual( anActualImage, anExpectedRefImage, 0.2 ) ) + if( AreImagesEqual( anActualImage, anExpectedRefImage, 0.001 ) ) + { + theMessage = ""; return true; + } - QString aPath = QDir::tempPath() + "/" + theUseCaseName + ".png"; + QString aPath = QDir::tempPath() + "/" + myKey + ".png"; anActualImage.save( aPath ); - std::string aMessage = "The viewer contents does not correspond to the reference image: " + theUseCaseName.toStdString(); + theMessage = "The viewer contents does not correspond to the reference image: " + myKey; QImage aDiff( anExpectedRefImage.width(), anExpectedRefImage.height(), QImage::Format_ARGB32 ); QPainter aPainter( &aDiff ); @@ -128,9 +159,8 @@ bool TestViewer::AssertEqual( const QString& theUseCaseName ) aPainter.setCompositionMode( QPainter::RasterOp_SourceXorDestination ); aPainter.drawImage( 0, 0, anActualImage ); - QString aDiffFilePath = QDir::tempPath() + "/" + theUseCaseName + "_diff.png"; + QString aDiffFilePath = QDir::tempPath() + "/" + myKey + "_diff.png"; aDiff.save( aDiffFilePath ); - CPPUNIT_FAIL( aMessage.c_str() ); return false; } diff --git a/src/HYDRO_tests/TestViewer.h b/src/HYDRO_tests/TestViewer.h index e825208b..669b5621 100644 --- a/src/HYDRO_tests/TestViewer.h +++ b/src/HYDRO_tests/TestViewer.h @@ -15,11 +15,23 @@ public: static OCCViewer_Viewer* viewer(); static OCCViewer_ViewWindow* viewWindow(); - static void show( const TopoDS_Shape& theShape, const QColor& theColor, int theMode ); - static void show( const TopoDS_Shape& theShape, int theMode, bool isFitAll = true ); - static bool AssertEqual( const QString& theUseCaseName ); + static void show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const QColor& theColor ); + static void show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, char* theKey ); + static bool AssertImages( QString& theMessage ); private: static OCCViewer_ViewManager* myViewManager; static OCCViewer_ViewWindow* myViewWindow; + static QString myKey; }; + +#define CPPUNIT_ASSERT_IMAGES \ + { \ + QString aMessage; \ + if( !TestViewer::AssertImages( aMessage ) ) \ + { \ + std::string aMessageStl = aMessage.toStdString(); \ + CPPUNIT_FAIL( aMessageStl.c_str() ); \ + } \ + } \ + diff --git a/src/HYDRO_tests/random.cxx b/src/HYDRO_tests/random.cxx new file mode 100644 index 00000000..da51deba --- /dev/null +++ b/src/HYDRO_tests/random.cxx @@ -0,0 +1,18 @@ + +#include + +int m_w = 1; +int m_z = 1; + +void test_srand( unsigned int theValue ) +{ + m_w = theValue + 1; + m_z = theValue / 2; +} + +unsigned int test_rand() +{ + m_z = 36969 * (m_z & 65535) + (m_z >> 16); + m_w = 18000 * (m_w & 65535) + (m_w >> 16); + return (m_z << 16) + m_w; /* 32-bit result */ +} diff --git a/src/HYDRO_tests/random.h b/src/HYDRO_tests/random.h new file mode 100644 index 00000000..bc8800b2 --- /dev/null +++ b/src/HYDRO_tests/random.h @@ -0,0 +1,5 @@ + +#pragma once + +void test_srand( unsigned int theValue ); +unsigned int test_rand(); diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Split_1.png b/src/HYDRO_tests/reference_data/LandCoverMap_Split_1.png index d76a7f7e848083ab27c3d36fe1c1245e055feaf4..2ed3c2827f62bac13594bf11ce5e130612406e70 100644 GIT binary patch literal 7716 zcmYj$3s_9s`~SOlyJk>rayi5aQ=$;+6r$7~jZ8vOl86a8 zor9x@llzn;M1y?go2{MK~7-~aQU=jrKPYrX69Ue~+cy?1J0fRC}^Fhc+^ z_MIV}3!p~>;C`e5n!%mRd(l54M&di4M85Dr_G5pDp)mYaM|J(rnp45#wnNYzu?u%>E2iNHfIxN zBEC_|d`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isksa?st>hyYiefV(hXD<6o6FCUo$M;=;O% zwmiR?&&$vs-v4>ayR$F;N*`PZiLRztzfe@~cRQo0XzSoNe^GBSXJA8i(dV*F7hfkv zG!_mNn0OCWITxB@&uzWxr{yj#7nAKLwpf0@x}az6tCrHQMV=d8wNHFk`7F^j$x=-{ zJfbbR5%078AgkVahsZ3X>T_dFL3HAsJ)GL{RXsVZ{|rPt;?)$+*Lr{Mb=jFW56-N4 zGQRp-Ly;qjs=?!H5?>F!Gibp)lyjvPueCg~eq8w>HWrgF8l9`--e3IFUo^~e%d__h z{cRCT`(E`t+d84a`)&K;X!h&hjLSCuR{7`ajXySRM%oSjXg#rP>Ej;}8WmcQ1#jK_ z;0%g!XIA<=@MYP`2X*UFOl`lhX3K-W9{+u=f9HGIhn*kn*Ypp5uI_oa>F4wFPx|kc z4laDunDph!&%wIacNA6^`d9Tmx))-eM%8Sp{{EghCHHEMG{+K7&(jUNNc*aiVpi_;}+;DZm&@B>&jb#iYX9pc4$;dp82;8C`FW_?F|9{Otyo*d$ UbgHk=r`TBOe{_LKMW0%rvLx| diff --git a/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx b/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx index f72a456f..28a22cfe 100644 --- a/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx +++ b/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -61,7 +62,7 @@ bool test_HYDROData_Bathymetry::createTestFile( const QString& theFileName ) { QTextStream anOutStream( &aTmpFile ); - srand( 4587 ); + test_srand( 4587 ); generateOne( anOutStream, 0, 5, 0, -5 ); generateOne( anOutStream, 10, 5, 10, -5 ); generateOne( anOutStream, 20, 5, 20, -5 ); @@ -108,7 +109,7 @@ bool test_HYDROData_Bathymetry::createTestFile( const QString& theFileName ) generateOne( anOutStream, 1040.079834, -441.303467, 1017.623413, -459.9102175 ); generateOne( anOutStream, 1055.478516, -456.060547, 1034.946899, -475.9505 ); generateOne( anOutStream, 1074.085327, -474.025665, 1058.044922, -493.274017 ); - srand( 0 ); + test_srand( 0 ); } aTmpFile.close(); @@ -134,27 +135,27 @@ void test_HYDROData_Bathymetry::testFileImport() gp_XY aTestPoint( 1, 1 ); double anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint ); - CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.9755, anAltitude, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.9186, anAltitude, EPS ); aTestPoint = gp_XY( 0.5, 0.5 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint ); - CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0147, anAltitude, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.3452, anAltitude, EPS ); aTestPoint = gp_XY( 1.5, 1 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint ); - CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.9534, anAltitude, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.9157, anAltitude, EPS ); aTestPoint = gp_XY( 1.5, 0.7 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint ); - CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.5032, anAltitude, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.8782, anAltitude, EPS ); aTestPoint = gp_XY( 1.5, -0.7 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint ); - CPPUNIT_ASSERT_DOUBLES_EQUAL( 6.3088, anAltitude, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.9678, anAltitude, EPS ); aTestPoint = gp_XY( 2, 3.5 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint ); - CPPUNIT_ASSERT_DOUBLES_EQUAL( 11.090, anAltitude, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 12.4364, anAltitude, EPS ); aDoc->Close(); } diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx index 353e544b..721070bc 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx @@ -86,8 +86,8 @@ void test_HYDROData_LandCoverMap::test_add_2_objects() TopoDS_Face aLC2 = LandCover( QList() << 30 << 20 << 60 << 10 << 70 << 35 << 40 << 40 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "test2" ) ); - TestViewer::show( aMap->GetShape(), AIS_Shaded, true ); - TestViewer::AssertEqual( "LandCoverMap_Add_2_Objects" ); + TestViewer::show( aMap->GetShape(), AIS_Shaded, true, "LandCoverMap_Add_2_Objects" ); + CPPUNIT_ASSERT_IMAGES HYDROData_LandCoverMap::Iterator anIt( aMap ); CPPUNIT_ASSERT_EQUAL( true, anIt.More() ); @@ -120,9 +120,9 @@ void test_HYDROData_LandCoverMap::test_split() CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) ); - TestViewer::show( aMap->GetShape(), AIS_Shaded, true ); - TestViewer::show( aWire, QColor(), 0 ); - TestViewer::AssertEqual( "LandCoverMap_Split_1" ); + TestViewer::show( aMap->GetShape(), AIS_Shaded, true, "LandCoverMap_Split_1" ); + TestViewer::show( aWire, 0, true, Qt::blue ); + CPPUNIT_ASSERT_IMAGES HYDROData_LandCoverMap::Iterator anIt( aMap ); CPPUNIT_ASSERT_EQUAL( true, anIt.More() ); @@ -155,9 +155,9 @@ void test_HYDROData_LandCoverMap::test_incomplete_split() CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) ); - TestViewer::show( aMap->GetShape(), AIS_Shaded, true ); - TestViewer::show( aWire, QColor(), 0 ); - TestViewer::AssertEqual( "LandCoverMap_Split_2" ); + TestViewer::show( aMap->GetShape(), AIS_Shaded, true, "LandCoverMap_Split_2" ); + TestViewer::show( aWire, 0, true, Qt::blue ); + CPPUNIT_ASSERT_IMAGES HYDROData_LandCoverMap::Iterator anIt( aMap ); CPPUNIT_ASSERT_EQUAL( true, anIt.More() ); @@ -206,9 +206,9 @@ void test_HYDROData_LandCoverMap::test_merge() aList.Append( aMap->FindByPoint( aPnt2, aType2 ) ); CPPUNIT_ASSERT_EQUAL( true, aMap->Merge( aList, "new" ) ); - TestViewer::show( aMap->GetShape(), AIS_Shaded, true ); + TestViewer::show( aMap->GetShape(), AIS_Shaded, true, "LandCoverMap_Merge_1" ); //TestViewer::show( BRepBuilderAPI_MakeEdge( gp_Pnt(aPnt1.X(), aPnt1.Y(), 0), gp_Pnt(aPnt2.X(), aPnt2.Y(), 0) ).Edge(), QColor( Qt::blue ), AIS_Shaded ); - TestViewer::AssertEqual( "LandCoverMap_Merge_1" ); + CPPUNIT_ASSERT_IMAGES aDoc->Close(); } @@ -244,8 +244,8 @@ void test_HYDROData_LandCoverMap::test_remove() aList.Append( aMap->FindByPoint( aPnt2, aType2 ) ); CPPUNIT_ASSERT_EQUAL( true, aMap->Remove( aList ) ); - TestViewer::show( aMap->GetShape(), AIS_Shaded, true ); - TestViewer::AssertEqual( "LandCoverMap_Remove_1" ); + TestViewer::show( aMap->GetShape(), AIS_Shaded, true, "LandCoverMap_Remove_1" ); + CPPUNIT_ASSERT_IMAGES aDoc->Close(); } diff --git a/src/HYDRO_tests/test_HYDROData_Main.cxx b/src/HYDRO_tests/test_HYDROData_Main.cxx index 151bb2b5..40d7c4a3 100644 --- a/src/HYDRO_tests/test_HYDROData_Main.cxx +++ b/src/HYDRO_tests/test_HYDROData_Main.cxx @@ -28,11 +28,11 @@ #include #include #include -#include +#include int main( int argc, char* argv[] ) { - srand( 0 ); + test_srand( 0 ); QApplication anApp( argc, argv ); SUIT_Session aSession; -- 2.39.2