sizes.append( 25 );
splitter()->setSizes( sizes );
+#ifndef TEST_MODE
QSettings settings;
splitter()->restoreState( settings.value( splitter_key ).toByteArray() );
+#endif
}
HYDROGUI_ProfileDlg::~HYDROGUI_ProfileDlg()
{
+#ifndef TEST_MODE
QSettings settings;
settings.setValue( splitter_key, splitter()->saveState() );
+#endif
}
void HYDROGUI_ProfileDlg::reset()
: HYDROGUI_InputPanel( theModule, theTitle, true, isSplitter )
{
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
- myViewManager = new OCCViewer_ViewManager( theModule->getApp()->activeStudy(), 0 );
+ SUIT_Study* aStudy = theModule ? theModule->getApp()->activeStudy() : 0;
+
+ myViewManager = new OCCViewer_ViewManager( aStudy, 0 );
OCCViewer_Viewer* aViewer = new OCCViewer_Viewer( true );
aViewer->setBackground( OCCViewer_ViewFrame::TOP_LEFT,
test_Dependencies.cxx
test_HYDROData_Tool.cxx
test_GraphicsView.cxx
+ test_HYDROGUI_ProfilesDlg.cxx
TestShape.cxx
TestViewer.cxx
TestLib_Runner.cxx
)
-add_definitions( -DLIGHT_MODE -DHYDRODATA_STATIC -DHYDROGUI_STATIC )
+add_definitions( -DLIGHT_MODE -DHYDRODATA_STATIC -DHYDROGUI_STATIC -DTEST_MODE)
IF( ${WIN32} )
add_definitions( -DWNT -D__WIN32__ -D__x86__ -D_WIN64 -D_WIN32_WINNT=0x0400 -D__NT__ -D__OSVERSION__=4 )
../HYDROGUI/HYDROGUI_StreamDlg.cxx
../HYDROGUI/HYDROGUI_ListSelector.cxx
../HYDROGUI/HYDROGUI_OrderedListWidget.cxx
+ ../HYDROGUI/HYDROGUI_ProfileDlg.cxx
+ ../HYDROGUI/HYDROGUI_ViewerDlg.cxx
+ ../HYDROGUI/HYDROGUI_AISTrihedron.cxx
)
set( MOC_HEADERS
../HYDROGUI/HYDROGUI_StreamDlg.h
../HYDROGUI/HYDROGUI_ListSelector.h
../HYDROGUI/HYDROGUI_OrderedListWidget.h
+ ../HYDROGUI/HYDROGUI_ProfileDlg.h
+ ../HYDROGUI/HYDROGUI_ViewerDlg.h
)
QT_WRAP_MOC( PROJECT_MOC_HEADERS ${MOC_HEADERS} )
return true;
}
-bool TestViewer::AssertImages( QString& theMessage, const QImage* theImage, const char* theCase )
+bool TestViewer::AssertImages( QString& theMessage, const QImage* theImage, const char* theCase, bool swapRGB )
{
QImage anActualImage;
if( theImage )
else
anActualImage = viewWindow()->dumpView();
- const bool SWAP_RGB_ORDER = true;
- if( SWAP_RGB_ORDER )
+ if( swapRGB )
{
// A temporary patch for bug in SALOME/OCC dump; the result image contains swapped RGB colors
anActualImage = anActualImage.rgbSwapped();
int theUIANb = 10, int theVIANb = 10);
static void show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const char* theKey,
int theUIANb = 10, int theVIANb = 10);
- static bool AssertImages( QString& theMessage, const QImage* = 0, const char* theCase = 0 );
+ static bool AssertImages( QString& theMessage, const QImage* = 0, const char* theCase = 0, bool swapRGB = true );
static QColor GetColor(int i);
static Handle(AIS_ColorScale) colorScale();
gv_fitall.png
gv_zoomed_1.png
gv_zoomed_2.png
+ profiles_dlg_presentation.png
)
# Application tests
--- /dev/null
+// Copyright (C) 2014-2015 EDF-R&D
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#undef HYDROGUI_EXPORTS
+
+#include <test_HYDROGUI_ProfilesDlg.h>
+#include <HYDROGUI_ProfileDlg.h>
+#include <TestViewer.h>
+#include <QApplication>
+#include <QTest>
+
+#define CPPUNIT_ASSERT_WIDGET( theWidget, theCase ) \
+ { \
+ QPixmap aPixmap = QPixmap::grabWindow( theWidget->winId() ); \
+ QImage anImage = aPixmap.toImage(); \
+ QString aMessage; \
+ if( !TestViewer::AssertImages( aMessage, &anImage, theCase, false ) ) \
+ { \
+ TestViewer::showColorScale( false ); \
+ std::string aMessageStl = aMessage.toStdString(); \
+ CPPUNIT_FAIL( aMessageStl.c_str() ); \
+ } \
+ } \
+
+
+void test_HYDROGUI_ProfilesDlg::test_default_size()
+{
+ HYDROGUI_ProfileDlg* dlg = new HYDROGUI_ProfileDlg( 0, "test" );
+ dlg->resize( 320, 640 );
+ dlg->show();
+ QTest::qWaitForWindowExposed( dlg );
+
+ CPPUNIT_ASSERT_WIDGET( dlg, "profiles_dlg_presentation" );
+
+ dlg->deleteLater();
+ qApp->processEvents();
+}
--- /dev/null
+// Copyright (C) 2014-2015 EDF-R&D
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <cppunit/extensions/HelperMacros.h>
+
+class test_HYDROGUI_ProfilesDlg : public CppUnit::TestFixture
+{
+ CPPUNIT_TEST_SUITE(test_HYDROGUI_ProfilesDlg);
+ CPPUNIT_TEST(test_default_size);
+ CPPUNIT_TEST_SUITE_END();
+
+public:
+ void test_default_size();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROGUI_ProfilesDlg);
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROGUI_ProfilesDlg, "HYDROGUI_ProfilesDlg");