]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #1331: automatic test for profiles points in GUI
authorasl <asl@opencascade.com>
Thu, 28 Sep 2017 07:58:39 +0000 (10:58 +0300)
committerasl <asl@opencascade.com>
Thu, 28 Sep 2017 07:58:39 +0000 (10:58 +0300)
src/HYDROGUI/HYDROGUI_InputPanel.h
src/HYDRO_tests/ExternalFiles.cmake
src/HYDRO_tests/test_HYDROGUI_ProfilesDlg.cxx
src/HYDRO_tests/test_HYDROGUI_ProfilesDlg.h

index e5093afa428afceff6e577a11d6c3f81832b3f4c..936c4ba4d1a5a8eb5690f708c56e0ad4a7fd0273 100644 (file)
@@ -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;
 
index 5a5af45f68ade8a9e58b521c3417616c8a0b740f..a62eed2342b1fb8daa4b5ddbfeb2f2dac10e6ef3 100644 (file)
@@ -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 
index fb2cc8435364d9d05284b0fc121121d80ddb0db8..6a24a09c242cb7e8808a08ec9b3e463ab73ae6e9 100644 (file)
 #undef HYDROGUI_EXPORTS
 
 #include <test_HYDROGUI_ProfilesDlg.h>
+
+#define private public
 #include <HYDROGUI_ProfileDlg.h>
+#undef private 
+
+#include <HYDROGUI_CurveCreatorProfile.h>
+#include <CurveCreator_Widget.h>
+#include <CurveCreator_TableView.h>
+#include <CurveCreator_Displayer.hxx>
+#include <CurveCreator_Utils.hxx>
+
+#include <HYDROData_Document.h>
+#include <HYDROData_Profile.h>
+
+
 #include <TestViewer.h>
 #include <QApplication>
+#include <QAction>
+#include <QSplitter>
 #include <QTest>
 
 #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<int> 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();
+}
index 0c40ecfede1917a00b16ecb6d1fdbec859a40b64..38e956c48591ef69ed59e0f037ea47f1ddbc53b2 100644 (file)
@@ -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);