From ed212e770c6b27f801c094fc3774fb1f4d021b27 Mon Sep 17 00:00:00 2001 From: asl Date: Fri, 13 Nov 2015 13:58:07 +0300 Subject: [PATCH] refs #673: test for export to Telemac --- src/HYDRO_tests/TestViewer.cxx | 23 +- src/HYDRO_tests/TestViewer.h | 15 +- src/HYDRO_tests/reference_data/test.telemac | 6515 +++++++++++++++++ .../test_HYDROData_LandCoverMap.cxx | 2 +- .../test_HYDROData_StricklerTable.cxx | 2 +- 5 files changed, 6547 insertions(+), 10 deletions(-) create mode 100644 src/HYDRO_tests/reference_data/test.telemac diff --git a/src/HYDRO_tests/TestViewer.cxx b/src/HYDRO_tests/TestViewer.cxx index fd031b6d..d6d14bd5 100644 --- a/src/HYDRO_tests/TestViewer.cxx +++ b/src/HYDRO_tests/TestViewer.cxx @@ -284,7 +284,21 @@ void TestViewer::select( int theViewX, int theViewY ) context()->Select(); } -bool TestViewer::areScriptsEqual( const QString& theBaseName ) +QString GetLine( QFile& theFile, bool isUtf8 ) +{ + QByteArray aLineData = theFile.readLine(); + QString aLine; + if( isUtf8 ) + aLine = QString::fromUtf8( aLineData ); + else + aLine = aLineData; + return aLine; +} + +bool TestViewer::areScriptsEqual( const QString& theBaseName, + bool isExpectedUtf8, + bool isActualUtf8, + int theLinesToOmit ) { QString anExpectedRefFilePath = qgetenv( "HYDRO_REFERENCE_DATA" ); anExpectedRefFilePath += "/" + theBaseName; @@ -297,15 +311,14 @@ bool TestViewer::areScriptsEqual( const QString& theBaseName ) !anActual.open ( QFile::ReadOnly | QFile::Text ) ) return false; - const int aLinesToOmit = 20; - for( int i=0; iExportTelemac( aTmpPath, 1E-4 ) ); - CPPUNIT_ASSERT_SCRIPTS_EQUAL( aTmpFileName ); + CPPUNIT_ASSERT_SCRIPTS_EQUAL( aTmpFileName, true, true, 0 ); aDoc->Close(); } diff --git a/src/HYDRO_tests/test_HYDROData_StricklerTable.cxx b/src/HYDRO_tests/test_HYDROData_StricklerTable.cxx index 3c013483..184360d3 100644 --- a/src/HYDRO_tests/test_HYDROData_StricklerTable.cxx +++ b/src/HYDRO_tests/test_HYDROData_StricklerTable.cxx @@ -211,7 +211,7 @@ void test_HYDROData_StricklerTable::test_dump_python() QString aTmpPath = QDir::tempPath() + "/st_dump.py"; CPPUNIT_ASSERT_EQUAL( true, aDoc->DumpToPython( aTmpPath, false ) ); - CPPUNIT_ASSERT_SCRIPTS_EQUAL( "st_dump.py" ); + CPPUNIT_ASSERT_SCRIPTS_EQUAL( "st_dump.py", true, false, 20 ); aDoc->Close(); } -- 2.39.2