]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #1341: adaptation of automatic tests for Linux
authorasl <asl@opencascade.com>
Tue, 14 Nov 2017 13:51:55 +0000 (16:51 +0300)
committerasl <asl@opencascade.com>
Tue, 14 Nov 2017 13:51:55 +0000 (16:51 +0300)
src/HYDRO_tests/TestViewer.cxx
src/HYDRO_tests/test_HYDROData_Main.cxx
src/HYDRO_tests/test_HYDROData_ShapeFile.cxx
src/HYDRO_tests/test_HYDROData_Tool.cxx
src/HYDRO_tests/test_Overview.cxx

index 5c143368ade0c182cbc045e665ab7d637a4ca586..3f971a4731980007408d8fb6b7b6db992093e663 100644 (file)
@@ -59,6 +59,8 @@ OCCViewer_ViewManager* TestViewer::myViewManager = 0;
 OCCViewer_ViewFrame* TestViewer::myViewWindow = 0;
 QString TestViewer::myKey = "";
 
+extern QString REF_DATA_PATH;
+
 OCCViewer_ViewManager* TestViewer::viewManager()
 {
   if( myViewManager )
@@ -293,10 +295,11 @@ bool TestViewer::AssertImages( QString& theMessage, const QImage* theImage, cons
   if( theCase )
     myKey = theCase;
 
-  QString anExpectedRefFilePath = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO";
+  QString anExpectedRefFilePath = REF_DATA_PATH;
   anExpectedRefFilePath += "/" + myKey + ".png";
   QImage anExpectedRefImage; 
   anExpectedRefImage.load( anExpectedRefFilePath );
+  std::cout << "Expected image loading: " << anExpectedRefFilePath.toStdString() << std::endl;
 
   if( AreImagesEqual( anActualImage, anExpectedRefImage, 0.001 ) )
   {
@@ -306,6 +309,8 @@ bool TestViewer::AssertImages( QString& theMessage, const QImage* theImage, cons
 
   QString aPath = QDir::tempPath() + "/" + myKey + ".png";
   anActualImage.save( aPath );
+  std::cout << "Actual image: " << aPath.toStdString() << std::endl;
+  
   //std::cout << anActualImage.width() << "x" << anActualImage.height() << std::endl;
   theMessage = "The viewer contents does not correspond to the reference image: " + myKey;
   
@@ -317,8 +322,11 @@ bool TestViewer::AssertImages( QString& theMessage, const QImage* theImage, cons
 
   QString aDiffFilePath = QDir::tempPath() + "/" + myKey + "_diff.png";
   aDiff.save( aDiffFilePath );
+  std::cout << "Diff image: " << aDiffFilePath.toStdString() << std::endl;
 
-  anExpectedRefImage.save( QDir::tempPath() + "/" + myKey + "_1.png");
+  QString anExpected = QDir::tempPath() + "/" + myKey + "_1.png";
+  std::cout << "Expected image: " << anExpected.toStdString() << std::endl;
+  anExpectedRefImage.save( anExpected );
 
   return false;
 }
@@ -397,7 +405,7 @@ bool TestViewer::areScriptsEqual( const QString& theBaseName,
                                   int theLinesToOmit,
                                   QString& theMsg )
 {
-  QString anExpectedRefFilePath = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO";
+  QString anExpectedRefFilePath = REF_DATA_PATH;
   anExpectedRefFilePath += "/" + theBaseName;
   
   QString anActualFilePath = QDir::tempPath() + "/" + theBaseName;
index 3b4d053f4ddf0198a7a3a0b269d81f71323b73b9..b9fbf30583413fb818844aa52f5c082e2c1afb41 100644 (file)
 #define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
 
+#ifdef WIN32
 QString REF_DATA_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO";
+#else
+QString REF_DATA_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO/HYDRO";
+#endif
+
 
 int main( int argc, char* argv[] )
 {
index b4007ceaab6b03cbaab3386bb72d37b7f12274aa..de1a1289958d5250b2ea130596f7313b6026b6cf 100644 (file)
@@ -21,7 +21,7 @@
 #include <QStringList>
 #include <vector>
 
-const QString REF_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO";
+extern QString REF_DATA_PATH;
 
 bool test_HYDROData_ShapeFile::compare_two_files(const QString& File1, const QString& File2)
 {
@@ -48,7 +48,7 @@ bool test_HYDROData_ShapeFile::compare_two_files(const QString& File1, const QSt
 
 void test_HYDROData_ShapeFile::test_openDbf()
 {
-  QString aDBFPath = REF_PATH + "/cyprus_natural.dbf";
+  QString aDBFPath = REF_DATA_PATH + "/cyprus_natural.dbf";
   HYDROData_ShapeFile aSHPFile;
   bool Stat = aSHPFile.DBF_OpenDBF(aDBFPath);
   CPPUNIT_ASSERT_EQUAL( true, Stat );  
@@ -57,7 +57,7 @@ void test_HYDROData_ShapeFile::test_openDbf()
 
 void test_HYDROData_ShapeFile::test_NbFieldsDbf()
 {
-  QString aDBFPath = REF_PATH + "/cyprus_natural.dbf";
+  QString aDBFPath = REF_DATA_PATH + "/cyprus_natural.dbf";
   HYDROData_ShapeFile aSHPFile;
   CPPUNIT_ASSERT_EQUAL(true, aSHPFile.DBF_OpenDBF(aDBFPath));
   int NbF = aSHPFile.DBF_GetNbFields();
@@ -67,7 +67,7 @@ void test_HYDROData_ShapeFile::test_NbFieldsDbf()
 
 void test_HYDROData_ShapeFile::test_FieldListDbf()
 {
-  QString aDBFPath = REF_PATH + "/cyprus_natural.dbf";
+  QString aDBFPath = REF_DATA_PATH + "/cyprus_natural.dbf";
   HYDROData_ShapeFile aSHPFile;
   CPPUNIT_ASSERT_EQUAL(true, aSHPFile.DBF_OpenDBF(aDBFPath));
 
@@ -79,7 +79,7 @@ void test_HYDROData_ShapeFile::test_FieldListDbf()
 
 void test_HYDROData_ShapeFile::test_FieldTypeListDbf()
 {
-  QString aDBFPath = REF_PATH + "/cyprus_natural.dbf";
+  QString aDBFPath = REF_DATA_PATH + "/cyprus_natural.dbf";
   HYDROData_ShapeFile aSHPFile;
   CPPUNIT_ASSERT_EQUAL(true, aSHPFile.DBF_OpenDBF(aDBFPath));
 
@@ -92,7 +92,7 @@ void test_HYDROData_ShapeFile::test_FieldTypeListDbf()
 
 void test_HYDROData_ShapeFile::test_NbRecordsDbf()
 {
-  QString aDBFPath = REF_PATH + "/cyprus_natural.dbf";
+  QString aDBFPath = REF_DATA_PATH + "/cyprus_natural.dbf";
   HYDROData_ShapeFile aSHPFile;
   CPPUNIT_ASSERT_EQUAL(true, aSHPFile.DBF_OpenDBF(aDBFPath));
   int NbR = aSHPFile.DBF_GetNbRecords();
@@ -103,7 +103,7 @@ void test_HYDROData_ShapeFile::test_NbRecordsDbf()
 void test_HYDROData_ShapeFile::test_GetAttrListIndex()
 {
   { //cyprus_natural
-    QString aDBFPath = REF_PATH + "/cyprus_natural.dbf";
+    QString aDBFPath = REF_DATA_PATH + "/cyprus_natural.dbf";
     HYDROData_ShapeFile aSHPFile;
     CPPUNIT_ASSERT_EQUAL(true, aSHPFile.DBF_OpenDBF(aDBFPath));
     std::vector<HYDROData_ShapeFile::DBF_AttrValue> theAttrV;
@@ -134,7 +134,7 @@ void test_HYDROData_ShapeFile::test_GetAttrListIndex()
     aSHPFile.DBF_CloseDBF();
   }
   { //CLC06
-    QString aDBFPath = REF_PATH + "/CLC06.dbf";
+    QString aDBFPath = REF_DATA_PATH + "/CLC06.dbf";
     HYDROData_ShapeFile aSHPFile;
     CPPUNIT_ASSERT_EQUAL (true, aSHPFile.DBF_OpenDBF(aDBFPath));
     std::vector<HYDROData_ShapeFile::DBF_AttrValue> theAttrV;
@@ -163,8 +163,8 @@ void test_HYDROData_ShapeFile::test_DbfWrite()
 {
   {
     HYDROData_ShapeFile aSHPFile; 
-    QString tempFN = REF_PATH + "/temp_dbf1.dbf";
-    QString refFN = REF_PATH + "/ref_dbf1.dbf";
+    QString tempFN = REF_DATA_PATH + "/temp_dbf1.dbf";
+    QString refFN = REF_DATA_PATH + "/ref_dbf1.dbf";
     std::vector<HYDROData_ShapeFile::DBF_AttrValue> theAttrV;
     HYDROData_ShapeFile::DBF_AttrValue theAttr1;
     theAttr1.myFieldType = HYDROData_ShapeFile::DBF_FieldType_String;
@@ -187,8 +187,8 @@ void test_HYDROData_ShapeFile::test_DbfWrite()
 
   {
     HYDROData_ShapeFile aSHPFile; 
-    QString tempFN = REF_PATH + "/temp_dbf2.dbf";
-    QString refFN = REF_PATH + "/ref_dbf2.dbf";
+    QString tempFN = REF_DATA_PATH + "/temp_dbf2.dbf";
+    QString refFN = REF_DATA_PATH + "/ref_dbf2.dbf";
     std::vector<HYDROData_ShapeFile::DBF_AttrValue> theAttrV;
     HYDROData_ShapeFile::DBF_AttrValue theAttr1;
     theAttr1.myFieldType = HYDROData_ShapeFile::DBF_FieldType_String;
@@ -219,8 +219,8 @@ void test_HYDROData_ShapeFile::test_DbfWrite()
 
   {
     HYDROData_ShapeFile aSHPFile; 
-    QString tempFN = REF_PATH + "/temp_dbf3.dbf";
-    QString refFN = REF_PATH + "/ref_dbf3.dbf";
+    QString tempFN = REF_DATA_PATH + "/temp_dbf3.dbf";
+    QString refFN = REF_DATA_PATH + "/ref_dbf3.dbf";
     std::vector<HYDROData_ShapeFile::DBF_AttrValue> theAttrV;
     HYDROData_ShapeFile::DBF_AttrValue theAttr1;
     theAttr1.myFieldType = HYDROData_ShapeFile::DBF_FieldType_Integer;
index 9c4109802f639a4fd4774ef640fdd04189c83b1f..0d259ccddadf927e5d2f5ec934a1aae1508b4b85 100644 (file)
 #include <TopTools_IndexedMapOfShape.hxx>
 #include <TopoDS_Iterator.hxx>
 
+extern QString REF_DATA_PATH;
 
 void test_HYDROData_Tool::test_rebuild_cmp()
 {
-  QString RefPath = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO";
+  QString RefPath = REF_DATA_PATH;
   BRep_Builder bb;
   {
     TopoDS_Shape in, out;
index d01de7cf7a012027e229357daf3a6a00c6aea30b..6da12ce1be13b4a391e0abea94d7fec13f3af5d1 100644 (file)
@@ -112,6 +112,7 @@ void test_Overview::showShape()
   BRep_Builder B;
   TopoDS_Shape shape;
   std::string fname = (REF_DATA_PATH + "/test_zone.brep").toStdString();
+  std::cout << "Loading shape: " << fname << std::endl;
   BRepTools::Read( shape, fname.c_str(), B );
   TestViewer::show( shape, AIS_Shaded, true, 0x03399FF );