Salome HOME
redesigned test system
authorasl <asl@opencascade.com>
Tue, 13 Oct 2015 06:26:32 +0000 (09:26 +0300)
committerasl <asl@opencascade.com>
Tue, 13 Oct 2015 06:26:32 +0000 (09:26 +0300)
64 files changed:
CMakeLists.txt
src/HYDROData/CMakeLists.txt
src/HYDROData/HYDROData.h
src/HYDROData/HYDROData_BSplineOperation.cxx
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROData/HYDROData_CalculationCase.h
src/HYDROData/HYDROData_GeomTool.cxx
src/HYDROData/HYDROData_GeomTool.h
src/HYDROData/HYDROData_Obstacle.cxx
src/HYDROData/HYDROData_PolylineOperator.cxx
src/HYDROData/HYDROData_PolylineXY.cxx
src/HYDROData/HYDROData_StricklerTable.cxx
src/HYDROData/test_HYDROData_BSplineOperation.cxx [deleted file]
src/HYDROData/test_HYDROData_BSplineOperation.h [deleted file]
src/HYDROData/test_HYDROData_Bathymetry.cxx [deleted file]
src/HYDROData/test_HYDROData_Bathymetry.h [deleted file]
src/HYDROData/test_HYDROData_CalculationCase.cxx [deleted file]
src/HYDROData/test_HYDROData_CalculationCase.h [deleted file]
src/HYDROData/test_HYDROData_Document.cxx [deleted file]
src/HYDROData/test_HYDROData_Document.h [deleted file]
src/HYDROData/test_HYDROData_Entity.cxx [deleted file]
src/HYDROData/test_HYDROData_Entity.h [deleted file]
src/HYDROData/test_HYDROData_Image.cxx [deleted file]
src/HYDROData/test_HYDROData_Image.h [deleted file]
src/HYDROData/test_HYDROData_Iterator.cxx [deleted file]
src/HYDROData/test_HYDROData_Iterator.h [deleted file]
src/HYDROData/test_HYDROData_Main.cxx [deleted file]
src/HYDROData/test_HYDROData_OperationsFactory.cxx [deleted file]
src/HYDROData/test_HYDROData_OperationsFactory.h [deleted file]
src/HYDROData/test_HYDROData_PolylineXY.cxx [deleted file]
src/HYDROData/test_HYDROData_PolylineXY.h [deleted file]
src/HYDROData/test_HYDROData_Profile.cxx [deleted file]
src/HYDROData/test_HYDROData_Profile.h [deleted file]
src/HYDROData/test_HYDROData_StricklerTable.cxx [deleted file]
src/HYDROData/test_HYDROData_StricklerTable.h [deleted file]
src/HYDROGUI/CMakeLists.txt
src/HYDROGUI/HYDROGUI.h
src/HYDROGUI/HYDROGUI_ListModel.h
src/HYDROGUI/test_HYDROGUI_ListModel.cxx [deleted file]
src/HYDROGUI/test_HYDROGUI_ListModel.h [deleted file]
src/HYDROGUI/test_HYDROGUI_Main.cxx [deleted file]
src/HYDRO_tests/CMakeLists.txt [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_Bathymetry.cxx [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_Bathymetry.h [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_Document.cxx [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_Document.h [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_Entity.cxx [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_Entity.h [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_Image.cxx [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_Image.h [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_Iterator.cxx [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_Iterator.h [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_Main.cxx [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_OperationsFactory.cxx [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_OperationsFactory.h [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_PolylineXY.cxx [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_PolylineXY.h [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_Profile.cxx [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_Profile.h [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_StricklerTable.cxx [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_StricklerTable.h [new file with mode: 0644]
src/HYDRO_tests/test_HYDROGUI_ListModel.cxx [new file with mode: 0644]
src/HYDRO_tests/test_HYDROGUI_ListModel.h [new file with mode: 0644]
src/HYDRO_tests/test_HYDROGUI_Main.cxx [new file with mode: 0644]

index 601d0ab649a798621ca8709af69a4da9f8cd2b3b..3c46f782b2c78e7266c42b889f4838d9ec21b39f 100644 (file)
@@ -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)
 
index 0a7bfff509c4b921a68e802ee74c1cc2d67e784e..9addb41b163e02a40b0850a8bd4cef682ee17833 100644 (file)
@@ -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)
index c6e59e81e61b6a924ae69efa18be476b1011ac63..2616c84e1db7f88ab38311b0ce3085fa20b60df3 100644 (file)
 #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
index 5b0d4b70b6ae3e10e1ef06fae62c251485c2b4e2..058005d9fdc62d228ad29fc929ecba8f07ac42c7 100644 (file)
 #include <gp_Pnt.hxx>
 #include <TColgp_HArray1OfPnt.hxx>
 #include <QPainterPath>
+
+#ifndef LIGHT_MODE
 #include <CurveCreator_Utils.hxx>
+#endif
 
 Handle(Geom_BSplineCurve) HYDROData_BSplineOperation::ComputeCurve(
   const NCollection_Sequence<gp_XYZ>& 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)();
 }
 
index 55bb858b6d751f8558dd0d01249573e76a30014b..2cf4fc27aa9ebedd70bfcbaf322025c54a880941 100644 (file)
@@ -35,7 +35,9 @@
 #include "HYDROData_Tool.h"
 #include "HYDROData_GeomTool.h"
 
+#ifndef LIGHT_MODE
 #include <GEOMBase.h>
+#endif
 
 #include <QSet>
 
@@ -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 )
index 77c1481d0ad38929a17cbadec8c8116f850eef46..4320e4fc5f71d082dc1bec4d04facc52e82f8554 100644 (file)
 #include <HYDROData_Zone.h>
 #include <HYDROData_Warning.h>
 
+#ifndef LIGHT_MODE
 // IDL includes
 #include <SALOMEconfig.h>
 #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,
index a83258e61f7bff4b896da5ca198a886e923faee6..037306f3534424718fed8c96e4d5d0a5d14f3572 100644 (file)
@@ -18,6 +18,8 @@
 
 #include "HYDROData_GeomTool.h"
 
+#ifndef LIGHT_MODE
+
 #include <TopoDS_Shape.hxx>
 
 #include <BRepTools.hxx>
@@ -195,3 +197,5 @@ QString HYDROData_GeomTool::publishGEOMObject( GEOM::GEOM_Gen_var theGeomEngine,
 
   return anEntry;
 }
+
+#endif
index 554aede3c7e5b6209191433586af4deb31a66b5c..8f87204fa093a50a242fbdfa17daa9e38d60bf8e 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "HYDROData.h"
 
+#ifndef LIGHT_MODE
 #include <GEOM_Client.hxx>
 
 class TopoDS_Shape;
@@ -108,4 +109,6 @@ public:
 
 #endif
 
+#endif
+
 
index 1218bbc4ed6ae14e24c8b08e8b6bca2439eca375..1eeb8a8371a7b0701eea90e1f899a15d39f090fd 100644 (file)
@@ -24,7 +24,9 @@
 #include "HYDROData_Tool.h"
 #include "HYDROData_GeomTool.h"
 
+#ifndef LIGHT_MODE
 #include <Basics_Utils.hxx>
+#endif
 
 #include <BRepTools.hxx>
 #include <BRep_Builder.hxx>
@@ -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;
 }
index 3a4183e8db3fd7b46fa85cdff3508f6b64225d73..7e44abefa551166741ff52efc984e12951d4047a 100644 (file)
@@ -20,7 +20,9 @@
 #include <HYDROData_Document.h>
 #include <HYDROData_TopoCurve.h>
 
+#ifndef LIGHT_MODE
 #include <CurveCreator_Utils.hxx>
+#endif
 
 #include <BRepAdaptor_Curve.hxx>
 #include <BRep_Builder.hxx>
@@ -45,6 +47,7 @@
 #include <TopExp_Explorer.hxx>
 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
 #include <QString>
+#include <Geom_BSplineCurve.hxx>
 
 template<class T> void append( std::vector<T>& theList, const std::vector<T>& 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;
   }
index 839e949a123ba47ce64dd36d253f7dca79cb6e93..a3942aff049e9b8022b344bd456cb28351ce3a52 100755 (executable)
@@ -30,7 +30,9 @@
 #include <BRepBuilderAPI_MakeFace.hxx>
 #include <BRepOffsetAPI_NormalProjection.hxx>
 
+#ifndef LIGHT_MODE
 #include <GEOMBase.h>
+#endif
 
 #include <GeomAPI_ProjectPointOnCurve.hxx>
 #include <GeomAdaptor_Curve.hxx>
@@ -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 )
index 7a16590720ce024879237d099ba57a24ffd9b433..1cd277049952ee19fc29d6b8077c2f465eea8a85 100644 (file)
@@ -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 (file)
index 66d2797..0000000
+++ /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<test_HYDROData_BSplineOperation.h>
-
-#include <HYDROData_BSplineOperation.h>
-#include <gp_Pnt.hxx>
-#include <QTransform>
-
-const double LOCAL_SELECTION_TOLERANCE = 0.0001;
-
-void test_HYDROData_BSplineOperation::testCurve()
-{
-  /*// prepare points: function of sin(x)
-  NCollection_Sequence<gp_XYZ> 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<gp_XYZ> 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<QPolygonF> aPolyF = aPath.toSubpathPolygons( QTransform() );
-  QList<QPolygonF>::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 (file)
index 3d61525..0000000
+++ /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 <cppunit/extensions/HelperMacros.h>
-
-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_Bathymetry.cxx b/src/HYDROData/test_HYDROData_Bathymetry.cxx
deleted file mode 100755 (executable)
index e3b2509..0000000
+++ /dev/null
@@ -1,197 +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 <test_HYDROData_Bathymetry.h>
-
-#include <HYDROData_Document.h>
-#include <HYDROData_Tool.h>
-#include <HYDROData_Bathymetry.h>
-
-#include <gp_XY.hxx>
-#include <gp_XYZ.hxx>
-
-#include <QDir>
-#include <QFile>
-#include <QTextStream>
-
-#include <gp_Pnt2d.hxx>
-
-void generateOne( QTextStream& theStream,
-                  double theFirstX, double theFirstY,
-                  double theLastX, double theLastY )
-{
-  const int aNbPoints = 50;
-
-  double aComDist = gp_Pnt2d( theFirstX, theFirstY ).Distance( gp_Pnt2d( theLastX, theLastY ) );
-  double aStep = aComDist / (double)aNbPoints;
-
-  double aStepZ = -5;
-  double aCurDist = 0.0;
-  for ( int i = 0; i <= aNbPoints; ++i )
-  {
-    double aRatio = ( aCurDist / ( aComDist - aCurDist ) );
-
-    double anX = ( theFirstX + aRatio * theLastX ) / ( 1 + aRatio );
-    double anY = ( theFirstY + aRatio * theLastY ) / ( 1 + aRatio );
-    double aZ = aStepZ * aStepZ + sin( (float)rand() );
-    theStream << anX << " " << anY << " " << aZ << " \n";
-
-    aCurDist += aStep;
-    aStepZ += 0.2;
-  }
-}
-
-bool test_HYDROData_Bathymetry::createTestFile( const QString& theFileName )
-{
-  QFile aTmpFile( theFileName );
-  if ( !aTmpFile.open( QIODevice::WriteOnly | QIODevice::Text ) )
-    return false;
-
-  {
-    QTextStream anOutStream( &aTmpFile );
-
-    srand( 4587 );
-    generateOne( anOutStream, 0, 5, 0, -5 );
-    generateOne( anOutStream, 10, 5, 10, -5 );
-    generateOne( anOutStream, 20, 5, 20, -5 );
-    generateOne( anOutStream, 30, 5, 30, -5 );
-    generateOne( anOutStream, 40, 5, 40, -5 );
-    generateOne( anOutStream, 45.833271, 6.703101, 50.85397, -3.794724 );
-    generateOne( anOutStream, 50.85397, 11.267372, 56.787525, 2.367043 );
-    generateOne( anOutStream, 52.67968, 16.516285, 62.721077, 10.354518 );
-    generateOne( anOutStream, 55.190029, 23.819118, 65.23143, 17.657352 );
-    generateOne( anOutStream, 58.385021, 31.806595, 68.198204, 23.819118 );
-    generateOne( anOutStream, 65.916069, 38.653004, 75.044609, 27.470537 );
-    generateOne( anOutStream, 76.870323, 41.847992, 82.575661, 28.38339 );
-    generateOne( anOutStream, 92.845276, 40.022282, 91.932419, 26.557682 );
-    generateOne( anOutStream, 106.081657, 35.686226, 98.778824, 21.99341 );
-    generateOne( anOutStream, 119.774475, 29.980886, 106.994514, 14.91879 );
-    generateOne( anOutStream, 133.239075, 26.785896, 115.666634, 5.790246 );
-    generateOne( anOutStream, 150.811523, 20.167702, 125.47982, -4.707579 );
-    generateOne( anOutStream, 163.591476, 13.777717, 135.977631, -12.92327 );
-    generateOne( anOutStream, 183.446045, 11.267367, 151.496155, -24.105736 );
-    generateOne( anOutStream, 197.367081, 8.98523100, 172.720016, -31.180355 );
-    generateOne( anOutStream, 214.026672, 9.669872, 197.823502, -38.483189 );
-    generateOne( anOutStream, 235.706985, 9.89809100, 220.873108, -47.155304 );
-    generateOne( anOutStream, 266.744019, 9.213447, 248.715134, -58.565987 );
-    generateOne( anOutStream, 307.366028, 10.354514, 278.611145, -67.922737 );
-    generateOne( anOutStream, 342.510925, 7.159524, 316.951019, -84.81053 );
-    generateOne( anOutStream, 384.659393, -4.55408, 350.913635, -100.02983 );
-    generateOne( anOutStream, 443.097107, -21.015415, 391.243927, -118.960365 );
-    generateOne( anOutStream, 500.711792, -34.184483, 440.62793, -147.7677 );
-    generateOne( anOutStream, 547.626587, -52.291954, 482.604309, -169.990509 );
-    generateOne( anOutStream, 589.603027, -68.753288, 534.45752, -193.8594 );
-    generateOne( anOutStream, 633.225525, -97.560631, 569.026306, -206.205444 );
-    generateOne( anOutStream, 673.555786, -120.606499, 601.948975, -224.312912 );
-    generateOne( anOutStream, 719.647522, -148.590775, 654.625305, -248.181854 );
-    generateOne( anOutStream, 770.677673, -183.982635, 708.947693, -278.635315 );
-    generateOne( anOutStream, 824.177002, -225.959045, 742.69342, -314.027191 );
-    generateOne( anOutStream, 855.937317, -260.368958, 793.05932, -341.853638 );
-    generateOne( anOutStream, 884.168213, -294.37439, 838.6137700, -355.969116 );
-    generateOne( anOutStream, 915.607178, -327.096588, 875.185669, -366.234894 );
-    generateOne( anOutStream, 940.630066, -348.269775, 903.416565, -381.633575 );
-    generateOne( anOutStream, 963.728088, -370.726166, 936.780396, -397.032257 );
-    generateOne( anOutStream, 983.618042, -390.61615, 959.878418, -411.789337 );
-    generateOne( anOutStream, 999.658325, -407.939667, 978.485107, -425.904785 );
-    generateOne( anOutStream, 1018.265076, -422.696716, 996.450256, -443.228302 );
-    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 );
-  }
-
-  aTmpFile.close();
-
-  return true;
-}
-
-void test_HYDROData_Bathymetry::testFileImport()
-{
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
-
-  Handle(HYDROData_Bathymetry) aBathymetry = 
-    Handle(HYDROData_Bathymetry)::DownCast( aDoc->CreateObject( KIND_BATHYMETRY ) );
-
-  QString aFileName = QDir::tempPath() + QDir::separator() + "test.xyz";
-  if ( !createTestFile( aFileName ) )
-    return; // No file has been created
-
-  CPPUNIT_ASSERT( aBathymetry->ImportFromFile( aFileName.toStdString().c_str() ) );
-
-  HYDROData_Bathymetry::AltitudePoints anAltitudePoints = aBathymetry->GetAltitudePoints();
-  CPPUNIT_ASSERT( anAltitudePoints.Length() == 20 );
-
-  gp_XY aTestPoint( 1, 1 );
-  double anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint );
-  CPPUNIT_ASSERT( ValuesEquals( anAltitude, 10.0 ) );
-
-  aTestPoint = gp_XY( 0.5, 0.5 );
-  anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint );
-  CPPUNIT_ASSERT( ValuesEquals( anAltitude, 5.0 ) );
-
-  aTestPoint = gp_XY( 1.5, 1 );
-  anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint );
-  CPPUNIT_ASSERT( ValuesEquals( anAltitude, 10.0 ) );
-
-  aTestPoint = gp_XY( 1.5, 0.7 );
-  anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint );
-  CPPUNIT_ASSERT( ValuesEquals( anAltitude, 7.0 ) );
-
-  aTestPoint = gp_XY( 1.5, -0.7 );
-  anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint );
-  CPPUNIT_ASSERT( ValuesEquals( anAltitude, HYDROData_Bathymetry::GetInvalidAltitude() ) );
-
-  aTestPoint = gp_XY( 2, 3.5 );
-  anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint );
-  CPPUNIT_ASSERT( ValuesEquals( anAltitude, 35.0 ) );
-
-  aDoc->Close();
-}
-
-
-void test_HYDROData_Bathymetry::testCopy()
-{
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
-  
-  Handle(HYDROData_Bathymetry) aBathymetry1 = 
-    Handle(HYDROData_Bathymetry)::DownCast( aDoc->CreateObject( KIND_BATHYMETRY ) );
-
-  QString aFileName = QDir::tempPath() + QDir::separator() + "test.xyz";
-
-  bool anIsFileCreated = createTestFile( aFileName );
-  
-  if ( anIsFileCreated )
-  {
-    CPPUNIT_ASSERT( aBathymetry1->ImportFromFile( aFileName.toStdString().c_str() ) );
-
-    HYDROData_Bathymetry::AltitudePoints anAltitudePoints = aBathymetry1->GetAltitudePoints();
-    CPPUNIT_ASSERT( anAltitudePoints.Length() == 20 );
-  }
-
-  Handle(HYDROData_Bathymetry) aBathymetry2 = 
-    Handle(HYDROData_Bathymetry)::DownCast( aDoc->CreateObject( KIND_BATHYMETRY ) );
-
-  aBathymetry1->CopyTo( aBathymetry2, true );
-
-  if ( anIsFileCreated )
-  {
-    HYDROData_Bathymetry::AltitudePoints anAltitudePoints = aBathymetry2->GetAltitudePoints();
-    CPPUNIT_ASSERT( anAltitudePoints.Length() == 20 );
-  }
-
-  aDoc->Close();
-}
diff --git a/src/HYDROData/test_HYDROData_Bathymetry.h b/src/HYDROData/test_HYDROData_Bathymetry.h
deleted file mode 100755 (executable)
index 421933c..0000000
+++ /dev/null
@@ -1,49 +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 <cppunit/extensions/HelperMacros.h>
-
-class Handle_HYDROData_Bathymetry;
-class QString;
-
-class test_HYDROData_Bathymetry : public CppUnit::TestFixture {
-  CPPUNIT_TEST_SUITE(test_HYDROData_Bathymetry);
-  CPPUNIT_TEST(testFileImport);
-  CPPUNIT_TEST(testCopy);
-  CPPUNIT_TEST_SUITE_END();
-
-private:
-
-  static bool                             createTestFile( const QString& theFileName );
-
-public:
-
-  void                                    setUp() {}
-
-  void                                    tearDown() {}
-
-  // checks file importing information
-  void                                    testFileImport();
-
-  // checks the copy/paste mechanism
-  void                                    testCopy();
-
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_Bathymetry);
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_Bathymetry, "HYDROData_Bathymetry");
diff --git a/src/HYDROData/test_HYDROData_CalculationCase.cxx b/src/HYDROData/test_HYDROData_CalculationCase.cxx
deleted file mode 100755 (executable)
index 97bb75a..0000000
+++ /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 <test_HYDROData_CalculationCase.h>
-
-#include <HYDROData_CalculationCase.h>
-
diff --git a/src/HYDROData/test_HYDROData_CalculationCase.h b/src/HYDROData/test_HYDROData_CalculationCase.h
deleted file mode 100755 (executable)
index 650a5f3..0000000
+++ /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 <cppunit/extensions/HelperMacros.h>
-
-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/HYDROData/test_HYDROData_Document.cxx b/src/HYDROData/test_HYDROData_Document.cxx
deleted file mode 100644 (file)
index 9469ec3..0000000
+++ /dev/null
@@ -1,108 +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<test_HYDROData_Document.h>
-
-#include <HYDROData_Document.h>
-#include <QFile>
-
-void test_HYDROData_Document::testSaveOpen()
-{
-  // temporarly created file name (in the current directory)
-  const char* aTestFile = "TestDoc.cbf";
-  // save
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
-  CPPUNIT_ASSERT(!aDoc.IsNull());
-  // keep some saved information to check after retreive
-  aDoc->NewID();
-  int anID = aDoc->NewID();
-  Data_DocError aStatus = aDoc->Save(aTestFile);
-  CPPUNIT_ASSERT(aStatus == DocError_OK);
-  aDoc->Close();
-  CPPUNIT_ASSERT(!HYDROData_Document::HasDocument(1));
-
-  // open
-  aStatus = HYDROData_Document::Load(aTestFile, 2);
-  CPPUNIT_ASSERT(aStatus == DocError_OK);
-  CPPUNIT_ASSERT(HYDROData_Document::HasDocument(2));
-  aDoc = HYDROData_Document::Document(2);
-  CPPUNIT_ASSERT(!aDoc.IsNull());
-  // check that retreived correctly
-  CPPUNIT_ASSERT(aDoc->NewID() == anID + 1);
-
-  // remove the created file using Qt functionality
-  QFile aFile(aTestFile);
-  aFile.remove();
-
-  aDoc->Close();
-}
-
-void test_HYDROData_Document::testOperations()
-{
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
-  CPPUNIT_ASSERT(!aDoc.IsNull());
-  CPPUNIT_ASSERT(!aDoc->IsOperation());
-  CPPUNIT_ASSERT(!aDoc->IsModified());
-  // commit operation
-  aDoc->StartOperation();
-  CPPUNIT_ASSERT(aDoc->IsOperation());
-  int anID = aDoc->NewID();
-  aDoc->CommitOperation();
-  CPPUNIT_ASSERT(!aDoc->IsOperation());
-  CPPUNIT_ASSERT(aDoc->IsModified());
-  // abort operation
-  aDoc->StartOperation();
-  CPPUNIT_ASSERT(aDoc->IsOperation());
-  int anIDAborted = aDoc->NewID();
-  aDoc->AbortOperation();
-  CPPUNIT_ASSERT(!aDoc->IsOperation());
-  CPPUNIT_ASSERT(aDoc->IsModified());
-
-  CPPUNIT_ASSERT(anID + 1 == aDoc->NewID());
-
-  aDoc->Close();
-}
-
-void test_HYDROData_Document::testUndoRedo()
-{
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
-  CPPUNIT_ASSERT(!aDoc.IsNull());
-  CPPUNIT_ASSERT(!aDoc->CanUndo());
-  CPPUNIT_ASSERT(!aDoc->CanRedo());
-  // commit operation
-  aDoc->StartOperation();
-  CPPUNIT_ASSERT(aDoc->IsOperation());
-  int anID = aDoc->NewID();
-  aDoc->CommitOperation();
-  CPPUNIT_ASSERT(aDoc->CanUndo());
-  CPPUNIT_ASSERT(!aDoc->CanRedo());
-  CPPUNIT_ASSERT(aDoc->IsModified());
-  // undo
-  aDoc->Undo();
-  CPPUNIT_ASSERT(!aDoc->CanUndo());
-  CPPUNIT_ASSERT(aDoc->CanRedo());
-  CPPUNIT_ASSERT(anID == aDoc->NewID());
-  CPPUNIT_ASSERT(!aDoc->IsModified());
-  // redo
-  aDoc->Redo();
-  CPPUNIT_ASSERT(aDoc->CanUndo());
-  CPPUNIT_ASSERT(!aDoc->CanRedo());
-  CPPUNIT_ASSERT(aDoc->IsModified());
-
-  aDoc->Close();
-}
diff --git a/src/HYDROData/test_HYDROData_Document.h b/src/HYDROData/test_HYDROData_Document.h
deleted file mode 100644 (file)
index cec13ec..0000000
+++ /dev/null
@@ -1,47 +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 <cppunit/extensions/HelperMacros.h>
-
-class test_HYDROData_Document : public CppUnit::TestFixture {
-  CPPUNIT_TEST_SUITE(test_HYDROData_Document);
-  CPPUNIT_TEST(testSaveOpen);
-  CPPUNIT_TEST(testOperations);
-  CPPUNIT_TEST(testUndoRedo);
-  CPPUNIT_TEST_SUITE_END();
-
-private:
-
-public:
-
-  void setUp() {}
-
-  void tearDown() {}
-
-  // checks the save and open document as a file
-  void testSaveOpen();
-
-  // checks the operations management: open/commit/abort, etc
-  void testOperations();
-
-  // checks the operations undo/redo
-  void testUndoRedo();
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_Document);
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_Document, "HYDROData_Document");
diff --git a/src/HYDROData/test_HYDROData_Entity.cxx b/src/HYDROData/test_HYDROData_Entity.cxx
deleted file mode 100644 (file)
index e55530b..0000000
+++ /dev/null
@@ -1,66 +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 <test_HYDROData_Entity.h>
-
-#include <HYDROData_Document.h>
-#include <HYDROData_Entity.h>
-
-#include <QString>
-
-void test_HYDROData_Entity::testName()
-{
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
-
-  Handle(HYDROData_Entity) anObj = aDoc->CreateObject(KIND_IMAGE); // any object
-  static const QString aName("test_name");
-  anObj->SetName(aName);
-  CPPUNIT_ASSERT_EQUAL(aName.toStdString(), anObj->GetName().toStdString());
-  
-  aDoc->Close();
-}
-
-void test_HYDROData_Entity::testRemove()
-{
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
-  
-  Handle(HYDROData_Entity) anObj = aDoc->CreateObject(KIND_IMAGE); // any object
-  CPPUNIT_ASSERT(!anObj->IsRemoved());
-  anObj->Remove();
-  CPPUNIT_ASSERT(anObj->IsRemoved());
-
-  aDoc->Close();
-}
-
-void test_HYDROData_Entity::testCopy()
-{
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
-
-  Handle(HYDROData_Entity) anObj = aDoc->CreateObject(KIND_IMAGE); // any object
-  static const QString aName("test_name");
-  anObj->SetName(aName);
-
-  Handle(HYDROData_Entity) aCopy = aDoc->CreateObject(KIND_IMAGE); // object for copy
-  CPPUNIT_ASSERT(aCopy->GetName().isEmpty());
-  anObj->CopyTo(aCopy, true);
-
-  // check the copied object has same name as original
-  CPPUNIT_ASSERT_EQUAL(aName.toStdString(), aCopy->GetName().toStdString());
-
-  aDoc->Close();
-}
diff --git a/src/HYDROData/test_HYDROData_Entity.h b/src/HYDROData/test_HYDROData_Entity.h
deleted file mode 100644 (file)
index 8a0dec7..0000000
+++ /dev/null
@@ -1,47 +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 <cppunit/extensions/HelperMacros.h>
-
-class test_HYDROData_Entity : public CppUnit::TestFixture {
-  CPPUNIT_TEST_SUITE(test_HYDROData_Entity);
-  CPPUNIT_TEST(testName);
-  CPPUNIT_TEST(testRemove);
-  CPPUNIT_TEST(testCopy);
-  CPPUNIT_TEST_SUITE_END();
-
-private:
-
-public:
-
-  void setUp() {}
-
-  void tearDown() {}
-
-  // checks the "name" methods
-  void testName();
-
-  // checks the remove of object
-  void testRemove();
-
-  // checks the copying of object
-  void testCopy();
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_Entity);
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_Entity, "HYDROData_Entity");
diff --git a/src/HYDROData/test_HYDROData_Image.cxx b/src/HYDROData/test_HYDROData_Image.cxx
deleted file mode 100644 (file)
index ddeeeb8..0000000
+++ /dev/null
@@ -1,166 +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<test_HYDROData_Image.h>
-
-#include <HYDROData_Document.h>
-#include <HYDROData_Image.h>
-#include <QPainter>
-
-static QImage TestImage() {
-  QImage aPic(50, 40, QImage::Format_RGB32);
-  QPainter aPainter(&aPic);
-  aPainter.drawEllipse(6, 7, 38, 30);
-  aPainter.drawLine(0, 40, 10, 0);
-  aPainter.drawLine(10, 0, 25, 35);
-  aPainter.drawLine(25, 35, 40, 0);
-  aPainter.drawLine(40, 0, 50, 40);
-  return aPic;
-}
-
-void test_HYDROData_Image::testQImage()
-{
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
-
-  Handle(HYDROData_Image) anImage = 
-    Handle(HYDROData_Image)::DownCast(aDoc->CreateObject(KIND_IMAGE));
-  // empty image
-  QImage anEmpty = anImage->Image();
-  CPPUNIT_ASSERT(anEmpty.isNull());
-
-  // prepare Qt Image for testing
-  QImage aPic(TestImage());
-  anImage->SetImage(aPic);
-  QImage aRestored = anImage->Image();
-
-  CPPUNIT_ASSERT(!aRestored.isNull());
-  //aRestored.save("pic2.bmp");
-  CPPUNIT_ASSERT(aPic == aRestored);
-
-  aDoc->Close();
-}
-
-void test_HYDROData_Image::testTrsf()
-{
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
-
-  Handle(HYDROData_Image) anImage = 
-    Handle(HYDROData_Image)::DownCast(aDoc->CreateObject(KIND_IMAGE));
-  // empty trsf
-  QTransform anEmpty = anImage->Trsf();
-  CPPUNIT_ASSERT(anEmpty.isIdentity());
-
-  // prepare Qt transformation for testing
-  QTransform aTrsf;
-  aTrsf.translate(50, 50);
-  aTrsf.rotate(45);
-  aTrsf.scale(0.5, 1.0);
-
-  anImage->SetTrsf(aTrsf);
-  QTransform aRestored = anImage->Trsf();
-
-  CPPUNIT_ASSERT(!aRestored.isIdentity());
-  CPPUNIT_ASSERT(aTrsf == aRestored);
-
-  aDoc->Close();
-}
-
-void test_HYDROData_Image::testReferences()
-{
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
-
-  Handle(HYDROData_Image) anImage1 = 
-    Handle(HYDROData_Image)::DownCast(aDoc->CreateObject(KIND_IMAGE));
-  Handle(HYDROData_Image) anImage2 = 
-    Handle(HYDROData_Image)::DownCast(aDoc->CreateObject(KIND_IMAGE));
-  Handle(HYDROData_Image) anImage3 = 
-    Handle(HYDROData_Image)::DownCast(aDoc->CreateObject(KIND_IMAGE));
-
-  // check initially there is no references
-  CPPUNIT_ASSERT_EQUAL(anImage3->NbReferences(), 0);
-
-  // append reference
-  anImage3->AppendReference(anImage1);
-  CPPUNIT_ASSERT_EQUAL(anImage3->NbReferences(), 1);
-  CPPUNIT_ASSERT(IsEqual(anImage3->Reference(0), anImage1));
-
-  // change reference
-  anImage3->ChangeReference(0, anImage2);
-  CPPUNIT_ASSERT_EQUAL(anImage3->NbReferences(), 1);
-  CPPUNIT_ASSERT(IsEqual(anImage3->Reference(0), anImage2));
-
-  // append one more reference
-  anImage3->AppendReference(anImage1);
-  CPPUNIT_ASSERT_EQUAL(anImage3->NbReferences(), 2);
-  CPPUNIT_ASSERT(IsEqual(anImage3->Reference(0), anImage2));
-  CPPUNIT_ASSERT(IsEqual(anImage3->Reference(1), anImage1));
-
-  // remove reference
-  anImage3->RemoveReference(0);
-  CPPUNIT_ASSERT_EQUAL(anImage3->NbReferences(), 1);
-  CPPUNIT_ASSERT(IsEqual(anImage3->Reference(0), anImage1));
-
-  // remove reference
-  anImage3->RemoveReference(0);
-  CPPUNIT_ASSERT_EQUAL(anImage3->NbReferences(), 0);
-
-  // append two references once again and remove all references
-  anImage3->ChangeReference(0, anImage1);
-  anImage3->ChangeReference(1, anImage2);
-  CPPUNIT_ASSERT_EQUAL(anImage3->NbReferences(), 2);
-  CPPUNIT_ASSERT(IsEqual(anImage3->Reference(0), anImage1));
-  CPPUNIT_ASSERT(IsEqual(anImage3->Reference(1), anImage2));
-  anImage3->ClearReferences();
-  CPPUNIT_ASSERT_EQUAL(anImage3->NbReferences(), 0);
-
-  aDoc->Close();
-}
-
-void test_HYDROData_Image::testCopy()
-{
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
-
-  Handle(HYDROData_Image) anImage1 = 
-    Handle(HYDROData_Image)::DownCast(aDoc->CreateObject(KIND_IMAGE));
-  // fill image 1
-  anImage1->SetImage(TestImage());
-
-  QTransform aTrsf;
-  aTrsf.translate(50, 50);
-  aTrsf.rotate(45);
-  aTrsf.scale(0.5, 1.0);
-  anImage1->SetTrsf(aTrsf);
-
-  Handle(HYDROData_Image) anImage2 = 
-    Handle(HYDROData_Image)::DownCast(aDoc->CreateObject(KIND_IMAGE));
-
-  anImage1->AppendReference(anImage2);
-
-  // copy image to the new one
-  Handle(HYDROData_Image) anImage3 = 
-    Handle(HYDROData_Image)::DownCast(aDoc->CreateObject(KIND_IMAGE));
-  anImage1->CopyTo(anImage3, true);
-
-  // check all fields are correctly copied
-  CPPUNIT_ASSERT(anImage1->Image() == anImage3->Image());
-  CPPUNIT_ASSERT(anImage1->Trsf() == anImage3->Trsf());
-  CPPUNIT_ASSERT_EQUAL(anImage3->NbReferences(), 1);
-  CPPUNIT_ASSERT(IsEqual(anImage3->Reference(0), anImage2));
-
-  aDoc->Close();
-}
diff --git a/src/HYDROData/test_HYDROData_Image.h b/src/HYDROData/test_HYDROData_Image.h
deleted file mode 100644 (file)
index c649ece..0000000
+++ /dev/null
@@ -1,51 +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 <cppunit/extensions/HelperMacros.h>
-
-class test_HYDROData_Image : public CppUnit::TestFixture {
-  CPPUNIT_TEST_SUITE(test_HYDROData_Image);
-  CPPUNIT_TEST(testQImage);
-  CPPUNIT_TEST(testTrsf);
-  CPPUNIT_TEST(testReferences);
-  CPPUNIT_TEST(testCopy);
-  CPPUNIT_TEST_SUITE_END();
-
-private:
-
-public:
-
-  void setUp() {}
-
-  void tearDown() {}
-
-  // checks save/restore QImages information
-  void testQImage();
-
-  // checks the transformations
-  void testTrsf();
-
-  // checks the references management
-  void testReferences();
-
-  // checks the image properties copy/paste
-  void testCopy();
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_Image);
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_Image, "HYDROData_Image");
diff --git a/src/HYDROData/test_HYDROData_Iterator.cxx b/src/HYDROData/test_HYDROData_Iterator.cxx
deleted file mode 100644 (file)
index 7381a4e..0000000
+++ /dev/null
@@ -1,80 +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<test_HYDROData_Iterator.h>
-
-#include <HYDROData_Document.h>
-#include <HYDROData_Iterator.h>
-
-#include <QString>
-
-void test_HYDROData_Iterator::testOneKind()
-{
-  static const QString aName1("test_name1");
-  static const QString aName2("test_name2");
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
-
-  Handle(HYDROData_Entity) anObj = aDoc->CreateObject(KIND_IMAGE); // image object
-  anObj->SetName(aName1);
-  // first HYDROData_Entity must be destroyed because there is no hander pointer naymore
-  anObj = aDoc->CreateObject(KIND_IMAGE); // second image object
-  anObj->SetName(aName2);
-
-  HYDROData_Iterator anIter(aDoc, KIND_IMAGE);
-  CPPUNIT_ASSERT(anIter.More());
-  CPPUNIT_ASSERT(!anIter.Current().IsNull());
-  CPPUNIT_ASSERT_EQUAL(aName1.toStdString(), anIter.Current()->GetName().toStdString());
-
-  anIter.Next();
-  CPPUNIT_ASSERT(anIter.More());
-  CPPUNIT_ASSERT(!anIter.Current().IsNull());
-  CPPUNIT_ASSERT_EQUAL(aName2.toStdString(), anIter.Current()->GetName().toStdString());
-
-  anIter.Next();
-  CPPUNIT_ASSERT(!anIter.More());
-
-  aDoc->Close();
-}
-
-void test_HYDROData_Iterator::testAllKinds()
-{
-  static const QString aName1("test_name1");
-  static const QString aName2("test_name2");
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
-
-  Handle(HYDROData_Entity) anObj = aDoc->CreateObject(KIND_IMAGE); // image object
-  anObj->SetName(aName1);
-  // first HYDROData_Entity must be destroyed because there is no hander pointer naymore
-  anObj = aDoc->CreateObject(KIND_IMAGE); // second image object
-  anObj->SetName(aName2);
-
-  HYDROData_Iterator anIter(aDoc, KIND_UNKNOWN);
-  CPPUNIT_ASSERT(anIter.More());
-  CPPUNIT_ASSERT(!anIter.Current().IsNull());
-  CPPUNIT_ASSERT_EQUAL(aName1.toStdString(), anIter.Current()->GetName().toStdString());
-
-  anIter.Next();
-  CPPUNIT_ASSERT(anIter.More());
-  CPPUNIT_ASSERT(!anIter.Current().IsNull());
-  CPPUNIT_ASSERT_EQUAL(aName2.toStdString(), anIter.Current()->GetName().toStdString());
-
-  anIter.Next();
-  CPPUNIT_ASSERT(!anIter.More());
-
-  aDoc->Close();
-}
diff --git a/src/HYDROData/test_HYDROData_Iterator.h b/src/HYDROData/test_HYDROData_Iterator.h
deleted file mode 100644 (file)
index 1ba38a6..0000000
+++ /dev/null
@@ -1,43 +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 <cppunit/extensions/HelperMacros.h>
-
-class test_HYDROData_Iterator : public CppUnit::TestFixture {
-  CPPUNIT_TEST_SUITE(test_HYDROData_Iterator);
-  CPPUNIT_TEST(testOneKind);
-  CPPUNIT_TEST(testAllKinds);
-  CPPUNIT_TEST_SUITE_END();
-
-private:
-
-public:
-
-  void setUp() {}
-
-  void tearDown() {}
-
-  // checks iteration by one kind
-  void testOneKind();
-
-  // checks iteration by all kinds
-  void testAllKinds();
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_Iterator);
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_Iterator, "HYDROData_Iterator");
diff --git a/src/HYDROData/test_HYDROData_Main.cxx b/src/HYDROData/test_HYDROData_Main.cxx
deleted file mode 100644 (file)
index e3796b3..0000000
+++ /dev/null
@@ -1,68 +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 <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/CompilerOutputter.h>
-#include <cppunit/TestResult.h>
-#include <cppunit/TestResultCollector.h>
-#include <cppunit/TestRunner.h>
-#include <cppunit/TextTestProgressListener.h>
-#include <stdexcept>
-
-int 
-  main( int argc, char* argv[] )
-{
-  std::string testPath = (argc > 1) ? std::string(argv[1]) : "";
-
-  // Create the event manager and test controller
-  CppUnit::TestResult controller;
-
-  // Add a listener that colllects test result
-  CppUnit::TestResultCollector result;
-  controller.addListener( &result );        
-
-  // Add a listener that print dots as test run.
-  CppUnit::TextTestProgressListener progress;
-  controller.addListener( &progress );      
-
-  CppUnit::TestFactoryRegistry& registry = 
-    CppUnit::TestFactoryRegistry::getRegistry();
-  // Add the top suite to the test runner
-  CppUnit::TestRunner runner;
-  runner.addTest( registry.makeTest() );   
-  try
-  {
-    std::cout << "Running "  <<  testPath;
-    runner.run( controller, testPath );
-
-    std::cerr << std::endl;
-
-    // Print test in a compiler compatible format.
-    CppUnit::CompilerOutputter outputter( &result, std::cerr );
-    outputter.write();                      
-  }
-  catch ( std::invalid_argument &e )  // Test path not resolved
-  {
-    std::cerr  <<  std::endl  
-      <<  "ERROR: "  <<  e.what()
-      << std::endl;
-    return 0;
-  }
-
-  return result.wasSuccessful() ? 0 : 1;
-}
diff --git a/src/HYDROData/test_HYDROData_OperationsFactory.cxx b/src/HYDROData/test_HYDROData_OperationsFactory.cxx
deleted file mode 100644 (file)
index f9c08ec..0000000
+++ /dev/null
@@ -1,100 +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 <test_HYDROData_OperationsFactory.h>
-
-#include <HYDROData_Document.h>
-#include <HYDROData_Image.h>
-#include <HYDROData_PolylineXY.h>
-#include <HYDROData_OperationsFactory.h>
-
-#include <ImageComposer_CropOperator.h>
-
-#include <gp_XY.hxx>
-
-#include <QPainter>
-
-void test_HYDROData_OperationsFactory::testCreate()
-{
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
-  
-  HYDROData_OperationsFactory* aFactory = HYDROData_OperationsFactory::Factory();
-  CPPUNIT_ASSERT(aFactory);
-  Handle(HYDROData_Image) anImage = aFactory->CreateImage(aDoc, NULL);
-  CPPUNIT_ASSERT(!anImage.IsNull());
-  CPPUNIT_ASSERT(anImage->Image().isNull());
-  
-  aDoc->Close();
-}
-
-static QImage TestImage() {
-  QImage aPic(50, 40, QImage::Format_RGB32);
-  aPic.fill(Qt::white);
-  QPainter aPainter(&aPic);
-  aPainter.drawEllipse(6, 7, 38, 30);
-  aPainter.drawLine(0, 40, 10, 0);
-  aPainter.drawLine(10, 0, 25, 35);
-  aPainter.drawLine(25, 35, 40, 0);
-  aPainter.drawLine(40, 0, 50, 40);
-  return aPic;
-}
-
-void test_HYDROData_OperationsFactory::testCrop()
-{
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
-  HYDROData_OperationsFactory* aFactory = HYDROData_OperationsFactory::Factory();
-  
-  // prepare the original image and crop-path
-  Handle(HYDROData_Image) anOriImage = 
-    Handle(HYDROData_Image)::DownCast( aDoc->CreateObject( KIND_IMAGE ) );
-
-  QImage aTestImage = TestImage();
-  anOriImage->SetImage( aTestImage );
-
-  Handle(HYDROData_PolylineXY) aCropPolyline = 
-    Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
-
-  aCropPolyline->AddSection( "", HYDROData_PolylineXY::SECTION_POLYLINE, true );
-
-  aCropPolyline->AddPoint( 0, HYDROData_PolylineXY::Point( 25, 0  ) );
-  aCropPolyline->AddPoint( 0, HYDROData_PolylineXY::Point( 0,  20 ) );
-  aCropPolyline->AddPoint( 0, HYDROData_PolylineXY::Point( 25, 40 ) );
-  aCropPolyline->AddPoint( 0, HYDROData_PolylineXY::Point( 50, 20 ) );
-
-  // prepare Composer Operation
-  ImageComposer_Operator* aCropOp = 
-    aFactory->Operator( ImageComposer_CropOperator::Type() );
-  
-  CPPUNIT_ASSERT( aCropOp );
-
-  aCropOp->setArgs( Qt::red );
-
-  // create crop - image 
-  Handle(HYDROData_Image) aCropImage = aFactory->CreateImage( aDoc, aCropOp );
-  CPPUNIT_ASSERT( !aCropImage.IsNull() );
-
-  aCropImage->AppendReference( anOriImage );
-  aCropImage->AppendReference( aCropPolyline );
-  aCropImage->Update();
-
-  // check crop operation was performed
-  CPPUNIT_ASSERT( !aCropImage->Image().isNull() );
-  CPPUNIT_ASSERT( aCropImage->Image() != aTestImage );
-  
-  aDoc->Close();
-}
diff --git a/src/HYDROData/test_HYDROData_OperationsFactory.h b/src/HYDROData/test_HYDROData_OperationsFactory.h
deleted file mode 100644 (file)
index 3b5f7fd..0000000
+++ /dev/null
@@ -1,43 +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 <cppunit/extensions/HelperMacros.h>
-
-class test_HYDROData_OperationsFactory : public CppUnit::TestFixture {
-  CPPUNIT_TEST_SUITE(test_HYDROData_OperationsFactory);
-  CPPUNIT_TEST(testCreate);
-  CPPUNIT_TEST(testCrop);
-  CPPUNIT_TEST_SUITE_END();
-
-private:
-
-public:
-
-  void setUp() {}
-
-  void tearDown() {}
-
-  // checks creation of images using null operators
-  void testCreate();
-
-  // checks creation of images using crop operator
-  void testCrop();
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_OperationsFactory);
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_OperationsFactory, "HYDROData_OperationsFactory");
diff --git a/src/HYDROData/test_HYDROData_PolylineXY.cxx b/src/HYDROData/test_HYDROData_PolylineXY.cxx
deleted file mode 100644 (file)
index 99b6106..0000000
+++ /dev/null
@@ -1,73 +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<test_HYDROData_PolylineXY.h>
-
-#include <HYDROData_Document.h>
-#include <HYDROData_PolylineXY.h>
-
-#include <QList>
-#include <QPointF>
-
-void test_HYDROData_PolylineXY::testPolyline()
-{
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
-
-  Handle(HYDROData_PolylineXY) aPolyline = 
-    Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
-
-  aPolyline->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, false );
-  aPolyline->AddSection( "Section_2", HYDROData_PolylineXY::SECTION_SPLINE, true );
-
-  int aNbSections = aPolyline->NbSections();
-  CPPUNIT_ASSERT( aNbSections == 2 );
-  
-  NCollection_Sequence<TCollection_AsciiString>           aSectNames;
-  NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
-  NCollection_Sequence<bool>                              aSectClosures;
-  aPolyline->GetSections( aSectNames, aSectTypes, aSectClosures );
-
-  CPPUNIT_ASSERT( aSectNames.Value( 0 ) == "Section_1" );
-  CPPUNIT_ASSERT( aSectTypes.Value( 0 ) == HYDROData_PolylineXY::SECTION_POLYLINE );
-  CPPUNIT_ASSERT( aSectClosures.Value( 0 ) == false );
-
-  CPPUNIT_ASSERT( aSectNames.Value( 1 ) == "Section_2" );
-  CPPUNIT_ASSERT( aSectTypes.Value( 1 ) == HYDROData_PolylineXY::SECTION_SPLINE );
-  CPPUNIT_ASSERT( aSectClosures.Value( 1 ) == true );
-
-  aDoc->Close();
-}
-
-
-void test_HYDROData_PolylineXY::testCopy()
-{
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
-  Handle(HYDROData_PolylineXY) aPolyline1 = 
-    Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
-
-
-//  aPolyline1->setPoints(aPoints);
-
-  Handle(HYDROData_PolylineXY) aPolyline2 = 
-    Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
-
-  aPolyline1->CopyTo(aPolyline2, true);
-
-
-  aDoc->Close();
-}
diff --git a/src/HYDROData/test_HYDROData_PolylineXY.h b/src/HYDROData/test_HYDROData_PolylineXY.h
deleted file mode 100755 (executable)
index 24623b3..0000000
+++ /dev/null
@@ -1,43 +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 <cppunit/extensions/HelperMacros.h>
-
-class test_HYDROData_PolylineXY : public CppUnit::TestFixture {
-  CPPUNIT_TEST_SUITE(test_HYDROData_PolylineXY);
-  CPPUNIT_TEST(testPolyline);
-  CPPUNIT_TEST(testCopy);
-  CPPUNIT_TEST_SUITE_END();
-
-private:
-
-public:
-
-  void setUp() {}
-
-  void tearDown() {}
-
-  // checks save/restore QImages information
-  void testPolyline();
-
-  // checks the image properties copy/paste
-  void testCopy();
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_PolylineXY);
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_PolylineXY, "HYDROData_PolylineXY");
diff --git a/src/HYDROData/test_HYDROData_Profile.cxx b/src/HYDROData/test_HYDROData_Profile.cxx
deleted file mode 100755 (executable)
index a915486..0000000
+++ /dev/null
@@ -1,164 +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 <test_HYDROData_Profile.h>
-
-#include <HYDROData_Document.h>
-#include <HYDROData_Tool.h>
-#include <HYDROData_Profile.h>
-#include <HYDROData_Iterator.h>
-
-#include <TopoDS_Shape.hxx>
-
-#include <gp_XY.hxx>
-#include <gp_XYZ.hxx>
-
-#include <QDir>
-#include <QFile>
-#include <QTextStream>
-
-bool test_HYDROData_Profile::createTestFile( const QString& theFileName,
-                                             const bool     theIsParametric )
-{
-  QFile aTmpFile( theFileName );
-  if ( !aTmpFile.open( QIODevice::WriteOnly | QIODevice::Text ) )
-    return false;
-
-  if ( theIsParametric )
-  {
-    QTextStream anOutStream( &aTmpFile );
-    
-    anOutStream << "0      182.15 \n";
-    anOutStream << "4      181.95 \n";
-    anOutStream << "10.18  181.63 \n";
-    anOutStream << "14.75  179.27 \n";
-    anOutStream << "19.75  178.87 \n";
-
-    anOutStream << "\n";
-
-    anOutStream << "-5   50    \n";
-    anOutStream << "0    15    \n";
-    anOutStream << "10.1 10    \n";
-    anOutStream << "20   20    \n";
-    anOutStream << "250  0.005 \n";
-  }
-  else
-  {
-    QTextStream anOutStream( &aTmpFile );
-
-    anOutStream << "1040499.17 6788618.13 182.15 \n";
-    anOutStream << "1040503.12 6788618.79 181.95 \n";
-    anOutStream << "1040509.21 6788619.81 181.63 \n";
-    anOutStream << "1040513.72 6788620.56 179.27 \n";
-    anOutStream << "1040518.65 6788621.38 178.87 \n";
-  }
-
-  aTmpFile.close();
-
-  return true;
-}
-
-void test_HYDROData_Profile::testFileImport()
-{
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
-
-  QString aParamFileName = QDir::tempPath() + QDir::separator() + "parametric.pa";
-  QString aGeorefFileName = QDir::tempPath() + QDir::separator() + "georef.pa";
-  if ( !createTestFile( aParamFileName, true ) || !createTestFile( aGeorefFileName, false ) )
-    return; // No file has been created
-
-  TCollection_AsciiString aFileName( aParamFileName.toStdString().c_str() );
-
-  CPPUNIT_ASSERT( HYDROData_Profile::ImportFromFile( aDoc, aFileName ) );
-
-  int aProfileCount = 0;
-  HYDROData_Iterator aDocIter( aDoc, KIND_PROFILE );
-  for ( ; aDocIter.More(); aDocIter.Next() )
-  {
-    Handle(HYDROData_Profile) aProfile = 
-      Handle(HYDROData_Profile)::DownCast( aDocIter.Current() );
-    if ( aProfile.IsNull() )
-      continue;
-    
-    CPPUNIT_ASSERT( aProfile->IsValid() == false );
-    CPPUNIT_ASSERT( aProfile->NbPoints() == 5 );
-    
-    aProfileCount++;
-  }
-
-  CPPUNIT_ASSERT( aProfileCount == 2 );
-
-  Handle(HYDROData_Profile) aGeorefProfile = 
-    Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
-
-  aFileName = TCollection_AsciiString( aGeorefFileName.toStdString().c_str() );
-  CPPUNIT_ASSERT( aGeorefProfile->ImportFromFile( aFileName ) );
-
-  // Check validity of imported profile
-  CPPUNIT_ASSERT( aGeorefProfile->IsValid() );
-
-  CPPUNIT_ASSERT( aGeorefProfile->GetTopShape().IsNull() == false );
-
-  aGeorefProfile->UpdateShape3D();
-  CPPUNIT_ASSERT( aGeorefProfile->GetShape3D().IsNull() == false );
-
-  HYDROData_Profile::ProfilePoints aProfilePoints = aGeorefProfile->GetProfilePoints();
-  CPPUNIT_ASSERT( aProfilePoints.Length() == 5 );
-
-  HYDROData_Profile::ProfilePoint aProfilePoint = aProfilePoints.Value( 3 );
-  CPPUNIT_ASSERT( ValuesEquals( aProfilePoint.X(), 1040509.21 ) );
-  CPPUNIT_ASSERT( ValuesEquals( aProfilePoint.Y(), 6788619.81 ) );
-  CPPUNIT_ASSERT( ValuesEquals( aProfilePoint.Z(), 181.63 ) );
-
-  aDoc->Close();
-}
-
-
-void test_HYDROData_Profile::testCopy()
-{
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
-  
-  Handle(HYDROData_Profile) aProfile1 = 
-    Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
-
-  QString aFileName = QDir::tempPath() + QDir::separator() + "georef.pa";
-
-  bool anIsFileCreated = createTestFile( aFileName, false );
-  
-  if ( anIsFileCreated )
-  {
-    TCollection_AsciiString anAsciiFileName( aFileName.toStdString().c_str() );
-    CPPUNIT_ASSERT( aProfile1->ImportFromFile( anAsciiFileName ) );
-
-    CPPUNIT_ASSERT( aProfile1->IsValid() );
-    CPPUNIT_ASSERT( aProfile1->NbPoints() == 5 );
-  }
-
-  Handle(HYDROData_Profile) aProfile2 = 
-    Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
-
-  aProfile1->CopyTo( aProfile2 );
-
-  if ( anIsFileCreated )
-  {
-    CPPUNIT_ASSERT( aProfile2->IsValid() );
-    CPPUNIT_ASSERT( aProfile2->NbPoints() == 5 );
-  }
-
-  aDoc->Close();
-}
diff --git a/src/HYDROData/test_HYDROData_Profile.h b/src/HYDROData/test_HYDROData_Profile.h
deleted file mode 100755 (executable)
index 9785cf7..0000000
+++ /dev/null
@@ -1,50 +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 <cppunit/extensions/HelperMacros.h>
-
-class Handle_HYDROData_Profile;
-class QString;
-
-class test_HYDROData_Profile : public CppUnit::TestFixture {
-  CPPUNIT_TEST_SUITE(test_HYDROData_Profile);
-  CPPUNIT_TEST(testFileImport);
-  CPPUNIT_TEST(testCopy);
-  CPPUNIT_TEST_SUITE_END();
-
-private:
-
-  static bool                             createTestFile( const QString& theFileName,
-                                                          const bool     theIsParametric );
-
-public:
-
-  void                                    setUp() {}
-
-  void                                    tearDown() {}
-
-  // checks file importing information
-  void                                    testFileImport();
-
-  // checks the copy/paste mechanism
-  void                                    testCopy();
-
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_Profile);
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_Profile, "HYDROData_Profile");
diff --git a/src/HYDROData/test_HYDROData_StricklerTable.cxx b/src/HYDROData/test_HYDROData_StricklerTable.cxx
deleted file mode 100644 (file)
index 4cf5798..0000000
+++ /dev/null
@@ -1,30 +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 <test_HYDROData_StricklerTable.h>
-#include <HYDROData_Document.h>
-
-void test_HYDROData_StricklerTable::testImport()
-{
-  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
-
-  Handle(HYDROData_Entity) anObj = aDoc->CreateObject( KIND_STRICKLER_TABLE );
-  TCollection_AsciiString aFileName = "test_name";
-  
-  aDoc->Close();
-}
diff --git a/src/HYDROData/test_HYDROData_StricklerTable.h b/src/HYDROData/test_HYDROData_StricklerTable.h
deleted file mode 100644 (file)
index fcd1a38..0000000
+++ /dev/null
@@ -1,40 +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
-//
-
-#ifdef WIN32
-  #pragma warning( disable: 4251 )
-#endif
-
-#include <cppunit/extensions/HelperMacros.h>
-
-class test_HYDROData_StricklerTable : public CppUnit::TestFixture
-{
-  CPPUNIT_TEST_SUITE( test_HYDROData_StricklerTable );
-  CPPUNIT_TEST( testImport );
-  CPPUNIT_TEST_SUITE_END();
-
-public:
-  void testImport();
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_StricklerTable );
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( test_HYDROData_StricklerTable, "HYDROData_StricklerTable" );
-
-#ifdef WIN32
-  #pragma warning( default: 4251 )
-#endif
index 46728208e6cc952e0ce3f28ea34ff1fc3eabb572..769496f8b668a9499093b7b55d233b7b44b6145e 100644 (file)
@@ -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)
-
index 7900432171bbfdb685447fba2bbcb3e3362dac2c..ab5b70b07a12f7d330fa263e4da8ebb1aa673da0 100644 (file)
 #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
index 46a8487d3b268e241f2b852be1a377162d2be808..adc0e42c1e55996eb0fc00674b9becedf024e66d 100644 (file)
@@ -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/HYDROGUI/test_HYDROGUI_ListModel.cxx b/src/HYDROGUI/test_HYDROGUI_ListModel.cxx
deleted file mode 100644 (file)
index f5b0ea4..0000000
+++ /dev/null
@@ -1,427 +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
-//
-
-#undef HYDROGUI_EXPORTS
-
-#include <test_HYDROGUI_ListModel.h>
-#include <HYDROData_Document.h>
-#include <HYDROGUI_ListModel.h>
-
-Handle_HYDROData_Document GetDocument()
-{
-  return HYDROData_Document::Document( 0 );
-}
-
-HYDROGUI_ListModel::Object2VisibleList CreateTestObjects( int theObjCount )
-{
-  HYDROGUI_ListModel::Object2VisibleList anObjects;
-
-  for( int i=0; i<theObjCount; i++ )
-  {
-    Handle_HYDROData_Entity anObj = GetDocument()->CreateObject( KIND_IMMERSIBLE_ZONE );
-
-    std::string aName = " ";
-    aName[0] = 'A' + i;
-    anObj->SetName( QString::fromStdString( aName ) );
-
-    bool isVisible = i%2==0;
-
-    anObjects.append( HYDROGUI_ListModel::Object2Visible( anObj, isVisible ) );
-  }
-  return anObjects;
-}
-
-std::string test_HYDROGUI_ListModel::GetObjects( HYDROGUI_ListModel* theModel ) const
-{
-  std::string anObjects;
-  for( int i=0, n=theModel->myObjects.size(); i<n; i++ )
-  {
-    std::string anObjName = theModel->myObjects[i].first->GetName().toStdString();
-    if( theModel->isObjectVisible( i ) )
-      anObjName = "*" + anObjName;
-    if( i>0 )
-      anObjects += ", ";
-    anObjects += anObjName;
-  }
-  return anObjects;
-}
-
-/**
-  Test move up algorithm.
-*/
-void test_HYDROGUI_ListModel::testMoveUp()
-{
-  HYDROGUI_ListModel* aModel = new HYDROGUI_ListModel();
-  aModel->setObjects( CreateTestObjects( 6 ) );
-  const HYDROGUI_ListModel::OpType anUp = HYDROGUI_ListModel::Up;
-
-  // 0. Check the initial state
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
-
-  // 1. [ *A ] / ALL OBJECTS
-  aModel->move( QList<int>() << 0, anUp, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
-
-  // 2. [ *A, B ] / ALL OBJECTS
-  aModel->move( QList<int>() << 0 << 1, anUp, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
-
-  // 3. [ *A, *C ] / ALL OBJECTS
-  aModel->move( QList<int>() << 0 << 2, anUp, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
-
-  // 4. [ *A, F ] / ALL OBJECTS
-  aModel->move( QList<int>() << 0 << 5, anUp, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
-
-  // 5. [ F ] X 6 times / ALL OBJECTS
-  aModel->move( QList<int>() << 5, anUp, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, F, *E" ), GetObjects( aModel ) );
-  aModel->move( QList<int>() << 4, anUp, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, F, D, *E" ), GetObjects( aModel ) );
-  aModel->move( QList<int>() << 3, anUp, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, F, *C, D, *E" ), GetObjects( aModel ) );
-  aModel->move( QList<int>() << 2, anUp, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, F, B, *C, D, *E" ), GetObjects( aModel ) );
-  aModel->move( QList<int>() << 1, anUp, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "F, *A, B, *C, D, *E" ), GetObjects( aModel ) );
-  aModel->move( QList<int>() << 0, anUp, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "F, *A, B, *C, D, *E" ), GetObjects( aModel ) );
-
-  // 6. [ *A, B ] / ALL OBJECTS
-  aModel->move( QList<int>() << 1 << 2, anUp, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, F, *C, D, *E" ), GetObjects( aModel ) );
-
-  // 7. [ B, *C, *E ] / ALL OBJECTS
-  aModel->move( QList<int>() << 1 << 3 << 5, anUp, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "B, *A, *C, F, *E, D" ), GetObjects( aModel ) );
-
-  // 8. [ *A, *C, F, *E, D ] / ALL OBJECTS
-  aModel->move( QList<int>() << 1 << 2 << 3 << 4 << 5, anUp, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, *C, F, *E, D, B" ), GetObjects( aModel ) );
-
-  // 9. [ *E ] / VISIBLE OBJECTS
-  aModel->move( QList<int>() << 3, anUp, true );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, *E, *C, F, D, B" ), GetObjects( aModel ) );
-
-  // 10. [ *E, *C ] / VISIBLE OBJECTS
-  aModel->move( QList<int>() << 1 << 2, anUp, true );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*E, *C, *A, F, D, B" ), GetObjects( aModel ) );
-
-  // 11. [ *A, F ] / ALL OBJECTS
-  aModel->move( QList<int>() << 2 << 3, anUp, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*E, *A, F, *C, D, B" ), GetObjects( aModel ) );
-
-  // 12. [ *A, *C ] / VISIBLE OBJECTS
-  aModel->move( QList<int>() << 1 << 3, anUp, true );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, *C, *E, F, D, B" ), GetObjects( aModel ) );
-
-  // 13. [] / ALL OBJECTS
-  aModel->move( QList<int>(), anUp, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, *C, *E, F, D, B"), GetObjects( aModel ) );
-
-  // 14. [ *A, *C, *E, F, D, B ] / ALL OBJECTS
-  aModel->move( QList<int>() << 0 << 1 << 2 << 3 << 4 << 5, anUp, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, *C, *E, F, D, B"), GetObjects( aModel ) );
-
-  delete aModel;
-}
-
-/**
-  Test move on top algorithm.
-*/
-void test_HYDROGUI_ListModel::testMoveOnTop()
-{
-  HYDROGUI_ListModel* aModel = new HYDROGUI_ListModel();
-  aModel->setObjects( CreateTestObjects( 6 ) );
-  const HYDROGUI_ListModel::OpType aTop = HYDROGUI_ListModel::Top;
-
-  // 0. Check the initial state
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
-
-  // 1. [ *A ] / ALL OBJECTS
-  aModel->move( QList<int>() << 0, aTop, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
-
-  // 2. [ *A ] / VISIBLE OBJECTS
-  aModel->move( QList<int>() << 0, aTop, true );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
-
-  // 3. [ F ] / ALL OBJECTS
-  aModel->move( QList<int>() << 5, aTop, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "F, *A, B, *C, D, *E" ), GetObjects( aModel ) );
-
-  // 4. [ *E ] / VISIBLE OBJECTS
-  aModel->move( QList<int>() << 5, aTop, true );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*E, F, *A, B, *C, D" ), GetObjects( aModel ) );
-
-  // 5. [ *E, F ] / ALL OBJECTS
-  aModel->move( QList<int>() << 0 << 1, aTop, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*E, F, *A, B, *C, D" ), GetObjects( aModel ) );
-
-  // 6. [ *E, *A ] / ALL OBJECTS
-  aModel->move( QList<int>() << 0 << 2, aTop, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*E, *A, F, B, *C, D" ), GetObjects( aModel ) );
-
-  // 7. [ *A, F, *C ] / ALL OBJECTS
-  aModel->move( QList<int>() << 1 << 2 << 4, aTop, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, F, *C, *E, B, D" ), GetObjects( aModel ) );
-
-  // 8.  [ F, *C, *E, B, D ] / ALL OBJECTS
-  aModel->move( QList<int>() << 1 << 2 << 3 << 4 << 5, aTop, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "F, *C, *E, B, D, *A" ), GetObjects( aModel ) );
-
-  // 9. [] / ALL OBJECTS
-  aModel->move( QList<int>(), aTop, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "F, *C, *E, B, D, *A" ), GetObjects( aModel ) );
-
-  // 10. [*F, *C, *E, B, D, *A] / ALL OBJECTS
-  aModel->move( QList<int>() << 0 << 1 << 2 << 3 << 4 << 5, aTop, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "F, *C, *E, B, D, *A" ), GetObjects( aModel ) );
-
-  delete aModel;
-}
-
-/**
-  Test move down algorithm.
-*/
-void test_HYDROGUI_ListModel::testMoveDown()
-{
-  HYDROGUI_ListModel* aModel = new HYDROGUI_ListModel();
-  aModel->setObjects( CreateTestObjects( 6 ) );
-  const HYDROGUI_ListModel::OpType aDown = HYDROGUI_ListModel::Down;
-
-  // 0. Check the initial state
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
-
-  // 1. [ F ] / ALL OBJECTS
-  aModel->move( QList<int>() << 5, aDown, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
-
-  // 2. [ *E, F ] / ALL OBJECTS
-  aModel->move( QList<int>() << 4 << 5, aDown, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
-
-  // 3. [ D, F ] / ALL OBJECTS
-  aModel->move( QList<int>() << 3 << 5, aDown, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
-
-  // 4. [ *A, F ] / ALL OBJECTS
-  aModel->move( QList<int>() << 0 << 5, aDown, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
-
-  // 5. [ *A ] X 6 times / ALL OBJECTS
-  aModel->move( QList<int>() << 0, aDown, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "B, *A, *C, D, *E, F" ), GetObjects( aModel ) );
-  aModel->move( QList<int>() << 1, aDown, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, *A, D, *E, F" ), GetObjects( aModel ) );
-  aModel->move( QList<int>() << 2, aDown, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, D, *A, *E, F" ), GetObjects( aModel ) );
-  aModel->move( QList<int>() << 3, aDown, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, D, *E, *A, F" ), GetObjects( aModel ) );
-  aModel->move( QList<int>() << 4, aDown, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, D, *E, F, *A" ), GetObjects( aModel ) );
-  aModel->move( QList<int>() << 5, aDown, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, D, *E, F, *A" ), GetObjects( aModel ) );
-
-  // 6. [ *E, *F ] / ALL OBJECTS
-  aModel->move( QList<int>() << 3 << 4, aDown, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, D, *A, *E, F" ), GetObjects( aModel ) );
-
-  // 7. [ B, D, *E ] / ALL OBJECTS
-  aModel->move( QList<int>() << 0 << 2 << 4, aDown, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*C, B, *A, D, F, *E" ), GetObjects( aModel ) );
-
-  // 8. [ *C, B, *A, D, F ] / ALL OBJECTS
-  aModel->move( QList<int>() << 0 << 1 << 2 << 3 << 4, aDown, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*E, *C, B, *A, D, F" ), GetObjects( aModel ) );
-
-  // 9. [ *C ] / VISIBLE OBJECTS
-  aModel->move( QList<int>() << 1, aDown, true );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*E, B, *A, *C, D, F" ), GetObjects( aModel ) );
-
-  // 10. [ *E, *A ] / VISIBLE OBJECTS
-  aModel->move( QList<int>() << 0 << 2, aDown, true );
-  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, *E, *A, D, F" ), GetObjects( aModel ) );
-
-  // 11. [ *E, *A ] / VISIBLE OBJECTS
-  aModel->move( QList<int>() << 2 << 3, aDown, true );
-  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, *E, *A, D, F" ), GetObjects( aModel ) );
-
-  // 12. [ *C, *E, *A ] / VISIBLE OBJECTS
-  aModel->move( QList<int>() << 1 << 2 << 3, aDown, true );
-  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, *E, *A, D, F" ), GetObjects( aModel ) );
-
-  // 13. [] / ALL OBJECTS
-  aModel->move( QList<int>(), aDown, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, *E, *A, D, F"), GetObjects( aModel ) );
-
-  // 14. [ B, *C, *E, *A, D, F ] / ALL OBJECTS
-  aModel->move( QList<int>() << 0 << 1 << 2 << 3 << 4 << 5, aDown, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, *E, *A, D, F"), GetObjects( aModel ) );
-
-  delete aModel;
-}
-
-/**
-  Test move on bottom algorithm.
-*/
-void test_HYDROGUI_ListModel::testMoveOnBottom()
-{
-  HYDROGUI_ListModel* aModel = new HYDROGUI_ListModel();
-  aModel->setObjects( CreateTestObjects( 6 ) );
-  const HYDROGUI_ListModel::OpType aBottom = HYDROGUI_ListModel::Bottom;
-
-  // 0. Check the initial state
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
-
-  // 1. [ F ] / ALL OBJECTS
-  aModel->move( QList<int>() << 5, aBottom, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
-
-  // 2. [ F ] / VISIBLE OBJECTS
-  aModel->move( QList<int>() << 5, aBottom, true );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
-
-  // 3. [ *A ] / ALL OBJECTS
-  aModel->move( QList<int>() << 0, aBottom, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, D, *E, F, *A" ), GetObjects( aModel ) );
-
-  // 4. [ *C ] / VISIBLE OBJECTS
-  aModel->move( QList<int>() << 1, aBottom, true );
-  CPPUNIT_ASSERT_EQUAL( std::string( "B, D, *E, F, *A, *C" ), GetObjects( aModel ) );
-
-  // 5. [ B, D ] / ALL OBJECTS
-  aModel->move( QList<int>() << 0 << 1, aBottom, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*E, F, *A, *C, B, D" ), GetObjects( aModel ) );
-
-  // 6. [ *C, *D ] / ALL OBJECTS
-  aModel->move( QList<int>() << 3 << 5, aBottom, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*E, F, *A, B, *C, D" ), GetObjects( aModel ) );
-
-  // 7. [ *E, *A, *C ] / ALL OBJECTS
-  aModel->move( QList<int>() << 0 << 2 << 4, aBottom, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "F, B, D, *E, *A, *C" ), GetObjects( aModel ) );
-
-  // 8.  [ B, D, *E, *A ] / ALL OBJECTS
-  aModel->move( QList<int>() << 1 << 2 << 3 << 4 , aBottom, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "F, *C, B, D, *E, *A" ), GetObjects( aModel ) );
-
-  // 9. [] / ALL OBJECTS
-  aModel->move( QList<int>(), aBottom, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "F, *C, B, D, *E, *A" ), GetObjects( aModel ) );
-
-  // 10. [F, *C, B, D, *E, *A] / ALL OBJECTS
-  aModel->move( QList<int>() << 0 << 1 << 2 << 3 << 4 << 5, aBottom, false );
-  CPPUNIT_ASSERT_EQUAL( std::string( "F, *C, B, D, *E, *A" ), GetObjects( aModel ) );
-
-  delete aModel;
-}
-
-/**
-  Test drag and drop algorithm.
-*/
-void test_HYDROGUI_ListModel::testDragAndDrop()
-{
-  HYDROGUI_ListModel* aModel = new HYDROGUI_ListModel();
-  aModel->setObjects( CreateTestObjects( 8 ) );
-  const HYDROGUI_ListModel::OpType aDnD = HYDROGUI_ListModel::DragAndDrop;
-
-  // 0. Check the initial state
-  std::string anInitialState = std::string( "*A, B, *C, D, *E, F, *G, H" );
-  CPPUNIT_ASSERT_EQUAL( anInitialState, GetObjects( aModel ) );
-
-  // 1. [] -> B ( i=1 )
-  bool aRes = aModel->move( QList<int>(), aDnD, false, 1 );
-  CPPUNIT_ASSERT_EQUAL( false, aRes );
-  CPPUNIT_ASSERT_EQUAL( anInitialState, GetObjects( aModel ) );
-
-  // 2. ALL -> B ( i=1 )
-  QList<int> anAll;
-  anAll << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7;
-  aRes = aModel->move( anAll, aDnD, false, 1 );
-  CPPUNIT_ASSERT_EQUAL( false, aRes );
-  CPPUNIT_ASSERT_EQUAL( anInitialState, GetObjects( aModel ) );
-
-  // 3. [D, *E, *G] -> D : drop item is among dragged items ( at the beginning )
-  aRes = aModel->move( QList<int>() << 3 << 4 << 6, aDnD, false, 3 );
-  CPPUNIT_ASSERT_EQUAL( false, aRes );
-  CPPUNIT_ASSERT_EQUAL( anInitialState, GetObjects( aModel ) );
-
-  // 4. [D, *E, *G] -> *E : drop item is among dragged items ( in the middle )
-  aRes = aModel->move( QList<int>() << 3 << 4 << 6, aDnD, false, 4 );
-  CPPUNIT_ASSERT_EQUAL( false, aRes );
-  CPPUNIT_ASSERT_EQUAL( anInitialState, GetObjects( aModel ) );
-
-  // 5. [D, *E, *G] -> *G : drop item is among dragged items ( at the end )
-  aRes = aModel->move( QList<int>() << 3 << 4 << 6, aDnD, false, 6 );
-  CPPUNIT_ASSERT_EQUAL( false, aRes );
-  CPPUNIT_ASSERT_EQUAL( anInitialState, GetObjects( aModel ) );
-
-  // 6. [D, *E, *G] -> -1 : drop item index is out of range ( less than zero )
-  aRes = aModel->move( QList<int>() << 3 << 4 << 6, aDnD, false, -1 );
-  CPPUNIT_ASSERT_EQUAL( false, aRes );
-  CPPUNIT_ASSERT_EQUAL( anInitialState, GetObjects( aModel ) );
-
-  // 7. [D, *E, *G] -> -1 : drop item index is out of range ( more than than list length )
-  aRes = aModel->move( QList<int>() << 3 << 4 << 6, aDnD, false, 9 );
-  CPPUNIT_ASSERT_EQUAL( false, aRes );
-  CPPUNIT_ASSERT_EQUAL( anInitialState, GetObjects( aModel ) );
-
-  // 8. [D, *E, *G] -> B ( i = 1 )
-  aRes = aModel->move( QList<int>() << 3 << 4 << 6, aDnD, false, 1 );
-  CPPUNIT_ASSERT_EQUAL( true, aRes );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, D, *E, *G, B, *C, F, H" ), GetObjects( aModel ) );
-
-  // 9. [*E, F] -> *G
-  aRes = aModel->move( QList<int>() << 2 << 6, aDnD, false, 3 );
-  CPPUNIT_ASSERT_EQUAL( true, aRes );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, D, *E, F, *G, B, *C, H" ), GetObjects( aModel ) );
-
-  // 10. [*E, F, *G] -> *A
-  aRes = aModel->move( QList<int>() << 2 << 3 << 4, aDnD, false, 0 );
-  CPPUNIT_ASSERT_EQUAL( true, aRes );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*E, F, *G, *A, D, B, *C, H" ), GetObjects( aModel ) );
-
-  // 11. [*G, D, *C, H] -> B
-  aRes = aModel->move( QList<int>() << 2 << 4 << 6 << 7, aDnD, false, 5 );
-  CPPUNIT_ASSERT_EQUAL( true, aRes );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*E, F, *A, *G, D, *C, H, B" ), GetObjects( aModel ) );
-
-  // 12. [F, *A, *G, D, *C, H, B] -> *E
-  QList<int> anAllWithoutFirst;
-  anAllWithoutFirst << 1 << 2 << 3 << 4 << 5 << 6 << 7;
-  aRes = aModel->move( anAllWithoutFirst, aDnD, false, 0 );
-  CPPUNIT_ASSERT_EQUAL( true, aRes );
-  CPPUNIT_ASSERT_EQUAL( std::string( "F, *A, *G, D, *C, H, B, *E" ), GetObjects( aModel ) );
-
-  // 13. [*A, *G] -> D : no changes
-  aRes = aModel->move(  QList<int>() << 1 << 2, aDnD, false, 3 );
-  CPPUNIT_ASSERT_EQUAL( true, aRes );
-  CPPUNIT_ASSERT_EQUAL( std::string( "F, *A, *G, D, *C, H, B, *E" ), GetObjects( aModel ) );
-
-  // 14. [F, *G] -> D
-  aRes = aModel->move(  QList<int>() << 0 << 2, aDnD, false, 3 );
-  CPPUNIT_ASSERT_EQUAL( true, aRes );
-  CPPUNIT_ASSERT_EQUAL( std::string( "*A, F, *G, D, *C, H, B, *E" ), GetObjects( aModel ) );
-
-  // 15. [*A, *G, *C, H, *E] -> D
-  aRes = aModel->move(  QList<int>() << 0 << 2 << 4 << 5 << 7, aDnD, false, 3 );
-  CPPUNIT_ASSERT_EQUAL( true, aRes );
-  CPPUNIT_ASSERT_EQUAL( std::string( "F, *A, *G, *C, H, *E, D, B" ), GetObjects( aModel ) );
-}
\ No newline at end of file
diff --git a/src/HYDROGUI/test_HYDROGUI_ListModel.h b/src/HYDROGUI/test_HYDROGUI_ListModel.h
deleted file mode 100644 (file)
index 28dc153..0000000
+++ /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 <cppunit/extensions/HelperMacros.h>
-
-class HYDROGUI_ListModel;
-
-class test_HYDROGUI_ListModel : public CppUnit::TestFixture {
-  CPPUNIT_TEST_SUITE(test_HYDROGUI_ListModel);
-  CPPUNIT_TEST(testMoveUp);
-  CPPUNIT_TEST(testMoveOnTop);
-  CPPUNIT_TEST(testMoveDown);
-  CPPUNIT_TEST(testMoveOnBottom);
-  CPPUNIT_TEST(testDragAndDrop);
-  CPPUNIT_TEST_SUITE_END();
-
-private:
-  std::string GetObjects( HYDROGUI_ListModel* theModel ) const;
-
-public:
-  void testMoveUp();
-  void testMoveOnTop();
-  void testMoveDown();
-  void testMoveOnBottom();
-  void testDragAndDrop();
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROGUI_ListModel);
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROGUI_ListModel, "HYDROGUI_ListModel");
diff --git a/src/HYDROGUI/test_HYDROGUI_Main.cxx b/src/HYDROGUI/test_HYDROGUI_Main.cxx
deleted file mode 100644 (file)
index a12862d..0000000
+++ /dev/null
@@ -1,70 +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 <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/CompilerOutputter.h>
-#include <cppunit/TestResult.h>
-#include <cppunit/TestResultCollector.h>
-#include <cppunit/TestRunner.h>
-#include <cppunit/TextTestProgressListener.h>
-#include <stdexcept>
-#include <QApplication>
-
-int main( int argc, char* argv[] )
-{
-  QApplication anApp( argc, argv );
-
-  std::string testPath = (argc > 1) ? std::string(argv[1]) : "";
-
-  // Create the event manager and test controller
-  CppUnit::TestResult controller;
-
-  // Add a listener that colllects test result
-  CppUnit::TestResultCollector result;
-  controller.addListener( &result );        
-
-  // Add a listener that print dots as test run.
-  CppUnit::TextTestProgressListener progress;
-  controller.addListener( &progress );      
-
-  CppUnit::TestFactoryRegistry& registry = 
-    CppUnit::TestFactoryRegistry::getRegistry();
-  // Add the top suite to the test runner
-  CppUnit::TestRunner runner;
-  runner.addTest( registry.makeTest() );   
-  try
-  {
-    std::cout << "Running "  <<  testPath;
-    runner.run( controller, testPath );
-
-    std::cerr << std::endl;
-
-    // Print test in a compiler compatible format.
-    CppUnit::CompilerOutputter outputter( &result, std::cerr );
-    outputter.write();                      
-  }
-  catch ( std::invalid_argument &e )  // Test path not resolved
-  {
-    std::cerr  <<  std::endl  
-      <<  "ERROR: "  <<  e.what()
-      << std::endl;
-    return 0;
-  }
-
-  return result.wasSuccessful() ? 0 : 1;
-}
diff --git a/src/HYDRO_tests/CMakeLists.txt b/src/HYDRO_tests/CMakeLists.txt
new file mode 100644 (file)
index 0000000..82c0156
--- /dev/null
@@ -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/HYDRO_tests/test_HYDROData_Bathymetry.cxx b/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx
new file mode 100644 (file)
index 0000000..e3b2509
--- /dev/null
@@ -0,0 +1,197 @@
+// 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 <test_HYDROData_Bathymetry.h>
+
+#include <HYDROData_Document.h>
+#include <HYDROData_Tool.h>
+#include <HYDROData_Bathymetry.h>
+
+#include <gp_XY.hxx>
+#include <gp_XYZ.hxx>
+
+#include <QDir>
+#include <QFile>
+#include <QTextStream>
+
+#include <gp_Pnt2d.hxx>
+
+void generateOne( QTextStream& theStream,
+                  double theFirstX, double theFirstY,
+                  double theLastX, double theLastY )
+{
+  const int aNbPoints = 50;
+
+  double aComDist = gp_Pnt2d( theFirstX, theFirstY ).Distance( gp_Pnt2d( theLastX, theLastY ) );
+  double aStep = aComDist / (double)aNbPoints;
+
+  double aStepZ = -5;
+  double aCurDist = 0.0;
+  for ( int i = 0; i <= aNbPoints; ++i )
+  {
+    double aRatio = ( aCurDist / ( aComDist - aCurDist ) );
+
+    double anX = ( theFirstX + aRatio * theLastX ) / ( 1 + aRatio );
+    double anY = ( theFirstY + aRatio * theLastY ) / ( 1 + aRatio );
+    double aZ = aStepZ * aStepZ + sin( (float)rand() );
+    theStream << anX << " " << anY << " " << aZ << " \n";
+
+    aCurDist += aStep;
+    aStepZ += 0.2;
+  }
+}
+
+bool test_HYDROData_Bathymetry::createTestFile( const QString& theFileName )
+{
+  QFile aTmpFile( theFileName );
+  if ( !aTmpFile.open( QIODevice::WriteOnly | QIODevice::Text ) )
+    return false;
+
+  {
+    QTextStream anOutStream( &aTmpFile );
+
+    srand( 4587 );
+    generateOne( anOutStream, 0, 5, 0, -5 );
+    generateOne( anOutStream, 10, 5, 10, -5 );
+    generateOne( anOutStream, 20, 5, 20, -5 );
+    generateOne( anOutStream, 30, 5, 30, -5 );
+    generateOne( anOutStream, 40, 5, 40, -5 );
+    generateOne( anOutStream, 45.833271, 6.703101, 50.85397, -3.794724 );
+    generateOne( anOutStream, 50.85397, 11.267372, 56.787525, 2.367043 );
+    generateOne( anOutStream, 52.67968, 16.516285, 62.721077, 10.354518 );
+    generateOne( anOutStream, 55.190029, 23.819118, 65.23143, 17.657352 );
+    generateOne( anOutStream, 58.385021, 31.806595, 68.198204, 23.819118 );
+    generateOne( anOutStream, 65.916069, 38.653004, 75.044609, 27.470537 );
+    generateOne( anOutStream, 76.870323, 41.847992, 82.575661, 28.38339 );
+    generateOne( anOutStream, 92.845276, 40.022282, 91.932419, 26.557682 );
+    generateOne( anOutStream, 106.081657, 35.686226, 98.778824, 21.99341 );
+    generateOne( anOutStream, 119.774475, 29.980886, 106.994514, 14.91879 );
+    generateOne( anOutStream, 133.239075, 26.785896, 115.666634, 5.790246 );
+    generateOne( anOutStream, 150.811523, 20.167702, 125.47982, -4.707579 );
+    generateOne( anOutStream, 163.591476, 13.777717, 135.977631, -12.92327 );
+    generateOne( anOutStream, 183.446045, 11.267367, 151.496155, -24.105736 );
+    generateOne( anOutStream, 197.367081, 8.98523100, 172.720016, -31.180355 );
+    generateOne( anOutStream, 214.026672, 9.669872, 197.823502, -38.483189 );
+    generateOne( anOutStream, 235.706985, 9.89809100, 220.873108, -47.155304 );
+    generateOne( anOutStream, 266.744019, 9.213447, 248.715134, -58.565987 );
+    generateOne( anOutStream, 307.366028, 10.354514, 278.611145, -67.922737 );
+    generateOne( anOutStream, 342.510925, 7.159524, 316.951019, -84.81053 );
+    generateOne( anOutStream, 384.659393, -4.55408, 350.913635, -100.02983 );
+    generateOne( anOutStream, 443.097107, -21.015415, 391.243927, -118.960365 );
+    generateOne( anOutStream, 500.711792, -34.184483, 440.62793, -147.7677 );
+    generateOne( anOutStream, 547.626587, -52.291954, 482.604309, -169.990509 );
+    generateOne( anOutStream, 589.603027, -68.753288, 534.45752, -193.8594 );
+    generateOne( anOutStream, 633.225525, -97.560631, 569.026306, -206.205444 );
+    generateOne( anOutStream, 673.555786, -120.606499, 601.948975, -224.312912 );
+    generateOne( anOutStream, 719.647522, -148.590775, 654.625305, -248.181854 );
+    generateOne( anOutStream, 770.677673, -183.982635, 708.947693, -278.635315 );
+    generateOne( anOutStream, 824.177002, -225.959045, 742.69342, -314.027191 );
+    generateOne( anOutStream, 855.937317, -260.368958, 793.05932, -341.853638 );
+    generateOne( anOutStream, 884.168213, -294.37439, 838.6137700, -355.969116 );
+    generateOne( anOutStream, 915.607178, -327.096588, 875.185669, -366.234894 );
+    generateOne( anOutStream, 940.630066, -348.269775, 903.416565, -381.633575 );
+    generateOne( anOutStream, 963.728088, -370.726166, 936.780396, -397.032257 );
+    generateOne( anOutStream, 983.618042, -390.61615, 959.878418, -411.789337 );
+    generateOne( anOutStream, 999.658325, -407.939667, 978.485107, -425.904785 );
+    generateOne( anOutStream, 1018.265076, -422.696716, 996.450256, -443.228302 );
+    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 );
+  }
+
+  aTmpFile.close();
+
+  return true;
+}
+
+void test_HYDROData_Bathymetry::testFileImport()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
+
+  Handle(HYDROData_Bathymetry) aBathymetry = 
+    Handle(HYDROData_Bathymetry)::DownCast( aDoc->CreateObject( KIND_BATHYMETRY ) );
+
+  QString aFileName = QDir::tempPath() + QDir::separator() + "test.xyz";
+  if ( !createTestFile( aFileName ) )
+    return; // No file has been created
+
+  CPPUNIT_ASSERT( aBathymetry->ImportFromFile( aFileName.toStdString().c_str() ) );
+
+  HYDROData_Bathymetry::AltitudePoints anAltitudePoints = aBathymetry->GetAltitudePoints();
+  CPPUNIT_ASSERT( anAltitudePoints.Length() == 20 );
+
+  gp_XY aTestPoint( 1, 1 );
+  double anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint );
+  CPPUNIT_ASSERT( ValuesEquals( anAltitude, 10.0 ) );
+
+  aTestPoint = gp_XY( 0.5, 0.5 );
+  anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint );
+  CPPUNIT_ASSERT( ValuesEquals( anAltitude, 5.0 ) );
+
+  aTestPoint = gp_XY( 1.5, 1 );
+  anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint );
+  CPPUNIT_ASSERT( ValuesEquals( anAltitude, 10.0 ) );
+
+  aTestPoint = gp_XY( 1.5, 0.7 );
+  anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint );
+  CPPUNIT_ASSERT( ValuesEquals( anAltitude, 7.0 ) );
+
+  aTestPoint = gp_XY( 1.5, -0.7 );
+  anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint );
+  CPPUNIT_ASSERT( ValuesEquals( anAltitude, HYDROData_Bathymetry::GetInvalidAltitude() ) );
+
+  aTestPoint = gp_XY( 2, 3.5 );
+  anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint );
+  CPPUNIT_ASSERT( ValuesEquals( anAltitude, 35.0 ) );
+
+  aDoc->Close();
+}
+
+
+void test_HYDROData_Bathymetry::testCopy()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+  
+  Handle(HYDROData_Bathymetry) aBathymetry1 = 
+    Handle(HYDROData_Bathymetry)::DownCast( aDoc->CreateObject( KIND_BATHYMETRY ) );
+
+  QString aFileName = QDir::tempPath() + QDir::separator() + "test.xyz";
+
+  bool anIsFileCreated = createTestFile( aFileName );
+  
+  if ( anIsFileCreated )
+  {
+    CPPUNIT_ASSERT( aBathymetry1->ImportFromFile( aFileName.toStdString().c_str() ) );
+
+    HYDROData_Bathymetry::AltitudePoints anAltitudePoints = aBathymetry1->GetAltitudePoints();
+    CPPUNIT_ASSERT( anAltitudePoints.Length() == 20 );
+  }
+
+  Handle(HYDROData_Bathymetry) aBathymetry2 = 
+    Handle(HYDROData_Bathymetry)::DownCast( aDoc->CreateObject( KIND_BATHYMETRY ) );
+
+  aBathymetry1->CopyTo( aBathymetry2, true );
+
+  if ( anIsFileCreated )
+  {
+    HYDROData_Bathymetry::AltitudePoints anAltitudePoints = aBathymetry2->GetAltitudePoints();
+    CPPUNIT_ASSERT( anAltitudePoints.Length() == 20 );
+  }
+
+  aDoc->Close();
+}
diff --git a/src/HYDRO_tests/test_HYDROData_Bathymetry.h b/src/HYDRO_tests/test_HYDROData_Bathymetry.h
new file mode 100644 (file)
index 0000000..421933c
--- /dev/null
@@ -0,0 +1,49 @@
+// 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 <cppunit/extensions/HelperMacros.h>
+
+class Handle_HYDROData_Bathymetry;
+class QString;
+
+class test_HYDROData_Bathymetry : public CppUnit::TestFixture {
+  CPPUNIT_TEST_SUITE(test_HYDROData_Bathymetry);
+  CPPUNIT_TEST(testFileImport);
+  CPPUNIT_TEST(testCopy);
+  CPPUNIT_TEST_SUITE_END();
+
+private:
+
+  static bool                             createTestFile( const QString& theFileName );
+
+public:
+
+  void                                    setUp() {}
+
+  void                                    tearDown() {}
+
+  // checks file importing information
+  void                                    testFileImport();
+
+  // checks the copy/paste mechanism
+  void                                    testCopy();
+
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_Bathymetry);
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_Bathymetry, "HYDROData_Bathymetry");
diff --git a/src/HYDRO_tests/test_HYDROData_Document.cxx b/src/HYDRO_tests/test_HYDROData_Document.cxx
new file mode 100644 (file)
index 0000000..9469ec3
--- /dev/null
@@ -0,0 +1,108 @@
+// 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<test_HYDROData_Document.h>
+
+#include <HYDROData_Document.h>
+#include <QFile>
+
+void test_HYDROData_Document::testSaveOpen()
+{
+  // temporarly created file name (in the current directory)
+  const char* aTestFile = "TestDoc.cbf";
+  // save
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+  CPPUNIT_ASSERT(!aDoc.IsNull());
+  // keep some saved information to check after retreive
+  aDoc->NewID();
+  int anID = aDoc->NewID();
+  Data_DocError aStatus = aDoc->Save(aTestFile);
+  CPPUNIT_ASSERT(aStatus == DocError_OK);
+  aDoc->Close();
+  CPPUNIT_ASSERT(!HYDROData_Document::HasDocument(1));
+
+  // open
+  aStatus = HYDROData_Document::Load(aTestFile, 2);
+  CPPUNIT_ASSERT(aStatus == DocError_OK);
+  CPPUNIT_ASSERT(HYDROData_Document::HasDocument(2));
+  aDoc = HYDROData_Document::Document(2);
+  CPPUNIT_ASSERT(!aDoc.IsNull());
+  // check that retreived correctly
+  CPPUNIT_ASSERT(aDoc->NewID() == anID + 1);
+
+  // remove the created file using Qt functionality
+  QFile aFile(aTestFile);
+  aFile.remove();
+
+  aDoc->Close();
+}
+
+void test_HYDROData_Document::testOperations()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+  CPPUNIT_ASSERT(!aDoc.IsNull());
+  CPPUNIT_ASSERT(!aDoc->IsOperation());
+  CPPUNIT_ASSERT(!aDoc->IsModified());
+  // commit operation
+  aDoc->StartOperation();
+  CPPUNIT_ASSERT(aDoc->IsOperation());
+  int anID = aDoc->NewID();
+  aDoc->CommitOperation();
+  CPPUNIT_ASSERT(!aDoc->IsOperation());
+  CPPUNIT_ASSERT(aDoc->IsModified());
+  // abort operation
+  aDoc->StartOperation();
+  CPPUNIT_ASSERT(aDoc->IsOperation());
+  int anIDAborted = aDoc->NewID();
+  aDoc->AbortOperation();
+  CPPUNIT_ASSERT(!aDoc->IsOperation());
+  CPPUNIT_ASSERT(aDoc->IsModified());
+
+  CPPUNIT_ASSERT(anID + 1 == aDoc->NewID());
+
+  aDoc->Close();
+}
+
+void test_HYDROData_Document::testUndoRedo()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+  CPPUNIT_ASSERT(!aDoc.IsNull());
+  CPPUNIT_ASSERT(!aDoc->CanUndo());
+  CPPUNIT_ASSERT(!aDoc->CanRedo());
+  // commit operation
+  aDoc->StartOperation();
+  CPPUNIT_ASSERT(aDoc->IsOperation());
+  int anID = aDoc->NewID();
+  aDoc->CommitOperation();
+  CPPUNIT_ASSERT(aDoc->CanUndo());
+  CPPUNIT_ASSERT(!aDoc->CanRedo());
+  CPPUNIT_ASSERT(aDoc->IsModified());
+  // undo
+  aDoc->Undo();
+  CPPUNIT_ASSERT(!aDoc->CanUndo());
+  CPPUNIT_ASSERT(aDoc->CanRedo());
+  CPPUNIT_ASSERT(anID == aDoc->NewID());
+  CPPUNIT_ASSERT(!aDoc->IsModified());
+  // redo
+  aDoc->Redo();
+  CPPUNIT_ASSERT(aDoc->CanUndo());
+  CPPUNIT_ASSERT(!aDoc->CanRedo());
+  CPPUNIT_ASSERT(aDoc->IsModified());
+
+  aDoc->Close();
+}
diff --git a/src/HYDRO_tests/test_HYDROData_Document.h b/src/HYDRO_tests/test_HYDROData_Document.h
new file mode 100644 (file)
index 0000000..cec13ec
--- /dev/null
@@ -0,0 +1,47 @@
+// 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 <cppunit/extensions/HelperMacros.h>
+
+class test_HYDROData_Document : public CppUnit::TestFixture {
+  CPPUNIT_TEST_SUITE(test_HYDROData_Document);
+  CPPUNIT_TEST(testSaveOpen);
+  CPPUNIT_TEST(testOperations);
+  CPPUNIT_TEST(testUndoRedo);
+  CPPUNIT_TEST_SUITE_END();
+
+private:
+
+public:
+
+  void setUp() {}
+
+  void tearDown() {}
+
+  // checks the save and open document as a file
+  void testSaveOpen();
+
+  // checks the operations management: open/commit/abort, etc
+  void testOperations();
+
+  // checks the operations undo/redo
+  void testUndoRedo();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_Document);
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_Document, "HYDROData_Document");
diff --git a/src/HYDRO_tests/test_HYDROData_Entity.cxx b/src/HYDRO_tests/test_HYDROData_Entity.cxx
new file mode 100644 (file)
index 0000000..e55530b
--- /dev/null
@@ -0,0 +1,66 @@
+// 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 <test_HYDROData_Entity.h>
+
+#include <HYDROData_Document.h>
+#include <HYDROData_Entity.h>
+
+#include <QString>
+
+void test_HYDROData_Entity::testName()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+  Handle(HYDROData_Entity) anObj = aDoc->CreateObject(KIND_IMAGE); // any object
+  static const QString aName("test_name");
+  anObj->SetName(aName);
+  CPPUNIT_ASSERT_EQUAL(aName.toStdString(), anObj->GetName().toStdString());
+  
+  aDoc->Close();
+}
+
+void test_HYDROData_Entity::testRemove()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+  
+  Handle(HYDROData_Entity) anObj = aDoc->CreateObject(KIND_IMAGE); // any object
+  CPPUNIT_ASSERT(!anObj->IsRemoved());
+  anObj->Remove();
+  CPPUNIT_ASSERT(anObj->IsRemoved());
+
+  aDoc->Close();
+}
+
+void test_HYDROData_Entity::testCopy()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+  Handle(HYDROData_Entity) anObj = aDoc->CreateObject(KIND_IMAGE); // any object
+  static const QString aName("test_name");
+  anObj->SetName(aName);
+
+  Handle(HYDROData_Entity) aCopy = aDoc->CreateObject(KIND_IMAGE); // object for copy
+  CPPUNIT_ASSERT(aCopy->GetName().isEmpty());
+  anObj->CopyTo(aCopy, true);
+
+  // check the copied object has same name as original
+  CPPUNIT_ASSERT_EQUAL(aName.toStdString(), aCopy->GetName().toStdString());
+
+  aDoc->Close();
+}
diff --git a/src/HYDRO_tests/test_HYDROData_Entity.h b/src/HYDRO_tests/test_HYDROData_Entity.h
new file mode 100644 (file)
index 0000000..8a0dec7
--- /dev/null
@@ -0,0 +1,47 @@
+// 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 <cppunit/extensions/HelperMacros.h>
+
+class test_HYDROData_Entity : public CppUnit::TestFixture {
+  CPPUNIT_TEST_SUITE(test_HYDROData_Entity);
+  CPPUNIT_TEST(testName);
+  CPPUNIT_TEST(testRemove);
+  CPPUNIT_TEST(testCopy);
+  CPPUNIT_TEST_SUITE_END();
+
+private:
+
+public:
+
+  void setUp() {}
+
+  void tearDown() {}
+
+  // checks the "name" methods
+  void testName();
+
+  // checks the remove of object
+  void testRemove();
+
+  // checks the copying of object
+  void testCopy();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_Entity);
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_Entity, "HYDROData_Entity");
diff --git a/src/HYDRO_tests/test_HYDROData_Image.cxx b/src/HYDRO_tests/test_HYDROData_Image.cxx
new file mode 100644 (file)
index 0000000..ddeeeb8
--- /dev/null
@@ -0,0 +1,166 @@
+// 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<test_HYDROData_Image.h>
+
+#include <HYDROData_Document.h>
+#include <HYDROData_Image.h>
+#include <QPainter>
+
+static QImage TestImage() {
+  QImage aPic(50, 40, QImage::Format_RGB32);
+  QPainter aPainter(&aPic);
+  aPainter.drawEllipse(6, 7, 38, 30);
+  aPainter.drawLine(0, 40, 10, 0);
+  aPainter.drawLine(10, 0, 25, 35);
+  aPainter.drawLine(25, 35, 40, 0);
+  aPainter.drawLine(40, 0, 50, 40);
+  return aPic;
+}
+
+void test_HYDROData_Image::testQImage()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+  Handle(HYDROData_Image) anImage = 
+    Handle(HYDROData_Image)::DownCast(aDoc->CreateObject(KIND_IMAGE));
+  // empty image
+  QImage anEmpty = anImage->Image();
+  CPPUNIT_ASSERT(anEmpty.isNull());
+
+  // prepare Qt Image for testing
+  QImage aPic(TestImage());
+  anImage->SetImage(aPic);
+  QImage aRestored = anImage->Image();
+
+  CPPUNIT_ASSERT(!aRestored.isNull());
+  //aRestored.save("pic2.bmp");
+  CPPUNIT_ASSERT(aPic == aRestored);
+
+  aDoc->Close();
+}
+
+void test_HYDROData_Image::testTrsf()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+  Handle(HYDROData_Image) anImage = 
+    Handle(HYDROData_Image)::DownCast(aDoc->CreateObject(KIND_IMAGE));
+  // empty trsf
+  QTransform anEmpty = anImage->Trsf();
+  CPPUNIT_ASSERT(anEmpty.isIdentity());
+
+  // prepare Qt transformation for testing
+  QTransform aTrsf;
+  aTrsf.translate(50, 50);
+  aTrsf.rotate(45);
+  aTrsf.scale(0.5, 1.0);
+
+  anImage->SetTrsf(aTrsf);
+  QTransform aRestored = anImage->Trsf();
+
+  CPPUNIT_ASSERT(!aRestored.isIdentity());
+  CPPUNIT_ASSERT(aTrsf == aRestored);
+
+  aDoc->Close();
+}
+
+void test_HYDROData_Image::testReferences()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+  Handle(HYDROData_Image) anImage1 = 
+    Handle(HYDROData_Image)::DownCast(aDoc->CreateObject(KIND_IMAGE));
+  Handle(HYDROData_Image) anImage2 = 
+    Handle(HYDROData_Image)::DownCast(aDoc->CreateObject(KIND_IMAGE));
+  Handle(HYDROData_Image) anImage3 = 
+    Handle(HYDROData_Image)::DownCast(aDoc->CreateObject(KIND_IMAGE));
+
+  // check initially there is no references
+  CPPUNIT_ASSERT_EQUAL(anImage3->NbReferences(), 0);
+
+  // append reference
+  anImage3->AppendReference(anImage1);
+  CPPUNIT_ASSERT_EQUAL(anImage3->NbReferences(), 1);
+  CPPUNIT_ASSERT(IsEqual(anImage3->Reference(0), anImage1));
+
+  // change reference
+  anImage3->ChangeReference(0, anImage2);
+  CPPUNIT_ASSERT_EQUAL(anImage3->NbReferences(), 1);
+  CPPUNIT_ASSERT(IsEqual(anImage3->Reference(0), anImage2));
+
+  // append one more reference
+  anImage3->AppendReference(anImage1);
+  CPPUNIT_ASSERT_EQUAL(anImage3->NbReferences(), 2);
+  CPPUNIT_ASSERT(IsEqual(anImage3->Reference(0), anImage2));
+  CPPUNIT_ASSERT(IsEqual(anImage3->Reference(1), anImage1));
+
+  // remove reference
+  anImage3->RemoveReference(0);
+  CPPUNIT_ASSERT_EQUAL(anImage3->NbReferences(), 1);
+  CPPUNIT_ASSERT(IsEqual(anImage3->Reference(0), anImage1));
+
+  // remove reference
+  anImage3->RemoveReference(0);
+  CPPUNIT_ASSERT_EQUAL(anImage3->NbReferences(), 0);
+
+  // append two references once again and remove all references
+  anImage3->ChangeReference(0, anImage1);
+  anImage3->ChangeReference(1, anImage2);
+  CPPUNIT_ASSERT_EQUAL(anImage3->NbReferences(), 2);
+  CPPUNIT_ASSERT(IsEqual(anImage3->Reference(0), anImage1));
+  CPPUNIT_ASSERT(IsEqual(anImage3->Reference(1), anImage2));
+  anImage3->ClearReferences();
+  CPPUNIT_ASSERT_EQUAL(anImage3->NbReferences(), 0);
+
+  aDoc->Close();
+}
+
+void test_HYDROData_Image::testCopy()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+  Handle(HYDROData_Image) anImage1 = 
+    Handle(HYDROData_Image)::DownCast(aDoc->CreateObject(KIND_IMAGE));
+  // fill image 1
+  anImage1->SetImage(TestImage());
+
+  QTransform aTrsf;
+  aTrsf.translate(50, 50);
+  aTrsf.rotate(45);
+  aTrsf.scale(0.5, 1.0);
+  anImage1->SetTrsf(aTrsf);
+
+  Handle(HYDROData_Image) anImage2 = 
+    Handle(HYDROData_Image)::DownCast(aDoc->CreateObject(KIND_IMAGE));
+
+  anImage1->AppendReference(anImage2);
+
+  // copy image to the new one
+  Handle(HYDROData_Image) anImage3 = 
+    Handle(HYDROData_Image)::DownCast(aDoc->CreateObject(KIND_IMAGE));
+  anImage1->CopyTo(anImage3, true);
+
+  // check all fields are correctly copied
+  CPPUNIT_ASSERT(anImage1->Image() == anImage3->Image());
+  CPPUNIT_ASSERT(anImage1->Trsf() == anImage3->Trsf());
+  CPPUNIT_ASSERT_EQUAL(anImage3->NbReferences(), 1);
+  CPPUNIT_ASSERT(IsEqual(anImage3->Reference(0), anImage2));
+
+  aDoc->Close();
+}
diff --git a/src/HYDRO_tests/test_HYDROData_Image.h b/src/HYDRO_tests/test_HYDROData_Image.h
new file mode 100644 (file)
index 0000000..c649ece
--- /dev/null
@@ -0,0 +1,51 @@
+// 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 <cppunit/extensions/HelperMacros.h>
+
+class test_HYDROData_Image : public CppUnit::TestFixture {
+  CPPUNIT_TEST_SUITE(test_HYDROData_Image);
+  CPPUNIT_TEST(testQImage);
+  CPPUNIT_TEST(testTrsf);
+  CPPUNIT_TEST(testReferences);
+  CPPUNIT_TEST(testCopy);
+  CPPUNIT_TEST_SUITE_END();
+
+private:
+
+public:
+
+  void setUp() {}
+
+  void tearDown() {}
+
+  // checks save/restore QImages information
+  void testQImage();
+
+  // checks the transformations
+  void testTrsf();
+
+  // checks the references management
+  void testReferences();
+
+  // checks the image properties copy/paste
+  void testCopy();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_Image);
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_Image, "HYDROData_Image");
diff --git a/src/HYDRO_tests/test_HYDROData_Iterator.cxx b/src/HYDRO_tests/test_HYDROData_Iterator.cxx
new file mode 100644 (file)
index 0000000..7381a4e
--- /dev/null
@@ -0,0 +1,80 @@
+// 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<test_HYDROData_Iterator.h>
+
+#include <HYDROData_Document.h>
+#include <HYDROData_Iterator.h>
+
+#include <QString>
+
+void test_HYDROData_Iterator::testOneKind()
+{
+  static const QString aName1("test_name1");
+  static const QString aName2("test_name2");
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+  Handle(HYDROData_Entity) anObj = aDoc->CreateObject(KIND_IMAGE); // image object
+  anObj->SetName(aName1);
+  // first HYDROData_Entity must be destroyed because there is no hander pointer naymore
+  anObj = aDoc->CreateObject(KIND_IMAGE); // second image object
+  anObj->SetName(aName2);
+
+  HYDROData_Iterator anIter(aDoc, KIND_IMAGE);
+  CPPUNIT_ASSERT(anIter.More());
+  CPPUNIT_ASSERT(!anIter.Current().IsNull());
+  CPPUNIT_ASSERT_EQUAL(aName1.toStdString(), anIter.Current()->GetName().toStdString());
+
+  anIter.Next();
+  CPPUNIT_ASSERT(anIter.More());
+  CPPUNIT_ASSERT(!anIter.Current().IsNull());
+  CPPUNIT_ASSERT_EQUAL(aName2.toStdString(), anIter.Current()->GetName().toStdString());
+
+  anIter.Next();
+  CPPUNIT_ASSERT(!anIter.More());
+
+  aDoc->Close();
+}
+
+void test_HYDROData_Iterator::testAllKinds()
+{
+  static const QString aName1("test_name1");
+  static const QString aName2("test_name2");
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+  Handle(HYDROData_Entity) anObj = aDoc->CreateObject(KIND_IMAGE); // image object
+  anObj->SetName(aName1);
+  // first HYDROData_Entity must be destroyed because there is no hander pointer naymore
+  anObj = aDoc->CreateObject(KIND_IMAGE); // second image object
+  anObj->SetName(aName2);
+
+  HYDROData_Iterator anIter(aDoc, KIND_UNKNOWN);
+  CPPUNIT_ASSERT(anIter.More());
+  CPPUNIT_ASSERT(!anIter.Current().IsNull());
+  CPPUNIT_ASSERT_EQUAL(aName1.toStdString(), anIter.Current()->GetName().toStdString());
+
+  anIter.Next();
+  CPPUNIT_ASSERT(anIter.More());
+  CPPUNIT_ASSERT(!anIter.Current().IsNull());
+  CPPUNIT_ASSERT_EQUAL(aName2.toStdString(), anIter.Current()->GetName().toStdString());
+
+  anIter.Next();
+  CPPUNIT_ASSERT(!anIter.More());
+
+  aDoc->Close();
+}
diff --git a/src/HYDRO_tests/test_HYDROData_Iterator.h b/src/HYDRO_tests/test_HYDROData_Iterator.h
new file mode 100644 (file)
index 0000000..1ba38a6
--- /dev/null
@@ -0,0 +1,43 @@
+// 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 <cppunit/extensions/HelperMacros.h>
+
+class test_HYDROData_Iterator : public CppUnit::TestFixture {
+  CPPUNIT_TEST_SUITE(test_HYDROData_Iterator);
+  CPPUNIT_TEST(testOneKind);
+  CPPUNIT_TEST(testAllKinds);
+  CPPUNIT_TEST_SUITE_END();
+
+private:
+
+public:
+
+  void setUp() {}
+
+  void tearDown() {}
+
+  // checks iteration by one kind
+  void testOneKind();
+
+  // checks iteration by all kinds
+  void testAllKinds();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_Iterator);
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_Iterator, "HYDROData_Iterator");
diff --git a/src/HYDRO_tests/test_HYDROData_Main.cxx b/src/HYDRO_tests/test_HYDROData_Main.cxx
new file mode 100644 (file)
index 0000000..e3796b3
--- /dev/null
@@ -0,0 +1,68 @@
+// 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 <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/TestResult.h>
+#include <cppunit/TestResultCollector.h>
+#include <cppunit/TestRunner.h>
+#include <cppunit/TextTestProgressListener.h>
+#include <stdexcept>
+
+int 
+  main( int argc, char* argv[] )
+{
+  std::string testPath = (argc > 1) ? std::string(argv[1]) : "";
+
+  // Create the event manager and test controller
+  CppUnit::TestResult controller;
+
+  // Add a listener that colllects test result
+  CppUnit::TestResultCollector result;
+  controller.addListener( &result );        
+
+  // Add a listener that print dots as test run.
+  CppUnit::TextTestProgressListener progress;
+  controller.addListener( &progress );      
+
+  CppUnit::TestFactoryRegistry& registry = 
+    CppUnit::TestFactoryRegistry::getRegistry();
+  // Add the top suite to the test runner
+  CppUnit::TestRunner runner;
+  runner.addTest( registry.makeTest() );   
+  try
+  {
+    std::cout << "Running "  <<  testPath;
+    runner.run( controller, testPath );
+
+    std::cerr << std::endl;
+
+    // Print test in a compiler compatible format.
+    CppUnit::CompilerOutputter outputter( &result, std::cerr );
+    outputter.write();                      
+  }
+  catch ( std::invalid_argument &e )  // Test path not resolved
+  {
+    std::cerr  <<  std::endl  
+      <<  "ERROR: "  <<  e.what()
+      << std::endl;
+    return 0;
+  }
+
+  return result.wasSuccessful() ? 0 : 1;
+}
diff --git a/src/HYDRO_tests/test_HYDROData_OperationsFactory.cxx b/src/HYDRO_tests/test_HYDROData_OperationsFactory.cxx
new file mode 100644 (file)
index 0000000..f9c08ec
--- /dev/null
@@ -0,0 +1,100 @@
+// 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 <test_HYDROData_OperationsFactory.h>
+
+#include <HYDROData_Document.h>
+#include <HYDROData_Image.h>
+#include <HYDROData_PolylineXY.h>
+#include <HYDROData_OperationsFactory.h>
+
+#include <ImageComposer_CropOperator.h>
+
+#include <gp_XY.hxx>
+
+#include <QPainter>
+
+void test_HYDROData_OperationsFactory::testCreate()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+  
+  HYDROData_OperationsFactory* aFactory = HYDROData_OperationsFactory::Factory();
+  CPPUNIT_ASSERT(aFactory);
+  Handle(HYDROData_Image) anImage = aFactory->CreateImage(aDoc, NULL);
+  CPPUNIT_ASSERT(!anImage.IsNull());
+  CPPUNIT_ASSERT(anImage->Image().isNull());
+  
+  aDoc->Close();
+}
+
+static QImage TestImage() {
+  QImage aPic(50, 40, QImage::Format_RGB32);
+  aPic.fill(Qt::white);
+  QPainter aPainter(&aPic);
+  aPainter.drawEllipse(6, 7, 38, 30);
+  aPainter.drawLine(0, 40, 10, 0);
+  aPainter.drawLine(10, 0, 25, 35);
+  aPainter.drawLine(25, 35, 40, 0);
+  aPainter.drawLine(40, 0, 50, 40);
+  return aPic;
+}
+
+void test_HYDROData_OperationsFactory::testCrop()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
+  HYDROData_OperationsFactory* aFactory = HYDROData_OperationsFactory::Factory();
+  
+  // prepare the original image and crop-path
+  Handle(HYDROData_Image) anOriImage = 
+    Handle(HYDROData_Image)::DownCast( aDoc->CreateObject( KIND_IMAGE ) );
+
+  QImage aTestImage = TestImage();
+  anOriImage->SetImage( aTestImage );
+
+  Handle(HYDROData_PolylineXY) aCropPolyline = 
+    Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+
+  aCropPolyline->AddSection( "", HYDROData_PolylineXY::SECTION_POLYLINE, true );
+
+  aCropPolyline->AddPoint( 0, HYDROData_PolylineXY::Point( 25, 0  ) );
+  aCropPolyline->AddPoint( 0, HYDROData_PolylineXY::Point( 0,  20 ) );
+  aCropPolyline->AddPoint( 0, HYDROData_PolylineXY::Point( 25, 40 ) );
+  aCropPolyline->AddPoint( 0, HYDROData_PolylineXY::Point( 50, 20 ) );
+
+  // prepare Composer Operation
+  ImageComposer_Operator* aCropOp = 
+    aFactory->Operator( ImageComposer_CropOperator::Type() );
+  
+  CPPUNIT_ASSERT( aCropOp );
+
+  aCropOp->setArgs( Qt::red );
+
+  // create crop - image 
+  Handle(HYDROData_Image) aCropImage = aFactory->CreateImage( aDoc, aCropOp );
+  CPPUNIT_ASSERT( !aCropImage.IsNull() );
+
+  aCropImage->AppendReference( anOriImage );
+  aCropImage->AppendReference( aCropPolyline );
+  aCropImage->Update();
+
+  // check crop operation was performed
+  CPPUNIT_ASSERT( !aCropImage->Image().isNull() );
+  CPPUNIT_ASSERT( aCropImage->Image() != aTestImage );
+  
+  aDoc->Close();
+}
diff --git a/src/HYDRO_tests/test_HYDROData_OperationsFactory.h b/src/HYDRO_tests/test_HYDROData_OperationsFactory.h
new file mode 100644 (file)
index 0000000..3b5f7fd
--- /dev/null
@@ -0,0 +1,43 @@
+// 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 <cppunit/extensions/HelperMacros.h>
+
+class test_HYDROData_OperationsFactory : public CppUnit::TestFixture {
+  CPPUNIT_TEST_SUITE(test_HYDROData_OperationsFactory);
+  CPPUNIT_TEST(testCreate);
+  CPPUNIT_TEST(testCrop);
+  CPPUNIT_TEST_SUITE_END();
+
+private:
+
+public:
+
+  void setUp() {}
+
+  void tearDown() {}
+
+  // checks creation of images using null operators
+  void testCreate();
+
+  // checks creation of images using crop operator
+  void testCrop();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_OperationsFactory);
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_OperationsFactory, "HYDROData_OperationsFactory");
diff --git a/src/HYDRO_tests/test_HYDROData_PolylineXY.cxx b/src/HYDRO_tests/test_HYDROData_PolylineXY.cxx
new file mode 100644 (file)
index 0000000..99b6106
--- /dev/null
@@ -0,0 +1,73 @@
+// 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<test_HYDROData_PolylineXY.h>
+
+#include <HYDROData_Document.h>
+#include <HYDROData_PolylineXY.h>
+
+#include <QList>
+#include <QPointF>
+
+void test_HYDROData_PolylineXY::testPolyline()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
+
+  Handle(HYDROData_PolylineXY) aPolyline = 
+    Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
+
+  aPolyline->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, false );
+  aPolyline->AddSection( "Section_2", HYDROData_PolylineXY::SECTION_SPLINE, true );
+
+  int aNbSections = aPolyline->NbSections();
+  CPPUNIT_ASSERT( aNbSections == 2 );
+  
+  NCollection_Sequence<TCollection_AsciiString>           aSectNames;
+  NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
+  NCollection_Sequence<bool>                              aSectClosures;
+  aPolyline->GetSections( aSectNames, aSectTypes, aSectClosures );
+
+  CPPUNIT_ASSERT( aSectNames.Value( 0 ) == "Section_1" );
+  CPPUNIT_ASSERT( aSectTypes.Value( 0 ) == HYDROData_PolylineXY::SECTION_POLYLINE );
+  CPPUNIT_ASSERT( aSectClosures.Value( 0 ) == false );
+
+  CPPUNIT_ASSERT( aSectNames.Value( 1 ) == "Section_2" );
+  CPPUNIT_ASSERT( aSectTypes.Value( 1 ) == HYDROData_PolylineXY::SECTION_SPLINE );
+  CPPUNIT_ASSERT( aSectClosures.Value( 1 ) == true );
+
+  aDoc->Close();
+}
+
+
+void test_HYDROData_PolylineXY::testCopy()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+  Handle(HYDROData_PolylineXY) aPolyline1 = 
+    Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
+
+
+//  aPolyline1->setPoints(aPoints);
+
+  Handle(HYDROData_PolylineXY) aPolyline2 = 
+    Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
+
+  aPolyline1->CopyTo(aPolyline2, true);
+
+
+  aDoc->Close();
+}
diff --git a/src/HYDRO_tests/test_HYDROData_PolylineXY.h b/src/HYDRO_tests/test_HYDROData_PolylineXY.h
new file mode 100644 (file)
index 0000000..24623b3
--- /dev/null
@@ -0,0 +1,43 @@
+// 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 <cppunit/extensions/HelperMacros.h>
+
+class test_HYDROData_PolylineXY : public CppUnit::TestFixture {
+  CPPUNIT_TEST_SUITE(test_HYDROData_PolylineXY);
+  CPPUNIT_TEST(testPolyline);
+  CPPUNIT_TEST(testCopy);
+  CPPUNIT_TEST_SUITE_END();
+
+private:
+
+public:
+
+  void setUp() {}
+
+  void tearDown() {}
+
+  // checks save/restore QImages information
+  void testPolyline();
+
+  // checks the image properties copy/paste
+  void testCopy();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_PolylineXY);
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_PolylineXY, "HYDROData_PolylineXY");
diff --git a/src/HYDRO_tests/test_HYDROData_Profile.cxx b/src/HYDRO_tests/test_HYDROData_Profile.cxx
new file mode 100644 (file)
index 0000000..4987291
--- /dev/null
@@ -0,0 +1,165 @@
+// 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 <test_HYDROData_Profile.h>
+
+#include <HYDROData_Document.h>
+#include <HYDROData_Tool.h>
+#include <HYDROData_Profile.h>
+#include <HYDROData_Iterator.h>
+
+#include <TopoDS_Shape.hxx>
+
+#include <gp_XY.hxx>
+#include <gp_XYZ.hxx>
+
+#include <QDir>
+#include <QFile>
+#include <QTextStream>
+
+bool test_HYDROData_Profile::createTestFile( const QString& theFileName,
+                                             const bool     theIsParametric )
+{
+  QFile aTmpFile( theFileName );
+  if ( !aTmpFile.open( QIODevice::WriteOnly | QIODevice::Text ) )
+    return false;
+
+  if ( theIsParametric )
+  {
+    QTextStream anOutStream( &aTmpFile );
+    
+    anOutStream << "0      182.15 \n";
+    anOutStream << "4      181.95 \n";
+    anOutStream << "10.18  181.63 \n";
+    anOutStream << "14.75  179.27 \n";
+    anOutStream << "19.75  178.87 \n";
+
+    anOutStream << "\n";
+
+    anOutStream << "-5   50    \n";
+    anOutStream << "0    15    \n";
+    anOutStream << "10.1 10    \n";
+    anOutStream << "20   20    \n";
+    anOutStream << "250  0.005 \n";
+  }
+  else
+  {
+    QTextStream anOutStream( &aTmpFile );
+
+    anOutStream << "1040499.17 6788618.13 182.15 \n";
+    anOutStream << "1040503.12 6788618.79 181.95 \n";
+    anOutStream << "1040509.21 6788619.81 181.63 \n";
+    anOutStream << "1040513.72 6788620.56 179.27 \n";
+    anOutStream << "1040518.65 6788621.38 178.87 \n";
+  }
+
+  aTmpFile.close();
+
+  return true;
+}
+
+void test_HYDROData_Profile::testFileImport()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
+
+  QString aParamFileName = QDir::tempPath() + QDir::separator() + "parametric.pa";
+  QString aGeorefFileName = QDir::tempPath() + QDir::separator() + "georef.pa";
+  if ( !createTestFile( aParamFileName, true ) || !createTestFile( aGeorefFileName, false ) )
+    return; // No file has been created
+
+  TCollection_AsciiString aFileName( aParamFileName.toStdString().c_str() );
+
+  NCollection_Sequence<int> aBadProfilesList;
+  CPPUNIT_ASSERT( HYDROData_Profile::ImportFromFile( aDoc, aFileName, aBadProfilesList ) );
+
+  int aProfileCount = 0;
+  HYDROData_Iterator aDocIter( aDoc, KIND_PROFILE );
+  for ( ; aDocIter.More(); aDocIter.Next() )
+  {
+    Handle(HYDROData_Profile) aProfile = 
+      Handle(HYDROData_Profile)::DownCast( aDocIter.Current() );
+    if ( aProfile.IsNull() )
+      continue;
+    
+    CPPUNIT_ASSERT( aProfile->IsValid() == false );
+    CPPUNIT_ASSERT( aProfile->NbPoints() == 5 );
+    
+    aProfileCount++;
+  }
+
+  CPPUNIT_ASSERT( aProfileCount == 2 );
+
+  Handle(HYDROData_Profile) aGeorefProfile = 
+    Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
+
+  aFileName = TCollection_AsciiString( aGeorefFileName.toStdString().c_str() );
+  CPPUNIT_ASSERT( aGeorefProfile->ImportFromFile( aFileName ) );
+
+  // Check validity of imported profile
+  CPPUNIT_ASSERT( aGeorefProfile->IsValid() );
+
+  CPPUNIT_ASSERT( aGeorefProfile->GetTopShape().IsNull() == false );
+
+  aGeorefProfile->Update();
+  CPPUNIT_ASSERT( aGeorefProfile->GetShape3D().IsNull() == false );
+
+  HYDROData_Profile::ProfilePoints aProfilePoints = aGeorefProfile->GetProfilePoints();
+  CPPUNIT_ASSERT( aProfilePoints.Length() == 5 );
+
+  HYDROData_Profile::ProfilePoint aProfilePoint = aProfilePoints.Value( 3 );
+  CPPUNIT_ASSERT( ValuesEquals( aProfilePoint.X(), 1040509.21 ) );
+  CPPUNIT_ASSERT( ValuesEquals( aProfilePoint.Y(), 6788619.81 ) );
+  CPPUNIT_ASSERT( ValuesEquals( aProfilePoint.Z(), 181.63 ) );
+
+  aDoc->Close();
+}
+
+
+void test_HYDROData_Profile::testCopy()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+  
+  Handle(HYDROData_Profile) aProfile1 = 
+    Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
+
+  QString aFileName = QDir::tempPath() + QDir::separator() + "georef.pa";
+
+  bool anIsFileCreated = createTestFile( aFileName, false );
+  
+  if ( anIsFileCreated )
+  {
+    TCollection_AsciiString anAsciiFileName( aFileName.toStdString().c_str() );
+    CPPUNIT_ASSERT( aProfile1->ImportFromFile( anAsciiFileName ) );
+
+    CPPUNIT_ASSERT( aProfile1->IsValid() );
+    CPPUNIT_ASSERT( aProfile1->NbPoints() == 5 );
+  }
+
+  Handle(HYDROData_Profile) aProfile2 = 
+    Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
+
+  aProfile1->CopyTo( aProfile2, false );
+
+  if ( anIsFileCreated )
+  {
+    CPPUNIT_ASSERT( aProfile2->IsValid() );
+    CPPUNIT_ASSERT( aProfile2->NbPoints() == 5 );
+  }
+
+  aDoc->Close();
+}
diff --git a/src/HYDRO_tests/test_HYDROData_Profile.h b/src/HYDRO_tests/test_HYDROData_Profile.h
new file mode 100644 (file)
index 0000000..9785cf7
--- /dev/null
@@ -0,0 +1,50 @@
+// 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 <cppunit/extensions/HelperMacros.h>
+
+class Handle_HYDROData_Profile;
+class QString;
+
+class test_HYDROData_Profile : public CppUnit::TestFixture {
+  CPPUNIT_TEST_SUITE(test_HYDROData_Profile);
+  CPPUNIT_TEST(testFileImport);
+  CPPUNIT_TEST(testCopy);
+  CPPUNIT_TEST_SUITE_END();
+
+private:
+
+  static bool                             createTestFile( const QString& theFileName,
+                                                          const bool     theIsParametric );
+
+public:
+
+  void                                    setUp() {}
+
+  void                                    tearDown() {}
+
+  // checks file importing information
+  void                                    testFileImport();
+
+  // checks the copy/paste mechanism
+  void                                    testCopy();
+
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_Profile);
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROData_Profile, "HYDROData_Profile");
diff --git a/src/HYDRO_tests/test_HYDROData_StricklerTable.cxx b/src/HYDRO_tests/test_HYDROData_StricklerTable.cxx
new file mode 100644 (file)
index 0000000..4cf5798
--- /dev/null
@@ -0,0 +1,30 @@
+// 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 <test_HYDROData_StricklerTable.h>
+#include <HYDROData_Document.h>
+
+void test_HYDROData_StricklerTable::testImport()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+  Handle(HYDROData_Entity) anObj = aDoc->CreateObject( KIND_STRICKLER_TABLE );
+  TCollection_AsciiString aFileName = "test_name";
+  
+  aDoc->Close();
+}
diff --git a/src/HYDRO_tests/test_HYDROData_StricklerTable.h b/src/HYDRO_tests/test_HYDROData_StricklerTable.h
new file mode 100644 (file)
index 0000000..fcd1a38
--- /dev/null
@@ -0,0 +1,40 @@
+// 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
+//
+
+#ifdef WIN32
+  #pragma warning( disable: 4251 )
+#endif
+
+#include <cppunit/extensions/HelperMacros.h>
+
+class test_HYDROData_StricklerTable : public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE( test_HYDROData_StricklerTable );
+  CPPUNIT_TEST( testImport );
+  CPPUNIT_TEST_SUITE_END();
+
+public:
+  void testImport();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_StricklerTable );
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( test_HYDROData_StricklerTable, "HYDROData_StricklerTable" );
+
+#ifdef WIN32
+  #pragma warning( default: 4251 )
+#endif
diff --git a/src/HYDRO_tests/test_HYDROGUI_ListModel.cxx b/src/HYDRO_tests/test_HYDROGUI_ListModel.cxx
new file mode 100644 (file)
index 0000000..f5b0ea4
--- /dev/null
@@ -0,0 +1,427 @@
+// 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
+//
+
+#undef HYDROGUI_EXPORTS
+
+#include <test_HYDROGUI_ListModel.h>
+#include <HYDROData_Document.h>
+#include <HYDROGUI_ListModel.h>
+
+Handle_HYDROData_Document GetDocument()
+{
+  return HYDROData_Document::Document( 0 );
+}
+
+HYDROGUI_ListModel::Object2VisibleList CreateTestObjects( int theObjCount )
+{
+  HYDROGUI_ListModel::Object2VisibleList anObjects;
+
+  for( int i=0; i<theObjCount; i++ )
+  {
+    Handle_HYDROData_Entity anObj = GetDocument()->CreateObject( KIND_IMMERSIBLE_ZONE );
+
+    std::string aName = " ";
+    aName[0] = 'A' + i;
+    anObj->SetName( QString::fromStdString( aName ) );
+
+    bool isVisible = i%2==0;
+
+    anObjects.append( HYDROGUI_ListModel::Object2Visible( anObj, isVisible ) );
+  }
+  return anObjects;
+}
+
+std::string test_HYDROGUI_ListModel::GetObjects( HYDROGUI_ListModel* theModel ) const
+{
+  std::string anObjects;
+  for( int i=0, n=theModel->myObjects.size(); i<n; i++ )
+  {
+    std::string anObjName = theModel->myObjects[i].first->GetName().toStdString();
+    if( theModel->isObjectVisible( i ) )
+      anObjName = "*" + anObjName;
+    if( i>0 )
+      anObjects += ", ";
+    anObjects += anObjName;
+  }
+  return anObjects;
+}
+
+/**
+  Test move up algorithm.
+*/
+void test_HYDROGUI_ListModel::testMoveUp()
+{
+  HYDROGUI_ListModel* aModel = new HYDROGUI_ListModel();
+  aModel->setObjects( CreateTestObjects( 6 ) );
+  const HYDROGUI_ListModel::OpType anUp = HYDROGUI_ListModel::Up;
+
+  // 0. Check the initial state
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
+
+  // 1. [ *A ] / ALL OBJECTS
+  aModel->move( QList<int>() << 0, anUp, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
+
+  // 2. [ *A, B ] / ALL OBJECTS
+  aModel->move( QList<int>() << 0 << 1, anUp, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
+
+  // 3. [ *A, *C ] / ALL OBJECTS
+  aModel->move( QList<int>() << 0 << 2, anUp, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
+
+  // 4. [ *A, F ] / ALL OBJECTS
+  aModel->move( QList<int>() << 0 << 5, anUp, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
+
+  // 5. [ F ] X 6 times / ALL OBJECTS
+  aModel->move( QList<int>() << 5, anUp, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, F, *E" ), GetObjects( aModel ) );
+  aModel->move( QList<int>() << 4, anUp, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, F, D, *E" ), GetObjects( aModel ) );
+  aModel->move( QList<int>() << 3, anUp, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, F, *C, D, *E" ), GetObjects( aModel ) );
+  aModel->move( QList<int>() << 2, anUp, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, F, B, *C, D, *E" ), GetObjects( aModel ) );
+  aModel->move( QList<int>() << 1, anUp, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "F, *A, B, *C, D, *E" ), GetObjects( aModel ) );
+  aModel->move( QList<int>() << 0, anUp, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "F, *A, B, *C, D, *E" ), GetObjects( aModel ) );
+
+  // 6. [ *A, B ] / ALL OBJECTS
+  aModel->move( QList<int>() << 1 << 2, anUp, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, F, *C, D, *E" ), GetObjects( aModel ) );
+
+  // 7. [ B, *C, *E ] / ALL OBJECTS
+  aModel->move( QList<int>() << 1 << 3 << 5, anUp, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "B, *A, *C, F, *E, D" ), GetObjects( aModel ) );
+
+  // 8. [ *A, *C, F, *E, D ] / ALL OBJECTS
+  aModel->move( QList<int>() << 1 << 2 << 3 << 4 << 5, anUp, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, *C, F, *E, D, B" ), GetObjects( aModel ) );
+
+  // 9. [ *E ] / VISIBLE OBJECTS
+  aModel->move( QList<int>() << 3, anUp, true );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, *E, *C, F, D, B" ), GetObjects( aModel ) );
+
+  // 10. [ *E, *C ] / VISIBLE OBJECTS
+  aModel->move( QList<int>() << 1 << 2, anUp, true );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*E, *C, *A, F, D, B" ), GetObjects( aModel ) );
+
+  // 11. [ *A, F ] / ALL OBJECTS
+  aModel->move( QList<int>() << 2 << 3, anUp, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*E, *A, F, *C, D, B" ), GetObjects( aModel ) );
+
+  // 12. [ *A, *C ] / VISIBLE OBJECTS
+  aModel->move( QList<int>() << 1 << 3, anUp, true );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, *C, *E, F, D, B" ), GetObjects( aModel ) );
+
+  // 13. [] / ALL OBJECTS
+  aModel->move( QList<int>(), anUp, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, *C, *E, F, D, B"), GetObjects( aModel ) );
+
+  // 14. [ *A, *C, *E, F, D, B ] / ALL OBJECTS
+  aModel->move( QList<int>() << 0 << 1 << 2 << 3 << 4 << 5, anUp, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, *C, *E, F, D, B"), GetObjects( aModel ) );
+
+  delete aModel;
+}
+
+/**
+  Test move on top algorithm.
+*/
+void test_HYDROGUI_ListModel::testMoveOnTop()
+{
+  HYDROGUI_ListModel* aModel = new HYDROGUI_ListModel();
+  aModel->setObjects( CreateTestObjects( 6 ) );
+  const HYDROGUI_ListModel::OpType aTop = HYDROGUI_ListModel::Top;
+
+  // 0. Check the initial state
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
+
+  // 1. [ *A ] / ALL OBJECTS
+  aModel->move( QList<int>() << 0, aTop, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
+
+  // 2. [ *A ] / VISIBLE OBJECTS
+  aModel->move( QList<int>() << 0, aTop, true );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
+
+  // 3. [ F ] / ALL OBJECTS
+  aModel->move( QList<int>() << 5, aTop, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "F, *A, B, *C, D, *E" ), GetObjects( aModel ) );
+
+  // 4. [ *E ] / VISIBLE OBJECTS
+  aModel->move( QList<int>() << 5, aTop, true );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*E, F, *A, B, *C, D" ), GetObjects( aModel ) );
+
+  // 5. [ *E, F ] / ALL OBJECTS
+  aModel->move( QList<int>() << 0 << 1, aTop, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*E, F, *A, B, *C, D" ), GetObjects( aModel ) );
+
+  // 6. [ *E, *A ] / ALL OBJECTS
+  aModel->move( QList<int>() << 0 << 2, aTop, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*E, *A, F, B, *C, D" ), GetObjects( aModel ) );
+
+  // 7. [ *A, F, *C ] / ALL OBJECTS
+  aModel->move( QList<int>() << 1 << 2 << 4, aTop, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, F, *C, *E, B, D" ), GetObjects( aModel ) );
+
+  // 8.  [ F, *C, *E, B, D ] / ALL OBJECTS
+  aModel->move( QList<int>() << 1 << 2 << 3 << 4 << 5, aTop, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "F, *C, *E, B, D, *A" ), GetObjects( aModel ) );
+
+  // 9. [] / ALL OBJECTS
+  aModel->move( QList<int>(), aTop, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "F, *C, *E, B, D, *A" ), GetObjects( aModel ) );
+
+  // 10. [*F, *C, *E, B, D, *A] / ALL OBJECTS
+  aModel->move( QList<int>() << 0 << 1 << 2 << 3 << 4 << 5, aTop, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "F, *C, *E, B, D, *A" ), GetObjects( aModel ) );
+
+  delete aModel;
+}
+
+/**
+  Test move down algorithm.
+*/
+void test_HYDROGUI_ListModel::testMoveDown()
+{
+  HYDROGUI_ListModel* aModel = new HYDROGUI_ListModel();
+  aModel->setObjects( CreateTestObjects( 6 ) );
+  const HYDROGUI_ListModel::OpType aDown = HYDROGUI_ListModel::Down;
+
+  // 0. Check the initial state
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
+
+  // 1. [ F ] / ALL OBJECTS
+  aModel->move( QList<int>() << 5, aDown, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
+
+  // 2. [ *E, F ] / ALL OBJECTS
+  aModel->move( QList<int>() << 4 << 5, aDown, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
+
+  // 3. [ D, F ] / ALL OBJECTS
+  aModel->move( QList<int>() << 3 << 5, aDown, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
+
+  // 4. [ *A, F ] / ALL OBJECTS
+  aModel->move( QList<int>() << 0 << 5, aDown, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
+
+  // 5. [ *A ] X 6 times / ALL OBJECTS
+  aModel->move( QList<int>() << 0, aDown, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "B, *A, *C, D, *E, F" ), GetObjects( aModel ) );
+  aModel->move( QList<int>() << 1, aDown, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, *A, D, *E, F" ), GetObjects( aModel ) );
+  aModel->move( QList<int>() << 2, aDown, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, D, *A, *E, F" ), GetObjects( aModel ) );
+  aModel->move( QList<int>() << 3, aDown, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, D, *E, *A, F" ), GetObjects( aModel ) );
+  aModel->move( QList<int>() << 4, aDown, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, D, *E, F, *A" ), GetObjects( aModel ) );
+  aModel->move( QList<int>() << 5, aDown, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, D, *E, F, *A" ), GetObjects( aModel ) );
+
+  // 6. [ *E, *F ] / ALL OBJECTS
+  aModel->move( QList<int>() << 3 << 4, aDown, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, D, *A, *E, F" ), GetObjects( aModel ) );
+
+  // 7. [ B, D, *E ] / ALL OBJECTS
+  aModel->move( QList<int>() << 0 << 2 << 4, aDown, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*C, B, *A, D, F, *E" ), GetObjects( aModel ) );
+
+  // 8. [ *C, B, *A, D, F ] / ALL OBJECTS
+  aModel->move( QList<int>() << 0 << 1 << 2 << 3 << 4, aDown, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*E, *C, B, *A, D, F" ), GetObjects( aModel ) );
+
+  // 9. [ *C ] / VISIBLE OBJECTS
+  aModel->move( QList<int>() << 1, aDown, true );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*E, B, *A, *C, D, F" ), GetObjects( aModel ) );
+
+  // 10. [ *E, *A ] / VISIBLE OBJECTS
+  aModel->move( QList<int>() << 0 << 2, aDown, true );
+  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, *E, *A, D, F" ), GetObjects( aModel ) );
+
+  // 11. [ *E, *A ] / VISIBLE OBJECTS
+  aModel->move( QList<int>() << 2 << 3, aDown, true );
+  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, *E, *A, D, F" ), GetObjects( aModel ) );
+
+  // 12. [ *C, *E, *A ] / VISIBLE OBJECTS
+  aModel->move( QList<int>() << 1 << 2 << 3, aDown, true );
+  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, *E, *A, D, F" ), GetObjects( aModel ) );
+
+  // 13. [] / ALL OBJECTS
+  aModel->move( QList<int>(), aDown, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, *E, *A, D, F"), GetObjects( aModel ) );
+
+  // 14. [ B, *C, *E, *A, D, F ] / ALL OBJECTS
+  aModel->move( QList<int>() << 0 << 1 << 2 << 3 << 4 << 5, aDown, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, *E, *A, D, F"), GetObjects( aModel ) );
+
+  delete aModel;
+}
+
+/**
+  Test move on bottom algorithm.
+*/
+void test_HYDROGUI_ListModel::testMoveOnBottom()
+{
+  HYDROGUI_ListModel* aModel = new HYDROGUI_ListModel();
+  aModel->setObjects( CreateTestObjects( 6 ) );
+  const HYDROGUI_ListModel::OpType aBottom = HYDROGUI_ListModel::Bottom;
+
+  // 0. Check the initial state
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
+
+  // 1. [ F ] / ALL OBJECTS
+  aModel->move( QList<int>() << 5, aBottom, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
+
+  // 2. [ F ] / VISIBLE OBJECTS
+  aModel->move( QList<int>() << 5, aBottom, true );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, B, *C, D, *E, F" ), GetObjects( aModel ) );
+
+  // 3. [ *A ] / ALL OBJECTS
+  aModel->move( QList<int>() << 0, aBottom, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "B, *C, D, *E, F, *A" ), GetObjects( aModel ) );
+
+  // 4. [ *C ] / VISIBLE OBJECTS
+  aModel->move( QList<int>() << 1, aBottom, true );
+  CPPUNIT_ASSERT_EQUAL( std::string( "B, D, *E, F, *A, *C" ), GetObjects( aModel ) );
+
+  // 5. [ B, D ] / ALL OBJECTS
+  aModel->move( QList<int>() << 0 << 1, aBottom, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*E, F, *A, *C, B, D" ), GetObjects( aModel ) );
+
+  // 6. [ *C, *D ] / ALL OBJECTS
+  aModel->move( QList<int>() << 3 << 5, aBottom, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*E, F, *A, B, *C, D" ), GetObjects( aModel ) );
+
+  // 7. [ *E, *A, *C ] / ALL OBJECTS
+  aModel->move( QList<int>() << 0 << 2 << 4, aBottom, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "F, B, D, *E, *A, *C" ), GetObjects( aModel ) );
+
+  // 8.  [ B, D, *E, *A ] / ALL OBJECTS
+  aModel->move( QList<int>() << 1 << 2 << 3 << 4 , aBottom, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "F, *C, B, D, *E, *A" ), GetObjects( aModel ) );
+
+  // 9. [] / ALL OBJECTS
+  aModel->move( QList<int>(), aBottom, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "F, *C, B, D, *E, *A" ), GetObjects( aModel ) );
+
+  // 10. [F, *C, B, D, *E, *A] / ALL OBJECTS
+  aModel->move( QList<int>() << 0 << 1 << 2 << 3 << 4 << 5, aBottom, false );
+  CPPUNIT_ASSERT_EQUAL( std::string( "F, *C, B, D, *E, *A" ), GetObjects( aModel ) );
+
+  delete aModel;
+}
+
+/**
+  Test drag and drop algorithm.
+*/
+void test_HYDROGUI_ListModel::testDragAndDrop()
+{
+  HYDROGUI_ListModel* aModel = new HYDROGUI_ListModel();
+  aModel->setObjects( CreateTestObjects( 8 ) );
+  const HYDROGUI_ListModel::OpType aDnD = HYDROGUI_ListModel::DragAndDrop;
+
+  // 0. Check the initial state
+  std::string anInitialState = std::string( "*A, B, *C, D, *E, F, *G, H" );
+  CPPUNIT_ASSERT_EQUAL( anInitialState, GetObjects( aModel ) );
+
+  // 1. [] -> B ( i=1 )
+  bool aRes = aModel->move( QList<int>(), aDnD, false, 1 );
+  CPPUNIT_ASSERT_EQUAL( false, aRes );
+  CPPUNIT_ASSERT_EQUAL( anInitialState, GetObjects( aModel ) );
+
+  // 2. ALL -> B ( i=1 )
+  QList<int> anAll;
+  anAll << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7;
+  aRes = aModel->move( anAll, aDnD, false, 1 );
+  CPPUNIT_ASSERT_EQUAL( false, aRes );
+  CPPUNIT_ASSERT_EQUAL( anInitialState, GetObjects( aModel ) );
+
+  // 3. [D, *E, *G] -> D : drop item is among dragged items ( at the beginning )
+  aRes = aModel->move( QList<int>() << 3 << 4 << 6, aDnD, false, 3 );
+  CPPUNIT_ASSERT_EQUAL( false, aRes );
+  CPPUNIT_ASSERT_EQUAL( anInitialState, GetObjects( aModel ) );
+
+  // 4. [D, *E, *G] -> *E : drop item is among dragged items ( in the middle )
+  aRes = aModel->move( QList<int>() << 3 << 4 << 6, aDnD, false, 4 );
+  CPPUNIT_ASSERT_EQUAL( false, aRes );
+  CPPUNIT_ASSERT_EQUAL( anInitialState, GetObjects( aModel ) );
+
+  // 5. [D, *E, *G] -> *G : drop item is among dragged items ( at the end )
+  aRes = aModel->move( QList<int>() << 3 << 4 << 6, aDnD, false, 6 );
+  CPPUNIT_ASSERT_EQUAL( false, aRes );
+  CPPUNIT_ASSERT_EQUAL( anInitialState, GetObjects( aModel ) );
+
+  // 6. [D, *E, *G] -> -1 : drop item index is out of range ( less than zero )
+  aRes = aModel->move( QList<int>() << 3 << 4 << 6, aDnD, false, -1 );
+  CPPUNIT_ASSERT_EQUAL( false, aRes );
+  CPPUNIT_ASSERT_EQUAL( anInitialState, GetObjects( aModel ) );
+
+  // 7. [D, *E, *G] -> -1 : drop item index is out of range ( more than than list length )
+  aRes = aModel->move( QList<int>() << 3 << 4 << 6, aDnD, false, 9 );
+  CPPUNIT_ASSERT_EQUAL( false, aRes );
+  CPPUNIT_ASSERT_EQUAL( anInitialState, GetObjects( aModel ) );
+
+  // 8. [D, *E, *G] -> B ( i = 1 )
+  aRes = aModel->move( QList<int>() << 3 << 4 << 6, aDnD, false, 1 );
+  CPPUNIT_ASSERT_EQUAL( true, aRes );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, D, *E, *G, B, *C, F, H" ), GetObjects( aModel ) );
+
+  // 9. [*E, F] -> *G
+  aRes = aModel->move( QList<int>() << 2 << 6, aDnD, false, 3 );
+  CPPUNIT_ASSERT_EQUAL( true, aRes );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, D, *E, F, *G, B, *C, H" ), GetObjects( aModel ) );
+
+  // 10. [*E, F, *G] -> *A
+  aRes = aModel->move( QList<int>() << 2 << 3 << 4, aDnD, false, 0 );
+  CPPUNIT_ASSERT_EQUAL( true, aRes );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*E, F, *G, *A, D, B, *C, H" ), GetObjects( aModel ) );
+
+  // 11. [*G, D, *C, H] -> B
+  aRes = aModel->move( QList<int>() << 2 << 4 << 6 << 7, aDnD, false, 5 );
+  CPPUNIT_ASSERT_EQUAL( true, aRes );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*E, F, *A, *G, D, *C, H, B" ), GetObjects( aModel ) );
+
+  // 12. [F, *A, *G, D, *C, H, B] -> *E
+  QList<int> anAllWithoutFirst;
+  anAllWithoutFirst << 1 << 2 << 3 << 4 << 5 << 6 << 7;
+  aRes = aModel->move( anAllWithoutFirst, aDnD, false, 0 );
+  CPPUNIT_ASSERT_EQUAL( true, aRes );
+  CPPUNIT_ASSERT_EQUAL( std::string( "F, *A, *G, D, *C, H, B, *E" ), GetObjects( aModel ) );
+
+  // 13. [*A, *G] -> D : no changes
+  aRes = aModel->move(  QList<int>() << 1 << 2, aDnD, false, 3 );
+  CPPUNIT_ASSERT_EQUAL( true, aRes );
+  CPPUNIT_ASSERT_EQUAL( std::string( "F, *A, *G, D, *C, H, B, *E" ), GetObjects( aModel ) );
+
+  // 14. [F, *G] -> D
+  aRes = aModel->move(  QList<int>() << 0 << 2, aDnD, false, 3 );
+  CPPUNIT_ASSERT_EQUAL( true, aRes );
+  CPPUNIT_ASSERT_EQUAL( std::string( "*A, F, *G, D, *C, H, B, *E" ), GetObjects( aModel ) );
+
+  // 15. [*A, *G, *C, H, *E] -> D
+  aRes = aModel->move(  QList<int>() << 0 << 2 << 4 << 5 << 7, aDnD, false, 3 );
+  CPPUNIT_ASSERT_EQUAL( true, aRes );
+  CPPUNIT_ASSERT_EQUAL( std::string( "F, *A, *G, *C, H, *E, D, B" ), GetObjects( aModel ) );
+}
\ No newline at end of file
diff --git a/src/HYDRO_tests/test_HYDROGUI_ListModel.h b/src/HYDRO_tests/test_HYDROGUI_ListModel.h
new file mode 100644 (file)
index 0000000..28dc153
--- /dev/null
@@ -0,0 +1,44 @@
+// 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 <cppunit/extensions/HelperMacros.h>
+
+class HYDROGUI_ListModel;
+
+class test_HYDROGUI_ListModel : public CppUnit::TestFixture {
+  CPPUNIT_TEST_SUITE(test_HYDROGUI_ListModel);
+  CPPUNIT_TEST(testMoveUp);
+  CPPUNIT_TEST(testMoveOnTop);
+  CPPUNIT_TEST(testMoveDown);
+  CPPUNIT_TEST(testMoveOnBottom);
+  CPPUNIT_TEST(testDragAndDrop);
+  CPPUNIT_TEST_SUITE_END();
+
+private:
+  std::string GetObjects( HYDROGUI_ListModel* theModel ) const;
+
+public:
+  void testMoveUp();
+  void testMoveOnTop();
+  void testMoveDown();
+  void testMoveOnBottom();
+  void testDragAndDrop();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROGUI_ListModel);
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROGUI_ListModel, "HYDROGUI_ListModel");
diff --git a/src/HYDRO_tests/test_HYDROGUI_Main.cxx b/src/HYDRO_tests/test_HYDROGUI_Main.cxx
new file mode 100644 (file)
index 0000000..a12862d
--- /dev/null
@@ -0,0 +1,70 @@
+// 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 <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/TestResult.h>
+#include <cppunit/TestResultCollector.h>
+#include <cppunit/TestRunner.h>
+#include <cppunit/TextTestProgressListener.h>
+#include <stdexcept>
+#include <QApplication>
+
+int main( int argc, char* argv[] )
+{
+  QApplication anApp( argc, argv );
+
+  std::string testPath = (argc > 1) ? std::string(argv[1]) : "";
+
+  // Create the event manager and test controller
+  CppUnit::TestResult controller;
+
+  // Add a listener that colllects test result
+  CppUnit::TestResultCollector result;
+  controller.addListener( &result );        
+
+  // Add a listener that print dots as test run.
+  CppUnit::TextTestProgressListener progress;
+  controller.addListener( &progress );      
+
+  CppUnit::TestFactoryRegistry& registry = 
+    CppUnit::TestFactoryRegistry::getRegistry();
+  // Add the top suite to the test runner
+  CppUnit::TestRunner runner;
+  runner.addTest( registry.makeTest() );   
+  try
+  {
+    std::cout << "Running "  <<  testPath;
+    runner.run( controller, testPath );
+
+    std::cerr << std::endl;
+
+    // Print test in a compiler compatible format.
+    CppUnit::CompilerOutputter outputter( &result, std::cerr );
+    outputter.write();                      
+  }
+  catch ( std::invalid_argument &e )  // Test path not resolved
+  {
+    std::cerr  <<  std::endl  
+      <<  "ERROR: "  <<  e.what()
+      << std::endl;
+    return 0;
+  }
+
+  return result.wasSuccessful() ? 0 : 1;
+}