QString TestViewer::myKey = "";
extern QString REF_DATA_PATH;
+extern QString TMP_DIR;
OCCViewer_ViewManager* TestViewer::viewManager()
{
return true;
}
- QString temp = QDir::tempPath();
-#ifndef WIN32
- temp += "/hydro";
- if( !QDir().exists( temp ) )
- QDir().mkpath( temp );
-#endif
-
- QString aPath = temp + "/" + myKey + ".png";
+ QString aPath = TMP_DIR + "/" + myKey + ".png";
anActualImage.save( aPath );
//std::cout << "Actual image: " << aPath.toStdString() << std::endl;
QImage aDiff = diff( anExpectedRefImage, anActualImage );
- QString aDiffFilePath = temp + "/" + myKey + "_diff.png";
+ QString aDiffFilePath = TMP_DIR + "/" + myKey + "_diff.png";
aDiff.save( aDiffFilePath );
//std::cout << "Diff image: " << aDiffFilePath.toStdString() << std::endl;
- QString anExpected = temp + "/" + myKey + "_1.png";
+ QString anExpected = TMP_DIR + "/" + myKey + "_1.png";
//std::cout << "Expected image: " << anExpected.toStdString() << std::endl;
anExpectedRefImage.save( anExpected );
QString anExpectedRefFilePath = REF_DATA_PATH;
anExpectedRefFilePath += "/" + theBaseName;
-#ifdef WIN32
- QString anActualFilePath = QDir::tempPath() + "/" + theBaseName;
-#else
- QString anActualFilePath = QDir::tempPath() + "/hydro/" + theBaseName;
-#endif
+ QString anActualFilePath = TMP_DIR + "/" + theBaseName;
QFile anExpected( anExpectedRefFilePath );
QFile anActual( anActualFilePath );
#include <gp_Pnt2d.hxx>
const double EPS = 1E-4;
+extern QString TMP_DIR;
void generateOne( QTextStream& theStream,
double theFirstX, double theFirstY,
Handle(HYDROData_Bathymetry) aBathymetry =
Handle(HYDROData_Bathymetry)::DownCast( aDoc->CreateObject( KIND_BATHYMETRY ) );
- QString aFileName = QDir::tempPath() + QDir::separator() + "test.xyz";
+ QString aFileName = TMP_DIR + QDir::separator() + "test.xyz";
if ( !createTestFile( aFileName ) )
return; // No file has been created
Handle(HYDROData_Bathymetry) aBathymetry1 =
Handle(HYDROData_Bathymetry)::DownCast( aDoc->CreateObject( KIND_BATHYMETRY ) );
- QString aFileName = QDir::tempPath() + QDir::separator() + "test.xyz";
+ QString aFileName = TMP_DIR + QDir::separator() + "test.xyz";
bool anIsFileCreated = createTestFile( aFileName );
extern QString REF_DATA_PATH;
const QString DEF_STR_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/share/salome/resources/hydro/def_strickler_table_06.txt";
+extern QString TMP_DIR;
void test_HYDROData_LandCoverMap::test_add_2_objects()
{
QString aBaseName = "lc_dump.py";
QString aBaseShp = "lc_dump.shp";
QString aBaseDbf = "lc_dump.dbf";
- QString aTmpPath = QDir::tempPath() + "/" + aBaseName;
+ QString aTmpPath = TMP_DIR + "/" + aBaseName;
CPPUNIT_ASSERT_EQUAL( true, aDoc->DumpToPython( aTmpPath, false ) );
//TODO: CPPUNIT_ASSERT_SCRIPTS_EQUAL( aBaseName, true, false, 20 );
QString aTmpFileName = "test.telemac";
#ifdef WIN32
- QString aTmpPath = QDir::tempPath() + "/" + aTmpFileName;
+ QString aTmpPath = TMP_DIR + "/" + aTmpFileName;
#else
- QString aTmpPath = QDir::tempPath() + "/hydro/" + aTmpFileName;
+ QString aTmpPath = TMP_DIR + "/hydro/" + aTmpFileName;
#endif
QString messStat;
CPPUNIT_ASSERT_EQUAL( true, aMap->ExportTelemac( aTmpPath, 1E-4, aTable, messStat ) );
#ifdef WIN32
QString REF_DATA_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO";
+QString TMP_DIR = QDir::tempPath();
#else
QString REF_DATA_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO/HYDRO";
+QString TMP_DIR = QDir::tempPath() + "/hydro";
#endif
+
int MAIN_W = 800, MAIN_H = 600;
int main( int argc, char* argv[] )
SUIT_Session aSession;
aSession.startApplication("std");
+ QDir().mkdir( TMP_DIR );
+
OCCViewer_ViewFrame* aWindow = TestViewer::viewWindow();
aWindow->setGeometry( 400, 100, MAIN_W, MAIN_H );
const double EPS = 1E-2;
extern QString REF_DATA_PATH;
+extern QString TMP_DIR;
bool test_HYDROData_Profile::createTestFile( const QString& theFileName,
const bool theIsParametric )
{
Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
- QString aParamFileName = QDir::tempPath() + QDir::separator() + "parametric.pa";
- QString aGeorefFileName = QDir::tempPath() + QDir::separator() + "georef.pa";
+ QString aParamFileName = TMP_DIR + QDir::separator() + "parametric.pa";
+ QString aGeorefFileName = TMP_DIR + QDir::separator() + "georef.pa";
if ( !createTestFile( aParamFileName, true ) || !createTestFile( aGeorefFileName, false ) )
return; // No file has been created
Handle(HYDROData_Profile) aProfile1 =
Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
- QString aFileName = QDir::tempPath() + QDir::separator() + "georef.pa";
+ QString aFileName = TMP_DIR + QDir::separator() + "georef.pa";
bool anIsFileCreated = createTestFile( aFileName, false );
#include <QTableWidget>
const QString DEF_STR_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/share/salome/resources/hydro/def_strickler_table_06.txt";
+extern QString TMP_DIR;
void test_HYDROData_StricklerTable::test_import()
{
Handle(HYDROData_StricklerTable)::DownCast( aDoc->CreateObject( KIND_STRICKLER_TABLE ) );
CPPUNIT_ASSERT_EQUAL( true, aTable->Import( DEF_STR_PATH ) );
- QString aTmpPath = QDir::tempPath() + "/stricker.txt";
+ QString aTmpPath = TMP_DIR + "/stricker.txt";
CPPUNIT_ASSERT_EQUAL( true, aTable->Export( aTmpPath ) );
QFile aRefFile( DEF_STR_PATH ), aTmpFile( aTmpPath );
aTable->SetName( "ST" );
CPPUNIT_ASSERT_EQUAL( true, aTable->Import( DEF_STR_PATH ) );
-#ifdef WIN32
- QString aTmpPath = QDir::tempPath() + "/st_dump.py";
-#else
- QString aTmpPath = QDir::tempPath() + "/hydro/st_dump.py";
-#endif
+ QString aTmpPath = TMP_DIR + "/st_dump.py";
CPPUNIT_ASSERT_EQUAL( true, aDoc->DumpToPython( aTmpPath, false ) );