From 557f5f91d30a5fae83a018a79eeb445c8c51ec3d Mon Sep 17 00:00:00 2001 From: asl Date: Tue, 13 Oct 2015 09:26:32 +0300 Subject: [PATCH] redesigned test system --- CMakeLists.txt | 2 + src/HYDROData/CMakeLists.txt | 36 ----- src/HYDROData/HYDROData.h | 26 ++-- src/HYDROData/HYDROData_BSplineOperation.cxx | 5 + src/HYDROData/HYDROData_CalculationCase.cxx | 8 ++ src/HYDROData/HYDROData_CalculationCase.h | 6 + src/HYDROData/HYDROData_GeomTool.cxx | 4 + src/HYDROData/HYDROData_GeomTool.h | 3 + src/HYDROData/HYDROData_Obstacle.cxx | 13 +- src/HYDROData/HYDROData_PolylineOperator.cxx | 5 + src/HYDROData/HYDROData_PolylineXY.cxx | 6 + src/HYDROData/HYDROData_StricklerTable.cxx | 30 ++--- .../test_HYDROData_BSplineOperation.cxx | 96 ------------- .../test_HYDROData_BSplineOperation.h | 44 ------ .../test_HYDROData_CalculationCase.cxx | 22 --- .../test_HYDROData_CalculationCase.h | 37 ----- src/HYDROGUI/CMakeLists.txt | 21 --- src/HYDROGUI/HYDROGUI.h | 26 ++-- src/HYDROGUI/HYDROGUI_ListModel.h | 2 - src/HYDRO_tests/CMakeLists.txt | 126 ++++++++++++++++++ .../test_HYDROData_Bathymetry.cxx | 0 .../test_HYDROData_Bathymetry.h | 0 .../test_HYDROData_Document.cxx | 0 .../test_HYDROData_Document.h | 0 .../test_HYDROData_Entity.cxx | 0 .../test_HYDROData_Entity.h | 0 .../test_HYDROData_Image.cxx | 0 .../test_HYDROData_Image.h | 0 .../test_HYDROData_Iterator.cxx | 0 .../test_HYDROData_Iterator.h | 0 .../test_HYDROData_Main.cxx | 0 .../test_HYDROData_OperationsFactory.cxx | 0 .../test_HYDROData_OperationsFactory.h | 0 .../test_HYDROData_PolylineXY.cxx | 0 .../test_HYDROData_PolylineXY.h | 0 .../test_HYDROData_Profile.cxx | 7 +- .../test_HYDROData_Profile.h | 0 .../test_HYDROData_StricklerTable.cxx | 0 .../test_HYDROData_StricklerTable.h | 0 .../test_HYDROGUI_ListModel.cxx | 0 .../test_HYDROGUI_ListModel.h | 0 .../test_HYDROGUI_Main.cxx | 0 42 files changed, 224 insertions(+), 301 deletions(-) delete mode 100644 src/HYDROData/test_HYDROData_BSplineOperation.cxx delete mode 100644 src/HYDROData/test_HYDROData_BSplineOperation.h delete mode 100755 src/HYDROData/test_HYDROData_CalculationCase.cxx delete mode 100755 src/HYDROData/test_HYDROData_CalculationCase.h create mode 100644 src/HYDRO_tests/CMakeLists.txt rename src/{HYDROData => HYDRO_tests}/test_HYDROData_Bathymetry.cxx (100%) mode change 100755 => 100644 rename src/{HYDROData => HYDRO_tests}/test_HYDROData_Bathymetry.h (100%) mode change 100755 => 100644 rename src/{HYDROData => HYDRO_tests}/test_HYDROData_Document.cxx (100%) rename src/{HYDROData => HYDRO_tests}/test_HYDROData_Document.h (100%) rename src/{HYDROData => HYDRO_tests}/test_HYDROData_Entity.cxx (100%) rename src/{HYDROData => HYDRO_tests}/test_HYDROData_Entity.h (100%) rename src/{HYDROData => HYDRO_tests}/test_HYDROData_Image.cxx (100%) rename src/{HYDROData => HYDRO_tests}/test_HYDROData_Image.h (100%) rename src/{HYDROData => HYDRO_tests}/test_HYDROData_Iterator.cxx (100%) rename src/{HYDROData => HYDRO_tests}/test_HYDROData_Iterator.h (100%) rename src/{HYDROData => HYDRO_tests}/test_HYDROData_Main.cxx (100%) rename src/{HYDROData => HYDRO_tests}/test_HYDROData_OperationsFactory.cxx (100%) rename src/{HYDROData => HYDRO_tests}/test_HYDROData_OperationsFactory.h (100%) rename src/{HYDROData => HYDRO_tests}/test_HYDROData_PolylineXY.cxx (100%) rename src/{HYDROData => HYDRO_tests}/test_HYDROData_PolylineXY.h (100%) mode change 100755 => 100644 rename src/{HYDROData => HYDRO_tests}/test_HYDROData_Profile.cxx (97%) mode change 100755 => 100644 rename src/{HYDROData => HYDRO_tests}/test_HYDROData_Profile.h (100%) mode change 100755 => 100644 rename src/{HYDROData => HYDRO_tests}/test_HYDROData_StricklerTable.cxx (100%) rename src/{HYDROData => HYDRO_tests}/test_HYDROData_StricklerTable.h (100%) rename src/{HYDROGUI => HYDRO_tests}/test_HYDROGUI_ListModel.cxx (100%) rename src/{HYDROGUI => HYDRO_tests}/test_HYDROGUI_ListModel.h (100%) rename src/{HYDROGUI => HYDRO_tests}/test_HYDROGUI_Main.cxx (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 601d0ab6..3c46f782 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,8 @@ INCLUDE(CMakeDependentOption) PROJECT(SalomeHYDRO C CXX) +ADD_SUBDIRECTORY (src/HYDRO_tests) + # Ensure a proper linker behavior: CMAKE_POLICY(SET CMP0003 NEW) diff --git a/src/HYDROData/CMakeLists.txt b/src/HYDROData/CMakeLists.txt index 0a7bfff5..9addb41b 100644 --- a/src/HYDROData/CMakeLists.txt +++ b/src/HYDROData/CMakeLists.txt @@ -143,40 +143,4 @@ INSTALL(TARGETS HYDROData EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME set(PROJECT_LIBRARIES shapelib HYDROData) -# tests -if(SALOME_BUILD_TESTS) - - set(TEST_HEADERS - test_HYDROData_Bathymetry.h - test_HYDROData_BSplineOperation.h - test_HYDROData_CalculationCase.h - test_HYDROData_Document.h - test_HYDROData_Entity.h - test_HYDROData_Image.h - test_HYDROData_Iterator.h - test_HYDROData_OperationsFactory.h - test_HYDROData_PolylineXY.h - test_HYDROData_StricklerTable.h - ) - - set(TEST_SOURCES - test_HYDROData_Main.cxx - test_HYDROData_Bathymetry.cxx - test_HYDROData_BSplineOperation.cxx - test_HYDROData_CalculationCase.cxx - test_HYDROData_Document.cxx - test_HYDROData_Entity.cxx - test_HYDROData_Image.cxx - test_HYDROData_Iterator.cxx - test_HYDROData_OperationsFactory.cxx - test_HYDROData_PolylineXY.cxx - test_HYDROData_StricklerTable.cxx - ) - - set(TEST_EXE test_HYDROData) - include(../../CMake/CPPUnitTests.cmake) - target_link_libraries(test_HYDROData ${CAS_OCAF} ${CAS_MODELER} ${QT_LIBRARIES} ${CPPUNIT_LIBRARIES} HYDROData) - -endif(SALOME_BUILD_TESTS) - #include(../../CMake/CommonInstall.cmake) diff --git a/src/HYDROData/HYDROData.h b/src/HYDROData/HYDROData.h index c6e59e81..2616c84e 100644 --- a/src/HYDROData/HYDROData.h +++ b/src/HYDROData/HYDROData.h @@ -19,18 +19,22 @@ #ifndef HYDRODATA_H #define HYDRODATA_H -#if defined HYDRODATA_EXPORTS -#if defined WIN32 -#define HYDRODATA_EXPORT __declspec( dllexport ) +#ifdef HYDRODATA_STATIC + #define HYDRODATA_EXPORT #else -#define HYDRODATA_EXPORT -#endif -#else -#if defined WIN32 -#define HYDRODATA_EXPORT __declspec( dllimport ) -#else -#define HYDRODATA_EXPORT -#endif + #ifdef HYDRODATA_EXPORTS + #ifdef WIN32 + #define HYDRODATA_EXPORT __declspec( dllexport ) + #else + #define HYDRODATA_EXPORT + #endif + #else + #ifdef WIN32 + #define HYDRODATA_EXPORT __declspec( dllimport ) + #else + #define HYDRODATA_EXPORT + #endif + #endif #endif #endif diff --git a/src/HYDROData/HYDROData_BSplineOperation.cxx b/src/HYDROData/HYDROData_BSplineOperation.cxx index 5b0d4b70..058005d9 100644 --- a/src/HYDROData/HYDROData_BSplineOperation.cxx +++ b/src/HYDROData/HYDROData_BSplineOperation.cxx @@ -22,7 +22,10 @@ #include #include #include + +#ifndef LIGHT_MODE #include +#endif Handle(Geom_BSplineCurve) HYDROData_BSplineOperation::ComputeCurve( const NCollection_Sequence& thePoints, @@ -55,9 +58,11 @@ Handle(Geom_BSplineCurve) HYDROData_BSplineOperation::ComputeCurve( // compute BSpline Handle(Geom_BSplineCurve) aBSpline; +#ifndef LIGHT_MODE if( CurveCreator_Utils::constructBSpline( aHCurvePoints, theIsClosed, aBSpline ) ) return aBSpline; else +#endif return Handle(Geom_BSplineCurve)(); } diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index 55bb858b..2cf4fc27 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -35,7 +35,9 @@ #include "HYDROData_Tool.h" #include "HYDROData_GeomTool.h" +#ifndef LIGHT_MODE #include +#endif #include @@ -1063,14 +1065,19 @@ Handle(HYDROData_SplittedShapesGroup) HYDROData_CalculationCase::addNewSplittedG QString HYDROData_CalculationCase::Export( int theStudyId ) const { +#ifdef LIGHT_MODE + return ""; +#else GEOM::GEOM_Gen_var aGEOMEngine = HYDROData_GeomTool::GetGeomGen(); SALOMEDS::Study_var aDSStudy = HYDROData_GeomTool::GetStudyByID( theStudyId ); QString aGeomObjEntry, anErrorMsg; bool isOK = Export( aGEOMEngine, aDSStudy, aGeomObjEntry, anErrorMsg ); return isOK ? aGeomObjEntry : QString(); +#endif } +#ifndef LIGHT_MODE bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, SALOMEDS::Study_ptr theStudy, QString& theGeomObjEntry, @@ -1284,6 +1291,7 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var return true; } +#endif void HYDROData_CalculationCase::ClearRules( HYDROData_CalculationCase::DataTag theDataTag, const bool theIsSetToUpdate ) diff --git a/src/HYDROData/HYDROData_CalculationCase.h b/src/HYDROData/HYDROData_CalculationCase.h index 77c1481d..4320e4fc 100644 --- a/src/HYDROData/HYDROData_CalculationCase.h +++ b/src/HYDROData/HYDROData_CalculationCase.h @@ -25,9 +25,11 @@ #include #include +#ifndef LIGHT_MODE // IDL includes #include #include CORBA_SERVER_HEADER(GEOM_Gen) +#endif class gp_XY; @@ -301,10 +303,12 @@ public: * \param theErrorMsg the error message * \return true in case of success */ +#ifndef LIGHT_MODE HYDRODATA_EXPORT virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine, SALOMEDS::Study_ptr theStudy, QString& theGeomObjEntry, QString& theErrorMsg ) const; +#endif public: // Public methods to work with Calculation services @@ -440,11 +444,13 @@ private: * \param theSplittedGroups the list of groups * \return true in case of success */ +#ifndef LIGHT_MODE bool Export( GEOM::GEOM_Gen_var theGeomEngine, SALOMEDS::Study_ptr theStudy, const TopTools_ListOfShape& theFaces, const HYDROData_ShapesGroup::SeqOfGroupsDefs& theGroupsDefs, QString& theGeomObjEntry ) const; +#endif void CreateRegionsDef( const Handle(HYDROData_Document)& theDoc, const HYDROData_SplitToZonesTool::SplitDataList& theZones, diff --git a/src/HYDROData/HYDROData_GeomTool.cxx b/src/HYDROData/HYDROData_GeomTool.cxx index a83258e6..037306f3 100644 --- a/src/HYDROData/HYDROData_GeomTool.cxx +++ b/src/HYDROData/HYDROData_GeomTool.cxx @@ -18,6 +18,8 @@ #include "HYDROData_GeomTool.h" +#ifndef LIGHT_MODE + #include #include @@ -195,3 +197,5 @@ QString HYDROData_GeomTool::publishGEOMObject( GEOM::GEOM_Gen_var theGeomEngine, return anEntry; } + +#endif diff --git a/src/HYDROData/HYDROData_GeomTool.h b/src/HYDROData/HYDROData_GeomTool.h index 554aede3..8f87204f 100644 --- a/src/HYDROData/HYDROData_GeomTool.h +++ b/src/HYDROData/HYDROData_GeomTool.h @@ -21,6 +21,7 @@ #include "HYDROData.h" +#ifndef LIGHT_MODE #include class TopoDS_Shape; @@ -108,4 +109,6 @@ public: #endif +#endif + diff --git a/src/HYDROData/HYDROData_Obstacle.cxx b/src/HYDROData/HYDROData_Obstacle.cxx index 1218bbc4..1eeb8a83 100644 --- a/src/HYDROData/HYDROData_Obstacle.cxx +++ b/src/HYDROData/HYDROData_Obstacle.cxx @@ -24,7 +24,9 @@ #include "HYDROData_Tool.h" #include "HYDROData_GeomTool.h" +#ifndef LIGHT_MODE #include +#endif #include #include @@ -218,6 +220,7 @@ bool HYDROData_Obstacle::ImportFromGeomIOR( const TCollection_AsciiString& theIO { bool aRes = false; +#ifndef LIGHT_MODE if ( theIOR.IsEmpty() ) { return aRes; } @@ -234,7 +237,8 @@ bool HYDROData_Obstacle::ImportFromGeomIOR( const TCollection_AsciiString& theIO SetShape3D( aShape ); aRes = true; } - +#endif + return aRes; } @@ -267,6 +271,7 @@ TCollection_AsciiString HYDROData_Obstacle::GetGeomObjectName() const return aRes; } +#ifndef LIGHT_MODE SALOMEDS::Study_var aDSStudy = HYDROData_GeomTool::GetStudyByID( aDocId ); if ( !aDSStudy->_is_nil() ) { @@ -276,7 +281,7 @@ TCollection_AsciiString HYDROData_Obstacle::GetGeomObjectName() const aRes = TCollection_AsciiString( aSObject->GetName() ); } } - +#endif return aRes; } @@ -309,6 +314,7 @@ TopoDS_Shape HYDROData_Obstacle::ImportIGES( const QString& theFilePath ) const { TopoDS_Shape aResShape; +#ifndef LIGHT_MODE // Set "C" numeric locale to save numbers correctly Kernel_Utils::Localizer loc; @@ -343,6 +349,7 @@ TopoDS_Shape HYDROData_Obstacle::ImportIGES( const QString& theFilePath ) const catch(Standard_Failure) { aResShape.Nullify(); } +#endif return aResShape; } @@ -351,6 +358,7 @@ TopoDS_Shape HYDROData_Obstacle::ImportSTEP( const QString& theFilePath ) const { TopoDS_Shape aResShape; +#ifndef LIGHT_MODE // Set "C" numeric locale to save numbers correctly Kernel_Utils::Localizer loc; @@ -454,6 +462,7 @@ TopoDS_Shape HYDROData_Obstacle::ImportSTEP( const QString& theFilePath ) const catch (Standard_Failure) { aResShape.Nullify(); } +#endif return aResShape; } diff --git a/src/HYDROData/HYDROData_PolylineOperator.cxx b/src/HYDROData/HYDROData_PolylineOperator.cxx index 3a4183e8..7e44abef 100644 --- a/src/HYDROData/HYDROData_PolylineOperator.cxx +++ b/src/HYDROData/HYDROData_PolylineOperator.cxx @@ -20,7 +20,9 @@ #include #include +#ifndef LIGHT_MODE #include +#endif #include #include @@ -45,6 +47,7 @@ #include #include #include +#include template void append( std::vector& theList, const std::vector& theList2 ) { @@ -331,7 +334,9 @@ double HYDROData_PolylineOperator::ReduceDeflection( } Handle(Geom_BSplineCurve) aBSpline2; const bool isClosed = theCurve.IsClosed(); +#ifndef LIGHT_MODE if (!CurveCreator_Utils::constructBSpline(aPs2, isClosed, aBSpline2)) +#endif { return -1; } diff --git a/src/HYDROData/HYDROData_PolylineXY.cxx b/src/HYDROData/HYDROData_PolylineXY.cxx index 839e949a..a3942aff 100755 --- a/src/HYDROData/HYDROData_PolylineXY.cxx +++ b/src/HYDROData/HYDROData_PolylineXY.cxx @@ -30,7 +30,9 @@ #include #include +#ifndef LIGHT_MODE #include +#endif #include #include @@ -212,6 +214,9 @@ QColor HYDROData_PolylineXY::DefaultWireColor() bool HYDROData_PolylineXY::ImportFromGeomIOR( const TCollection_AsciiString& theIOR ) { +#ifdef LIGHT_MODE + return false; +#else if ( theIOR.IsEmpty() ) return false; @@ -220,6 +225,7 @@ bool HYDROData_PolylineXY::ImportFromGeomIOR( const TCollection_AsciiString& the return false; return ImportShape( aShape ); +#endif } void HYDROData_PolylineXY::SetGeomObjectEntry( const TCollection_AsciiString& theEntry ) diff --git a/src/HYDROData/HYDROData_StricklerTable.cxx b/src/HYDROData/HYDROData_StricklerTable.cxx index 7a165907..1cd27704 100644 --- a/src/HYDROData/HYDROData_StricklerTable.cxx +++ b/src/HYDROData/HYDROData_StricklerTable.cxx @@ -105,30 +105,28 @@ bool HYDROData_StricklerTable::Export( const TCollection_AsciiString& theFileNam if( aMap.IsNull() ) return false; - std::ofstream aStream( theFileName.ToCString(), std::ios::out | std::ios::binary ); - if( !aStream ) + QFile aFile( theFileName.ToCString() ); + if( !aFile.open( QFile::WriteOnly | QFile::Text ) ) return false; - aStream << GetAttrName().toStdString() << "\r\n"; + QTextStream aStream( &aFile ); + aStream.setCodec( "UTF-8" ); + + aStream << GetAttrName() << "\n"; bool aRes = true; for ( TDataStd_DataMapIteratorOfDataMapOfStringReal it( aMap->GetRealsContainer() ); it.More() && aRes; it.Next() ) { - TCollection_ExtendedString aType = it.Key(); - TCollection_ExtendedString aLine = TCollection_ExtendedString( '\"' ) + aType + TCollection_ExtendedString( '\"' ) + - TCollection_ExtendedString( ' ' ) + TCollection_ExtendedString( it.Value() ); - Standard_PCharacter aBuf = (Standard_PCharacter)malloc( aLine.LengthOfCString() + 1 ); - aStream.write( aBuf, aLine.ToUTF8CString( aBuf ) ); - - QString aColor = QString::number( aMap->GetInteger( aType ), 16 ); - QString anAttrValue = toQString( aMap->GetString( aType ) ); - - aStream << " " << aColor.toStdString() << " " << anAttrValue.toStdString(); - aStream.write( "\r\n", 2 ); - free( aBuf ); + QString aType = toQString( it.Key() ); + aStream << "\"" << aType << "\" " << it.Value(); + + QString aColor = QString::number( aMap->GetInteger( it.Key() ), 16 ).toUpper(); + QString anAttrValue = toQString( aMap->GetString( it.Key() ) ); + + aStream << " " << aColor << " " << anAttrValue << "\n"; } - aStream.close(); + aFile.close(); return aRes; } diff --git a/src/HYDROData/test_HYDROData_BSplineOperation.cxx b/src/HYDROData/test_HYDROData_BSplineOperation.cxx deleted file mode 100644 index 66d27970..00000000 --- a/src/HYDROData/test_HYDROData_BSplineOperation.cxx +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (C) 2014-2015 EDF-R&D -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include - -#include -#include -#include - -const double LOCAL_SELECTION_TOLERANCE = 0.0001; - -void test_HYDROData_BSplineOperation::testCurve() -{ - /*// prepare points: function of sin(x) - NCollection_Sequence aPoints; - for ( double x = 0; x < 6.28; x += 0.1 ) - { - gp_XYZ aPoint( x, sin( x ), 0.0 ); - aPoints.Append( aPoint ); - } - // compute BSpline - HYDROData_BSplineOperation aBSpline( aPoints, false, LOCAL_SELECTION_TOLERANCE ); - - Handle(Geom_BSplineCurve) aBS = aBSpline.Curve(); - CPPUNIT_ASSERT( !aBS.IsNull() ); - CPPUNIT_ASSERT( !aBS->IsClosed() ); - CPPUNIT_ASSERT_EQUAL( aBS->Continuity(), GeomAbs_C2 ); - - // check that values of BSpline are not far from original "sin" function - // in all points of the curve - for ( double x = 0; x < 6.29; x += 0.001 ) - { - double aDiff = aBS->Value( x ).Y() - sin( aBS->Value( x ).X() ); - if ( aDiff < 0 ) aDiff = -aDiff; - CPPUNIT_ASSERT( aDiff < 3.e-6 ); // this number is found manually - }*/ -} - -void test_HYDROData_BSplineOperation::testPath() -{ - /*// prepare points: function of sin(x) - static const double aScale = 10000000.; - - NCollection_Sequence aPoints; - for ( double x = 0; x < 6.28; x += 0.1 ) - { - gp_XYZ aPoint( x * aScale, sin( x ) * aScale, 0.0 ); - aPoints.Append( aPoint ); - } - - // convert to QPainterPath - HYDROData_BSplineOperation aBSpline( aPoints, false, LOCAL_SELECTION_TOLERANCE ); - - CPPUNIT_ASSERT( !aBSpline.Curve().IsNull() ); - - QPainterPath aPath; - aBSpline.ComputePath( aPath ); - CPPUNIT_ASSERT( !aPath.isEmpty() );*/ - - /* - QImage aPic(1300, 600, QImage::Format_RGB32); - QPainter aPainter(&aPic); - aPainter.setBrush(QBrush(Qt::white)); - aPainter.drawPath(aPath); - aPic.save("pic.bmp"); - */ - - /*// check that values of Path are not far from original "sin" function - // in all points of the curve - QList aPolyF = aPath.toSubpathPolygons( QTransform() ); - QList::iterator aFIter = aPolyF.begin(); - for(; aFIter != aPolyF.end();aFIter++) { - QPolygon aPoly = aFIter->toPolygon(); - QPolygon::iterator aPoints = aPoly.begin(); - for(; aPoints != aPoly.end(); aPoints++) { - double aDiff = aPoints->y() / aScale - sin(aPoints->x() / aScale); - if (aDiff < 0) aDiff = -aDiff; - CPPUNIT_ASSERT(aDiff < 4.e-6); // this number is found manually - } - }*/ -} diff --git a/src/HYDROData/test_HYDROData_BSplineOperation.h b/src/HYDROData/test_HYDROData_BSplineOperation.h deleted file mode 100644 index 3d615257..00000000 --- a/src/HYDROData/test_HYDROData_BSplineOperation.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (C) 2014-2015 EDF-R&D -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include - -class test_HYDROData_BSplineOperation : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(test_HYDROData_BSplineOperation); - CPPUNIT_TEST(testCurve); - CPPUNIT_TEST(testPath); - CPPUNIT_TEST_SUITE_END(); - -private: - -public: - - void setUp() {} - - void tearDown() {} - - // checks generation of BSpline curve by points - void testCurve(); - - // checks generation of QPainterPath - void testPath(); - -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_BSplineOperation); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_BSplineOperation, "HYDROData_BSplineOperation"); diff --git a/src/HYDROData/test_HYDROData_CalculationCase.cxx b/src/HYDROData/test_HYDROData_CalculationCase.cxx deleted file mode 100755 index 97bb75a0..00000000 --- a/src/HYDROData/test_HYDROData_CalculationCase.cxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2014-2015 EDF-R&D -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include - -#include - diff --git a/src/HYDROData/test_HYDROData_CalculationCase.h b/src/HYDROData/test_HYDROData_CalculationCase.h deleted file mode 100755 index 650a5f36..00000000 --- a/src/HYDROData/test_HYDROData_CalculationCase.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2014-2015 EDF-R&D -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include - -class Handle_HYDROData_CalculationCase; -class QString; - -class test_HYDROData_CalculationCase : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(test_HYDROData_CalculationCase); - CPPUNIT_TEST_SUITE_END(); - -public: - - void setUp() {} - - void tearDown() {} - -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_CalculationCase); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_CalculationCase, "HYDROData_CalculationCase"); diff --git a/src/HYDROGUI/CMakeLists.txt b/src/HYDROGUI/CMakeLists.txt index 46728208..769496f8 100644 --- a/src/HYDROGUI/CMakeLists.txt +++ b/src/HYDROGUI/CMakeLists.txt @@ -328,24 +328,3 @@ FILE(GLOB GUIXML_DATA "${CMAKE_CURRENT_SOURCE_DIR}/resources/*.xml") FILE(GLOB GUITXT_DATA "${CMAKE_CURRENT_SOURCE_DIR}/resources/*.txt") SET(GUI_DATA ${GUIPNG_DATA} ${GUIXML_DATA} ${GUITXT_DATA}) INSTALL(FILES ${GUI_DATA} DESTINATION ${SALOME_HYDRO_INSTALL_RES_DATA}) - -# tests -if(SALOME_BUILD_TESTS) - - set(TEST_HEADERS - test_HYDROGUI_ListModel.h - ) - - set(TEST_SOURCES - test_HYDROGUI_Main.cxx - test_HYDROGUI_ListModel.cxx - ) - - set(TEST_EXE test_HYDROGUI) - include(../../CMake/CPPUnitTests.cmake) - target_link_libraries(test_HYDROGUI ${CPPUNIT_LIBRARIES} HYDROData HYDROGUI) - - INSTALL(TARGETS test_HYDROGUI EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_BINS}) - -endif(SALOME_BUILD_TESTS) - diff --git a/src/HYDROGUI/HYDROGUI.h b/src/HYDROGUI/HYDROGUI.h index 79004321..ab5b70b0 100644 --- a/src/HYDROGUI/HYDROGUI.h +++ b/src/HYDROGUI/HYDROGUI.h @@ -19,18 +19,22 @@ #ifndef HYDROGUI_H #define HYDROGUI_H -#if defined HYDROGUI_EXPORTS -#if defined WNT -#define HYDRO_EXPORT __declspec( dllexport ) +#ifdef HYDROGUI_STATIC + #define HYDRO_EXPORT #else -#define HYDRO_EXPORT -#endif -#else -#if defined WNT -#define HYDRO_EXPORT __declspec( dllimport ) -#else -#define HYDRO_EXPORT -#endif + #if defined HYDROGUI_EXPORTS + #if defined WNT + #define HYDRO_EXPORT __declspec( dllexport ) + #else + #define HYDRO_EXPORT + #endif + #else + #if defined WNT + #define HYDRO_EXPORT __declspec( dllimport ) + #else + #define HYDRO_EXPORT + #endif + #endif #endif #ifdef WNT diff --git a/src/HYDROGUI/HYDROGUI_ListModel.h b/src/HYDROGUI/HYDROGUI_ListModel.h index 46a8487d..adc0e42c 100644 --- a/src/HYDROGUI/HYDROGUI_ListModel.h +++ b/src/HYDROGUI/HYDROGUI_ListModel.h @@ -33,8 +33,6 @@ const int HYDROGUI_EntryRole = Qt::UserRole + 2; */ class HYDRO_EXPORT HYDROGUI_ListModel : public QAbstractListModel { - Q_OBJECT - public: enum OpType { Top, Up, Down, Bottom, DragAndDrop }; diff --git a/src/HYDRO_tests/CMakeLists.txt b/src/HYDRO_tests/CMakeLists.txt new file mode 100644 index 00000000..82c0156e --- /dev/null +++ b/src/HYDRO_tests/CMakeLists.txt @@ -0,0 +1,126 @@ +#include(../../CMake/Common.cmake) + +set(PROJECT_HEADERS + test_HYDROData_Bathymetry.h + test_HYDROData_Document.h + test_HYDROData_Entity.h + test_HYDROData_Image.h + test_HYDROData_Iterator.h + test_HYDROData_OperationsFactory.h + test_HYDROData_PolylineXY.h + test_HYDROData_Profile.h + test_HYDROData_StricklerTable.h + test_HYDROGUI_ListModel.h +) + +set(PROJECT_SOURCES + test_HYDROData_Bathymetry.cxx + test_HYDROData_Document.cxx + test_HYDROData_Entity.cxx + test_HYDROData_Image.cxx + test_HYDROData_Iterator.cxx + test_HYDROData_Main.cxx + test_HYDROData_OperationsFactory.cxx + test_HYDROData_PolylineXY.cxx + test_HYDROData_Profile.cxx + test_HYDROData_StricklerTable.cxx + test_HYDROGUI_ListModel.cxx + + ../HYDROData/HYDROData_AltitudeObject.cxx + ../HYDROData/HYDROData_Application.cxx + ../HYDROData/HYDROData_ArtificialObject.cxx + ../HYDROData/HYDROData_Bathymetry.cxx + ../HYDROData/HYDROData_BSplineOperation.cxx + ../HYDROData/HYDROData_CalculationCase.cxx + ../HYDROData/HYDROData_Channel.cxx + ../HYDROData/HYDROData_Confluence.cxx + ../HYDROData/HYDROData_Digue.cxx + ../HYDROData/HYDROData_Document.cxx + ../HYDROData/HYDROData_DummyObject3D.cxx + ../HYDROData/HYDROData_Entity.cxx + ../HYDROData/HYDROData_IAltitudeObject.cxx + ../HYDROData/HYDROData_IInterpolator.cxx + ../HYDROData/HYDROData_Image.cxx + ../HYDROData/HYDROData_ImmersibleZone.cxx + ../HYDROData/HYDROData_IPolyline.cxx + ../HYDROData/HYDROData_Iterator.cxx + ../HYDROData/HYDROData_Lambert93.cxx + ../HYDROData/HYDROData_NaturalObject.cxx + ../HYDROData/HYDROData_Object.cxx + ../HYDROData/HYDROData_Obstacle.cxx + ../HYDROData/HYDROData_ObstacleAltitude.cxx + ../HYDROData/HYDROData_OperationsFactory.cxx + ../HYDROData/HYDROData_Pipes.cxx + ../HYDROData/HYDROData_PolylineOperator.cxx + ../HYDROData/HYDROData_PolylineXY.cxx + ../HYDROData/HYDROData_Polyline3D.cxx + ../HYDROData/HYDROData_PriorityQueue.cxx + ../HYDROData/HYDROData_Profile.cxx + ../HYDROData/HYDROData_ProfileUZ.cxx + ../HYDROData/HYDROData_Projection.cxx + ../HYDROData/HYDROData_Region.cxx + ../HYDROData/HYDROData_River.cxx + ../HYDROData/HYDROData_ShapesGroup.cxx + ../HYDROData/HYDROData_ShapesTool.cxx + ../HYDROData/HYDROData_SplittedShapesGroup.cxx + ../HYDROData/HYDROData_SplitToZonesTool.cxx + ../HYDROData/HYDROData_Stream.cxx + ../HYDROData/HYDROData_StreamAltitude.cxx + ../HYDROData/HYDROData_StricklerTable.cxx + ../HYDROData/HYDROData_LandCover.cxx + ../HYDROData/HYDROData_Tool.cxx + ../HYDROData/HYDROData_TopoCurve.cxx + ../HYDROData/HYDROData_Transform.cxx + ../HYDROData/HYDROData_VisualState.cxx + ../HYDROData/HYDROData_Zone.cxx + ../HYDROData/HYDROData_GeomTool.cxx + ../HYDROData/HYDROData_IProfilesInterpolator.cxx + ../HYDROData/HYDROData_LinearInterpolator.cxx + ../HYDROData/HYDROData_InterpolatorsFactory.cxx + ../HYDROData/HYDROData_SinusX.cxx + ../HYDROData/HYDROData_ShapeFile.cxx + ../HYDROData/HYDROData_LandCoverMap.cxx + + ../HYDROGUI/HYDROGUI_ListModel.cxx + ../HYDROGUI/HYDROGUI_DataObject.cxx +) + +add_definitions( + -DLIGHT_MODE -DHYDRODATA_STATIC -DHYDROGUI_STATIC +) + +IF( ${WIN32} ) + add_definitions( -DWNT ) +ENDIF() + +SET( BOOST_INCLUDES $ENV{BOOST_ROOT_DIR}/include/boost-1_52 ) +SET( CPPUNIT_INCLUDES $ENV{CPPUNIT_ROOT_DIR}/include ) +SET( QT_INCLUDES $ENV{QT_ROOT_DIR}/include $ENV{QT_ROOT_DIR}/include/QtCore $ENV{QT_ROOT_DIR}/include/QtGui ) +SET( GUI_INCLUDES $ENV{GUI_ROOT_DIR}/include/salome ) + +link_directories( $ENV{CAS_ROOT_DIR}/win32/libd ) #TODO: more correct for release, linux etc +SET( CAS_LIBRARIES TKernel TKLCAF TKCAF TKCDF TKMath TKG2d TKG3d TKBRep TKGeomBase TKTopAlgo TKGeomAlgo TKBool TKShHealing TKXSBase TKOffset TKHLR TKBO ) + +link_directories( $ENV{QT_ROOT_DIR}/lib ) +SET( QT_LIBRARIES QtCored4 QtGuid4 ) + +link_directories( $ENV{CPPUNIT_ROOT_DIR}/lib ) +SET( CPPUNIT_LIBRARIES cppunitd ) + +link_directories( $ENV{GUI_ROOT_DIR}/lib/salome ) +SET( GUI_LIBRARIES ImageComposer Qtx SUIT LightApp CAM ) + +include_directories( + ${BOOST_INCLUDES} + ${CAS_INCLUDE_DIRS} + ${QT_INCLUDES} + ${CPPUNIT_INCLUDES} + ${GUI_INCLUDES} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../HYDROData + ${CMAKE_CURRENT_SOURCE_DIR}/../HYDROGUI + ${CMAKE_CURRENT_SOURCE_DIR}/../shapelib +) + +add_executable( HYDROData_tests ${PROJECT_SOURCES} ${PROJECT_HEADERS}) +target_link_libraries( HYDROData_tests ${GUI_LIBRARIES} ${CAS_LIBRARIES} ${QT_LIBRARIES} ${CPPUNIT_LIBRARIES} shapelib ) diff --git a/src/HYDROData/test_HYDROData_Bathymetry.cxx b/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx old mode 100755 new mode 100644 similarity index 100% rename from src/HYDROData/test_HYDROData_Bathymetry.cxx rename to src/HYDRO_tests/test_HYDROData_Bathymetry.cxx diff --git a/src/HYDROData/test_HYDROData_Bathymetry.h b/src/HYDRO_tests/test_HYDROData_Bathymetry.h old mode 100755 new mode 100644 similarity index 100% rename from src/HYDROData/test_HYDROData_Bathymetry.h rename to src/HYDRO_tests/test_HYDROData_Bathymetry.h diff --git a/src/HYDROData/test_HYDROData_Document.cxx b/src/HYDRO_tests/test_HYDROData_Document.cxx similarity index 100% rename from src/HYDROData/test_HYDROData_Document.cxx rename to src/HYDRO_tests/test_HYDROData_Document.cxx diff --git a/src/HYDROData/test_HYDROData_Document.h b/src/HYDRO_tests/test_HYDROData_Document.h similarity index 100% rename from src/HYDROData/test_HYDROData_Document.h rename to src/HYDRO_tests/test_HYDROData_Document.h diff --git a/src/HYDROData/test_HYDROData_Entity.cxx b/src/HYDRO_tests/test_HYDROData_Entity.cxx similarity index 100% rename from src/HYDROData/test_HYDROData_Entity.cxx rename to src/HYDRO_tests/test_HYDROData_Entity.cxx diff --git a/src/HYDROData/test_HYDROData_Entity.h b/src/HYDRO_tests/test_HYDROData_Entity.h similarity index 100% rename from src/HYDROData/test_HYDROData_Entity.h rename to src/HYDRO_tests/test_HYDROData_Entity.h diff --git a/src/HYDROData/test_HYDROData_Image.cxx b/src/HYDRO_tests/test_HYDROData_Image.cxx similarity index 100% rename from src/HYDROData/test_HYDROData_Image.cxx rename to src/HYDRO_tests/test_HYDROData_Image.cxx diff --git a/src/HYDROData/test_HYDROData_Image.h b/src/HYDRO_tests/test_HYDROData_Image.h similarity index 100% rename from src/HYDROData/test_HYDROData_Image.h rename to src/HYDRO_tests/test_HYDROData_Image.h diff --git a/src/HYDROData/test_HYDROData_Iterator.cxx b/src/HYDRO_tests/test_HYDROData_Iterator.cxx similarity index 100% rename from src/HYDROData/test_HYDROData_Iterator.cxx rename to src/HYDRO_tests/test_HYDROData_Iterator.cxx diff --git a/src/HYDROData/test_HYDROData_Iterator.h b/src/HYDRO_tests/test_HYDROData_Iterator.h similarity index 100% rename from src/HYDROData/test_HYDROData_Iterator.h rename to src/HYDRO_tests/test_HYDROData_Iterator.h diff --git a/src/HYDROData/test_HYDROData_Main.cxx b/src/HYDRO_tests/test_HYDROData_Main.cxx similarity index 100% rename from src/HYDROData/test_HYDROData_Main.cxx rename to src/HYDRO_tests/test_HYDROData_Main.cxx diff --git a/src/HYDROData/test_HYDROData_OperationsFactory.cxx b/src/HYDRO_tests/test_HYDROData_OperationsFactory.cxx similarity index 100% rename from src/HYDROData/test_HYDROData_OperationsFactory.cxx rename to src/HYDRO_tests/test_HYDROData_OperationsFactory.cxx diff --git a/src/HYDROData/test_HYDROData_OperationsFactory.h b/src/HYDRO_tests/test_HYDROData_OperationsFactory.h similarity index 100% rename from src/HYDROData/test_HYDROData_OperationsFactory.h rename to src/HYDRO_tests/test_HYDROData_OperationsFactory.h diff --git a/src/HYDROData/test_HYDROData_PolylineXY.cxx b/src/HYDRO_tests/test_HYDROData_PolylineXY.cxx similarity index 100% rename from src/HYDROData/test_HYDROData_PolylineXY.cxx rename to src/HYDRO_tests/test_HYDROData_PolylineXY.cxx diff --git a/src/HYDROData/test_HYDROData_PolylineXY.h b/src/HYDRO_tests/test_HYDROData_PolylineXY.h old mode 100755 new mode 100644 similarity index 100% rename from src/HYDROData/test_HYDROData_PolylineXY.h rename to src/HYDRO_tests/test_HYDROData_PolylineXY.h diff --git a/src/HYDROData/test_HYDROData_Profile.cxx b/src/HYDRO_tests/test_HYDROData_Profile.cxx old mode 100755 new mode 100644 similarity index 97% rename from src/HYDROData/test_HYDROData_Profile.cxx rename to src/HYDRO_tests/test_HYDROData_Profile.cxx index a9154867..49872918 --- a/src/HYDROData/test_HYDROData_Profile.cxx +++ b/src/HYDRO_tests/test_HYDROData_Profile.cxx @@ -84,7 +84,8 @@ void test_HYDROData_Profile::testFileImport() TCollection_AsciiString aFileName( aParamFileName.toStdString().c_str() ); - CPPUNIT_ASSERT( HYDROData_Profile::ImportFromFile( aDoc, aFileName ) ); + NCollection_Sequence aBadProfilesList; + CPPUNIT_ASSERT( HYDROData_Profile::ImportFromFile( aDoc, aFileName, aBadProfilesList ) ); int aProfileCount = 0; HYDROData_Iterator aDocIter( aDoc, KIND_PROFILE ); @@ -114,7 +115,7 @@ void test_HYDROData_Profile::testFileImport() CPPUNIT_ASSERT( aGeorefProfile->GetTopShape().IsNull() == false ); - aGeorefProfile->UpdateShape3D(); + aGeorefProfile->Update(); CPPUNIT_ASSERT( aGeorefProfile->GetShape3D().IsNull() == false ); HYDROData_Profile::ProfilePoints aProfilePoints = aGeorefProfile->GetProfilePoints(); @@ -152,7 +153,7 @@ void test_HYDROData_Profile::testCopy() Handle(HYDROData_Profile) aProfile2 = Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) ); - aProfile1->CopyTo( aProfile2 ); + aProfile1->CopyTo( aProfile2, false ); if ( anIsFileCreated ) { diff --git a/src/HYDROData/test_HYDROData_Profile.h b/src/HYDRO_tests/test_HYDROData_Profile.h old mode 100755 new mode 100644 similarity index 100% rename from src/HYDROData/test_HYDROData_Profile.h rename to src/HYDRO_tests/test_HYDROData_Profile.h diff --git a/src/HYDROData/test_HYDROData_StricklerTable.cxx b/src/HYDRO_tests/test_HYDROData_StricklerTable.cxx similarity index 100% rename from src/HYDROData/test_HYDROData_StricklerTable.cxx rename to src/HYDRO_tests/test_HYDROData_StricklerTable.cxx diff --git a/src/HYDROData/test_HYDROData_StricklerTable.h b/src/HYDRO_tests/test_HYDROData_StricklerTable.h similarity index 100% rename from src/HYDROData/test_HYDROData_StricklerTable.h rename to src/HYDRO_tests/test_HYDROData_StricklerTable.h diff --git a/src/HYDROGUI/test_HYDROGUI_ListModel.cxx b/src/HYDRO_tests/test_HYDROGUI_ListModel.cxx similarity index 100% rename from src/HYDROGUI/test_HYDROGUI_ListModel.cxx rename to src/HYDRO_tests/test_HYDROGUI_ListModel.cxx diff --git a/src/HYDROGUI/test_HYDROGUI_ListModel.h b/src/HYDRO_tests/test_HYDROGUI_ListModel.h similarity index 100% rename from src/HYDROGUI/test_HYDROGUI_ListModel.h rename to src/HYDRO_tests/test_HYDROGUI_ListModel.h diff --git a/src/HYDROGUI/test_HYDROGUI_Main.cxx b/src/HYDRO_tests/test_HYDROGUI_Main.cxx similarity index 100% rename from src/HYDROGUI/test_HYDROGUI_Main.cxx rename to src/HYDRO_tests/test_HYDROGUI_Main.cxx -- 2.39.2