Salome HOME
Merge branch 'BR_1330' into BR_DEMO
[modules/hydro.git] / src / HYDRO_tests / test_HYDROData_ShapeFile.cxx
index e0369578ef897484ed4439ba8ce1bec0f607c839..b4007ceaab6b03cbaab3386bb72d37b7f12274aa 100644 (file)
@@ -21,7 +21,7 @@
 #include <QStringList>
 #include <vector>
 
-const QString REF_PATH = qgetenv( "HYDRO_REFERENCE_DATA" );
+const QString REF_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO";
 
 bool test_HYDROData_ShapeFile::compare_two_files(const QString& File1, const QString& File2)
 {
@@ -217,5 +217,27 @@ void test_HYDROData_ShapeFile::test_DbfWrite()
     CPPUNIT_ASSERT_EQUAL( 0, remove (tempFN.toStdString().c_str()));
   }
 
+  {
+    HYDROData_ShapeFile aSHPFile; 
+    QString tempFN = REF_PATH + "/temp_dbf3.dbf";
+    QString refFN = REF_PATH + "/ref_dbf3.dbf";
+    std::vector<HYDROData_ShapeFile::DBF_AttrValue> theAttrV;
+    HYDROData_ShapeFile::DBF_AttrValue theAttr1;
+    theAttr1.myFieldType = HYDROData_ShapeFile::DBF_FieldType_Integer;
+    theAttr1.myIsNull = false;
+
+    for (int ii = 0; ii < 100; ii++)
+    {
+      theAttr1.myIntVal = ii;
+      theAttrV.push_back(theAttr1);
+    }
+
+    //
+    CPPUNIT_ASSERT(aSHPFile.DBF_WriteFieldAndValues(tempFN, "test_field_name", HYDROData_ShapeFile::DBF_FieldType_Integer, theAttrV, false));
+
+    CPPUNIT_ASSERT(compare_two_files(tempFN, refFN));
+    CPPUNIT_ASSERT_EQUAL( 0, remove (tempFN.toStdString().c_str()));
+  }
+
 }