From b575fb0eb903afcbed4eae4364768312d9ccad16 Mon Sep 17 00:00:00 2001 From: asl Date: Mon, 19 Oct 2015 09:00:50 +0300 Subject: [PATCH] tests on Linux --- src/HYDRO_tests/CMakeLists.txt | 6 +++--- src/HYDRO_tests/TestViewer.cxx | 4 +++- src/HYDRO_tests/TestViewer.h | 2 +- src/HYDRO_tests/test_HYDROData_Main.cxx | 2 ++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/HYDRO_tests/CMakeLists.txt b/src/HYDRO_tests/CMakeLists.txt index 30e87f5b..4e4a4114 100644 --- a/src/HYDRO_tests/CMakeLists.txt +++ b/src/HYDRO_tests/CMakeLists.txt @@ -53,7 +53,7 @@ ENDIF() SET( BOOST_INCLUDES $ENV{BOOST_ROOT_DIR}/include/boost-1_52 ) SET( CPPUNIT_INCLUDES $ENV{CPPUNIT_ROOT_DIR}/include ) SET( CAS_INCLUDES $ENV{CAS_ROOT_DIR}/inc ) -SET( QT_INCLUDES $ENV{QT4_ROOT_DIR}/include $ENV{QT4_ROOT_DIR}/include/QtCore $ENV{QT4_ROOT_DIR}/include/QtGui ) +SET( QT_INCLUDES $ENV{QT4_ROOT_DIR}/include $ENV{QT4_ROOT_DIR}/include/QtCore $ENV{QT4_ROOT_DIR}/include/QtGui $ENV{QT4_ROOT_DIR}/include/QtTest ) SET( GUI_INCLUDES $ENV{GUI_ROOT_DIR}/include/salome ) IF( ${WIN32} ) @@ -65,9 +65,9 @@ SET( CAS_LIBRARIES TKernel TKLCAF TKCAF TKCDF TKMath TKG2d TKG3d TKBRep TKGeomBa link_directories( $ENV{QT4_ROOT_DIR}/lib ) IF( ${WIN32} ) - SET( QT_LIBRARIES QtCored4 QtGuid4 ) + SET( QT_LIBRARIES QtCored4 QtGuid4 QtTestd4 ) ELSE() - SET( QT_LIBRARIES QtCore QtGui ) + SET( QT_LIBRARIES QtCore QtGui QtTest ) ENDIF() link_directories( $ENV{CPPUNIT_ROOT_DIR}/lib ) diff --git a/src/HYDRO_tests/TestViewer.cxx b/src/HYDRO_tests/TestViewer.cxx index 0d9a6668..e48228a1 100644 --- a/src/HYDRO_tests/TestViewer.cxx +++ b/src/HYDRO_tests/TestViewer.cxx @@ -69,6 +69,7 @@ QColor randomColor() { int r = test_rand(); int aHue = r%255; + //std::cout << "hue: " << aHue << std::endl; QColor aColor = QColor::fromHsl( aHue, 255, 128 ); return aColor; } @@ -91,7 +92,7 @@ void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, } } -void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, char* theKey ) +void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const char* theKey ) { context()->EraseAll(); @@ -152,6 +153,7 @@ bool TestViewer::AssertImages( QString& theMessage ) QString aPath = QDir::tempPath() + "/" + myKey + ".png"; anActualImage.save( aPath ); + std::cout << anActualImage.width() << "x" << anActualImage.height() << std::endl; theMessage = "The viewer contents does not correspond to the reference image: " + myKey; QImage aDiff( anExpectedRefImage.width(), anExpectedRefImage.height(), QImage::Format_ARGB32 ); diff --git a/src/HYDRO_tests/TestViewer.h b/src/HYDRO_tests/TestViewer.h index 669b5621..9768982a 100644 --- a/src/HYDRO_tests/TestViewer.h +++ b/src/HYDRO_tests/TestViewer.h @@ -16,7 +16,7 @@ public: static OCCViewer_ViewWindow* viewWindow(); static void show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const QColor& theColor ); - static void show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, char* theKey ); + static void show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const char* theKey ); static bool AssertImages( QString& theMessage ); private: diff --git a/src/HYDRO_tests/test_HYDROData_Main.cxx b/src/HYDRO_tests/test_HYDROData_Main.cxx index 40d7c4a3..2ad810e2 100644 --- a/src/HYDRO_tests/test_HYDROData_Main.cxx +++ b/src/HYDRO_tests/test_HYDROData_Main.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include int main( int argc, char* argv[] ) @@ -40,6 +41,7 @@ int main( int argc, char* argv[] ) OCCViewer_ViewWindow* aWindow = TestViewer::viewWindow(); aWindow->setGeometry( 200, 200, 800, 600 ); aWindow->show(); + QTest::qWaitForWindowShown( aWindow ); std::string testPath = (argc > 1) ? std::string(argv[1]) : ""; -- 2.39.2