From: asl Date: Fri, 9 Dec 2016 09:22:59 +0000 (+0300) Subject: automatic test for DTM, refs issue #1066 X-Git-Tag: v1.6~2^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d9443cd8cdb58cafd4bfb436bac8b1be8a049377;p=modules%2Fhydro.git automatic test for DTM, refs issue #1066 --- diff --git a/src/HYDRO_tests/reference_data/CMakeLists.txt b/src/HYDRO_tests/reference_data/CMakeLists.txt index b3fb1124..2ee55128 100644 --- a/src/HYDRO_tests/reference_data/CMakeLists.txt +++ b/src/HYDRO_tests/reference_data/CMakeLists.txt @@ -116,6 +116,7 @@ SET(REFERENCE_DATA DTM_2.png stream_dtm_2d.png stream_dtm_3d.png + pb_1066.cbf ) # Application tests diff --git a/src/HYDRO_tests/reference_data/pb_1066.cbf b/src/HYDRO_tests/reference_data/pb_1066.cbf new file mode 100644 index 00000000..220d577f Binary files /dev/null and b/src/HYDRO_tests/reference_data/pb_1066.cbf differ diff --git a/src/HYDRO_tests/test_HYDROData_DTM.cxx b/src/HYDRO_tests/test_HYDROData_DTM.cxx index 3cf271fd..c9934653 100644 --- a/src/HYDRO_tests/test_HYDROData_DTM.cxx +++ b/src/HYDRO_tests/test_HYDROData_DTM.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -620,5 +621,30 @@ void test_HYDROData_DTM::test_garonne() TestViewer::showColorScale( ColorScaleIsDisp ); delete aBathPrs; aDoc->Close(); +} +void test_HYDROData_DTM::test_classifier_1() +{ + TCollection_AsciiString fname = REF_DATA_PATH.toLatin1().data(); + fname += "/pb_1066.cbf"; + CPPUNIT_ASSERT_EQUAL( DocError_OK, HYDROData_Document::Load( fname.ToCString(), 1 ) ); + + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + + Handle(HYDROData_CalculationCase) aCase = + Handle(HYDROData_CalculationCase)::DownCast( aDoc->FindObjectByName( "Case_1" ) ); + CPPUNIT_ASSERT_EQUAL( Standard_False, aCase.IsNull() ); + std::vector points; + points.push_back( gp_XY( 43.4842, 3.33176 ) ); + points.push_back( gp_XY( -125.777, 2.24728 ) ); + points.push_back( gp_XY( -60.1628, 168.262 ) ); + + std::vector values = aCase->GetStricklerCoefficientForPoints( points, 0.0, true ); + CPPUNIT_ASSERT_EQUAL( 3, (int)values.size() ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0123, values[0], EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0123, values[1], EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0221, values[2], EPS ); + + aDoc->Close(); } + diff --git a/src/HYDRO_tests/test_HYDROData_DTM.h b/src/HYDRO_tests/test_HYDROData_DTM.h index 5eb53be1..57413786 100644 --- a/src/HYDRO_tests/test_HYDROData_DTM.h +++ b/src/HYDRO_tests/test_HYDROData_DTM.h @@ -31,6 +31,7 @@ class test_HYDROData_DTM : public CppUnit::TestFixture CPPUNIT_TEST( test_curve_to_3d ); CPPUNIT_TEST( test_presentation ); CPPUNIT_TEST( test_garonne ); + CPPUNIT_TEST( test_classifier_1 ); CPPUNIT_TEST_SUITE_END(); public: @@ -47,6 +48,7 @@ public: void test_curve_to_3d(); void test_presentation(); void test_garonne(); + void test_classifier_1(); }; CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_DTM );