From: asl Date: Thu, 28 Sep 2017 07:58:39 +0000 (+0300) Subject: refs #1331: automatic test for profiles points in GUI X-Git-Tag: v2.1~66^2~12^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e3143f45b5b09e2ee43f2058fd23de2926fb4944;p=modules%2Fhydro.git refs #1331: automatic test for profiles points in GUI --- diff --git a/src/HYDROGUI/HYDROGUI_InputPanel.h b/src/HYDROGUI/HYDROGUI_InputPanel.h index e5093afa..936c4ba4 100644 --- a/src/HYDROGUI/HYDROGUI_InputPanel.h +++ b/src/HYDROGUI/HYDROGUI_InputPanel.h @@ -50,6 +50,8 @@ public: bool isApplyEnabled() const; void setApplyEnabled( bool ); + QSplitter* splitter() const; + signals: void panelApplyAndClose(); void panelApply(); @@ -67,8 +69,6 @@ protected: QFrame* buttonFrame() const; virtual void closeEvent ( QCloseEvent * event ); - QSplitter* splitter() const; - QPushButton* myCancel; QPushButton* myHelp; diff --git a/src/HYDRO_tests/ExternalFiles.cmake b/src/HYDRO_tests/ExternalFiles.cmake index 5a5af45f..a62eed23 100644 --- a/src/HYDRO_tests/ExternalFiles.cmake +++ b/src/HYDRO_tests/ExternalFiles.cmake @@ -80,6 +80,7 @@ set( EXTERNAL_FILES ../HYDROGUI/HYDROGUI_ProfileDlg.cxx ../HYDROGUI/HYDROGUI_ViewerDlg.cxx ../HYDROGUI/HYDROGUI_AISTrihedron.cxx + ../HYDROGUI/HYDROGUI_CurveCreatorProfile.cxx ) set( MOC_HEADERS diff --git a/src/HYDRO_tests/test_HYDROGUI_ProfilesDlg.cxx b/src/HYDRO_tests/test_HYDROGUI_ProfilesDlg.cxx index fb2cc843..6a24a09c 100644 --- a/src/HYDRO_tests/test_HYDROGUI_ProfilesDlg.cxx +++ b/src/HYDRO_tests/test_HYDROGUI_ProfilesDlg.cxx @@ -19,9 +19,25 @@ #undef HYDROGUI_EXPORTS #include + +#define private public #include +#undef private + +#include +#include +#include +#include +#include + +#include +#include + + #include #include +#include +#include #include #define CPPUNIT_ASSERT_WIDGET( theWidget, theCase ) \ @@ -50,3 +66,57 @@ void test_HYDROGUI_ProfilesDlg::test_default_size() dlg->deleteLater(); qApp->processEvents(); } + +void test_HYDROGUI_ProfilesDlg::test_points_table() +{ + HYDROGUI_ProfileDlg* dlg = new HYDROGUI_ProfileDlg( 0, "test" ); + dlg->resize( 320, 800 ); + + HYDROGUI_CurveCreatorProfile* aProfile = new HYDROGUI_CurveCreatorProfile(); + CurveCreator::Coordinates coords; + coords.push_back( 0 ); + coords.push_back( 20 ); + coords.push_back( 30 ); + coords.push_back( 0 ); + coords.push_back( 60 ); + coords.push_back( 0 ); + coords.push_back( 90 ); + coords.push_back( 20 ); + aProfile->addPoints( coords, 0 ); + + dlg->setProfile( aProfile ); + dlg->show(); + QTest::qWaitForWindowExposed( dlg ); + + Handle(AIS_InteractiveContext) aCtx = dlg->getAISContext(); + CurveCreator_Displayer* aDisplayer = new CurveCreator_Displayer( aCtx ); + aProfile->setDisplayer( aDisplayer ); + aDisplayer->display( aProfile->getAISObject( true ), true ); + + CurveCreator_ICurve::SectionToPointList sel; + sel.push_back( CurveCreator_ICurve::SectionToPoint( 0, 0 ) ); + sel.push_back( CurveCreator_ICurve::SectionToPoint( 0, 1 ) ); + sel.push_back( CurveCreator_ICurve::SectionToPoint( 0, 2 ) ); + sel.push_back( CurveCreator_ICurve::SectionToPoint( 0, 3 ) ); + dlg->myEditorWidget->getAction( CurveCreator_Widget::ModificationMode )->toggle(); + dlg->myEditorWidget->onModificationMode( true ); + dlg->myEditorWidget->setSelectedPoints( sel ); + dlg->myEditorWidget->updateLocalPointView(); + + QList sizes; + sizes.append( 25 ); + sizes.append( 100 ); + sizes.append( 200 ); + sizes.append( 25 ); + sizes.append( 25 ); + dlg->splitter()->setSizes( sizes ); + + qApp->processEvents(); + + QTest::qWait( 50000 ); + + dlg->deleteLater(); + delete aProfile; + delete aDisplayer; + qApp->processEvents(); +} diff --git a/src/HYDRO_tests/test_HYDROGUI_ProfilesDlg.h b/src/HYDRO_tests/test_HYDROGUI_ProfilesDlg.h index 0c40ecfe..38e956c4 100644 --- a/src/HYDRO_tests/test_HYDROGUI_ProfilesDlg.h +++ b/src/HYDRO_tests/test_HYDROGUI_ProfilesDlg.h @@ -22,10 +22,12 @@ class test_HYDROGUI_ProfilesDlg : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(test_HYDROGUI_ProfilesDlg); CPPUNIT_TEST(test_default_size); + CPPUNIT_TEST(test_points_table); CPPUNIT_TEST_SUITE_END(); public: void test_default_size(); + void test_points_table(); }; CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROGUI_ProfilesDlg);