]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
TestRecorder support.
authormkr <mkr@opencascade.com>
Thu, 18 Sep 2008 13:08:52 +0000 (13:08 +0000)
committermkr <mkr@opencascade.com>
Thu, 18 Sep 2008 13:08:52 +0000 (13:08 +0000)
adm_local/unix/config_files/Makefile.am
adm_local/unix/config_files/check_TestRecorder.m4 [new file with mode: 0644]
configure.ac
src/SUIT/Makefile.am
src/SUIT/SUIT_ExceptionHandler.cxx
src/SUITApp/Makefile.am
src/SUITApp/SUITApp_Application.cxx
src/SUITApp/SUITApp_Application.h
src/Session/Makefile.am
src/Session/SALOME_Session_Server.cxx

index 3b4c5acd9f4f64898f08d9679eced8355e906608..e0847b3c1af78522fffaac4e6faa05552ccacc3e 100644 (file)
@@ -36,4 +36,5 @@ check_SupervGraphViewer.m4    \
 check_vtk.m4                   \
 check_VTKViewer.m4             \
 check_corba_in_GUI.m4          \
-check_QxGraphViewer.m4
+check_QxGraphViewer.m4          \
+check_TestRecorder.m4
diff --git a/adm_local/unix/config_files/check_TestRecorder.m4 b/adm_local/unix/config_files/check_TestRecorder.m4
new file mode 100644 (file)
index 0000000..c98bf64
--- /dev/null
@@ -0,0 +1,101 @@
+#
+# Check existence of Test recorder sources and libraries.
+# Set DISABLE_TESTRECORDER to yes|no
+#
+# Author : Margarita KARPUNINA (OCN, 2008)
+#
+
+AC_DEFUN([CHECK_TESTRECORDER],[
+
+AC_ARG_WITH(testrecorder,
+           [  --with-testrecorder=DIR       root directory path of TestRecorder installation],
+           [],
+           [with_testrecorder=no])
+
+AS_IF([test "x$with_testrecorder" != xno || test "$with_testrecorder" != "no"],[
+
+  echo
+  echo ---------------------------------------------
+  echo Testing TestRecorder
+  echo ---------------------------------------------
+  echo
+
+  AC_REQUIRE([CHECK_QT])dnl
+  AC_REQUIRE([AC_PROG_CXX])dnl
+  AC_REQUIRE([AC_PROG_CXXCPP])dnl
+  
+  AC_CHECKING(for TestRecorder product)
+  
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  
+  TESTRECORDER_INCLUDES=""
+  TESTRECORDER_LIBS=""
+  DISABLE_TESTRECORDER="yes"
+  
+  TestRecorder_ok=no
+
+  if test "$with_testrecorder" == "yes" || test "$with_testrecorder" == "auto"; then
+      TESTRECORDER_HOME=""
+  else
+      TESTRECORDER_HOME="$with_testrecorder"
+  fi
+  
+  if test "$TESTRECORDER_HOME" == "" ; then
+      if test "x$TESTRECORDERHOME" != "x" ; then
+          TESTRECORDER_HOME=$TESTRECORDERHOME
+      fi
+  fi
+  
+  if test "x$TESTRECORDER_HOME" != "x"; then
+    TESTRECORDER_INCLUDES="-I$TESTRECORDER_HOME"
+    TESTRECORDER_LIBS="-L$TESTRECORDER_HOME/lib -lTestRecorder"
+  
+    CPPFLAGS_old="$CPPFLAGS"
+    CXXFLAGS_old="$CXXFLAGS"
+    CPPFLAGS="$TESTRECORDER_INCLUDES $QT_INLCUDES $CPPFLAGS"
+    CXXFLAGS="$TESTRECORDER_INCLUDES $QT_INCLUDES $CXXFLAGS"
+  
+    AC_MSG_CHECKING(for TestRecorder header file)
+  
+    AC_CHECK_HEADER(TestApplication.h,TestRecorder_ok=yes,TestRecorder_ok=no)
+  
+    if test "x$TestRecorder_ok" == "xyes"; then
+  
+      AC_MSG_CHECKING(for TestRecorder library)
+  
+      LDFLAGS_old="$LDFLAGS"
+      LDFLAGS="-L. -$TESTRECORDER_LIBS $QT_LIBS $LDFLAGS"
+  
+      AC_TRY_LINK(
+         #include "TestApplication.h",
+          TESTRECORDER_init();,
+         TestRecorder_ok=yes,TestRecorder_ok=no
+         )
+  
+      LDFLAGS="$LDFLAGS_old"
+  
+      AC_MSG_RESULT($TestRecorder_ok)
+    fi
+  
+    CPPFLAGS="$CPPFLAGS_old"
+    CXXFLAGS="$CXXFLAGS_old"
+  
+  fi
+  
+  if test "x$TestRecorder_ok" == xno ; then
+    AC_MSG_RESULT(for TestRecorder: no)
+    AC_MSG_WARN(TestRecorder is not found or not properly installed)
+  else
+    AC_MSG_RESULT(for TestRecorder: yes)
+    DISABLE_TESTRECORDER="no"
+  fi
+  
+  AC_SUBST(TESTRECORDER_INCLUDES)
+  AC_SUBST(TESTRECORDER_LIBS)
+  
+  AC_LANG_RESTORE
+
+  ])
+  
+])dnl
index 73ae8e16575bf1631d2d02b46a4a2d949f90f4d3..4d86c95fa7eb62a6fc881dceafcfa7346b86f4be 100644 (file)
@@ -524,7 +524,7 @@ do
 done
 
 echo "---Optional:"
-variables="cppunit_ok TESTRECORDER_ok"
+variables="cppunit_ok TestRecorder_ok"
 
 for var in $variables
 do
index 4c5ce056dbb3bb7809850b19cecbb851b49c9478..0e3d536279f050af613d6e0a2a460478c248b959 100755 (executable)
@@ -117,5 +117,17 @@ nodist_salomeres_DATA =                    \
        SUIT_msg_en.qm
 
 libsuit_la_CPPFLAGS = $(QT_INCLUDES) -I$(srcdir)/../Qtx -I$(srcdir)/../ObjBrowser
+
+if ENABLE_TESTRECORDER
+  libsuit_la_CPPFLAGS+= $(TESTRECORDER_INCLUDES)
+else !ENABLE_TESTRECORDER
+  libsuit_la_CPPFLAGS+= -DDISABLE_TESTRECORDER
+endif
+
 libsuit_la_LDFLAGS  = $(QT_MT_LIBS)
+
+if ENABLE_TESTRECORDER
+  libsuit_la_LDFLAGS+= $(TESTRECORDER_LIBS)
+endif
+
 libsuit_la_LIBADD   = ../Qtx/libqtx.la ../ObjBrowser/libObjBrowser.la
index 861fdcf2caaec3876079bde6e326c93a38826857..babe67e6990d181d21c59b3c328c95ec1a006ca5 100755 (executable)
 
 #include "SUIT_MessageBox.h"
 
+#ifndef DISABLE_TESTRECORDER
+  #include <TestApplication.h>
+#endif
+
 #include <QApplication>
 
 /*!\class SUIT_ExceptionHandler
@@ -39,7 +43,12 @@ bool SUIT_ExceptionHandler::handle( QObject* o, QEvent* e )
 */
 bool SUIT_ExceptionHandler::internalHandle( QObject* o, QEvent* e )
 {
+#ifndef DISABLE_TESTRECORDER
+  TestApplication* aTApp = qobject_cast<TestApplication*>(qApp);
+  return aTApp ? aTApp->TestApplication::notify( o, e ) : false;
+#else
   return qApp ? qApp->QApplication::notify( o, e ) : false;
+#endif
 }
 
 /*!
index 2f8448a8eee1dabb5893302b38c8e98d3449f9d1..1e1b855826573bcc6a8219960dd5e583faa73d43 100644 (file)
@@ -42,7 +42,18 @@ nodist_salomeres_DATA = SUITApp_msg_en.qm
 libSUITApp_la_CPPFLAGS = $(QT_INCLUDES) $(PYTHON_INCLUDES) \
                          -I$(srcdir)/../SUIT -I$(srcdir)/../Qtx -I$(srcdir)/../Style
 
+if ENABLE_TESTRECORDER
+  libSUITApp_la_CPPFLAGS+= $(TESTRECORDER_INCLUDES)
+else !ENABLE_TESTRECORDER
+  libSUITApp_la_CPPFLAGS+= -DDISABLE_TESTRECORDER
+endif
+
 libSUITApp_la_LDFLAGS  = $(QT_MT_LIBS) 
+
+if ENABLE_TESTRECORDER
+  libSUITApp_la_LDFLAGS+= $(TESTRECORDER_LIBS)
+endif
+
 libSUITApp_la_LIBADD   = ../Qtx/libqtx.la ../SUIT/libsuit.la ../Style/libSalomeStyle.la
 
 if ENABLE_PYCONSOLE
@@ -57,4 +68,14 @@ dist_SUITApp_SOURCES = SUITApp.cxx
 SUITApp_CPPFLAGS = $(QT_INCLUDES) $(PYTHON_INCLUDES) \
                    -I$(srcdir)/../SUIT -I$(srcdir)/../Qtx -I$(srcdir)/../Style
 
+if ENABLE_TESTRECORDER
+  SUITApp_CPPFLAGS+= $(TESTRECORDER_INCLUDES)
+else !ENABLE_TESTRECORDER
+  SUITApp_CPPFLAGS+= -DDISABLE_TESTRECORDER
+endif
+
 SUITApp_LDADD    = libSUITApp.la  ../Qtx/libqtx.la ../SUIT/libsuit.la ../Style/libSalomeStyle.la
+
+if ENABLE_TESTRECORDER
+  SUITApp_LDADD+= $(TESTRECORDER_LIBS)
+endif
index 7027184df33f2feced785b812c1a2ea1001f5692..df551d580c06c658da7df8561c2c1a5cebe6f47d 100644 (file)
   Constructor
 */
 SUITApp_Application::SUITApp_Application( int& argc, char** argv, SUIT_ExceptionHandler* hand )
-: QApplication( argc, argv ),
+#ifndef DISABLE_TESTRECORDER
+  : TestApplication( argc, argv ),
+#else
+  : QApplication( argc, argv ),
+#endif
 myExceptHandler( hand )
 {
   QString path = SUIT_Tools::dir( argv[0] ) + QDir::separator() + "../../resources";
@@ -52,7 +56,11 @@ myExceptHandler( hand )
   Constructor
 */
 SUITApp_Application::SUITApp_Application( int& argc, char** argv, Type type, SUIT_ExceptionHandler* hand )
-: QApplication( argc, argv, type ),
+#ifndef DISABLE_TESTRECORDER
+  : TestApplication( argc, argv ),
+#else
+  : QApplication( argc, argv, type ),
+#endif
 myExceptHandler( hand )
 {
     QTranslator* strTbl = new QTranslator( 0 );
@@ -69,7 +77,11 @@ myExceptHandler( hand )
 bool SUITApp_Application::notify( QObject* receiver, QEvent* e )
 {
   return myExceptHandler ? myExceptHandler->handle( receiver, e ) :
+#ifndef DISABLE_TESTRECORDER
+                           TestApplication::notify( receiver, e );
+#else
                            QApplication::notify( receiver, e );
+#endif
 }
 
 /*!
index 808e464cc11f3223f123b27d5153f5fd9cdeb009..bb27322b53841d02b8ef99720aab51da0fdaed8d 100644 (file)
 #ifndef SUITAPP_APPLICATION_H
 #define SUITAPP_APPLICATION_H
 
-#include <QApplication>
+#ifndef DISABLE_TESTRECORDER
+  #include <TestApplication.h>
+#else
+  #include <QApplication>
+#endif
 
 class SUIT_ExceptionHandler;
 
-class SUITApp_Application : public QApplication
+#ifndef DISABLE_TESTRECORDER
+  class SUITApp_Application : public TestApplication
+#else
+  class SUITApp_Application : public QApplication
+#endif
 {
   Q_OBJECT
 
index b6b196500a7dc9f4c479171b6e811c0caa5aeac1..781aedd202f326dea781678f17a3ffdf5b4e6b4e 100755 (executable)
@@ -54,12 +54,22 @@ libSalomeSession_la_CPPFLAGS = $(QT_MT_INCLUDES) $(PYTHON_INCLUDES)         \
        -I$(srcdir)/../Qtx -I$(srcdir)/../SUIT -I$(srcdir)/../Event             \
        -I$(srcdir)/../Style @LIBXML_INCLUDES@
 
+if ENABLE_TESTRECORDER
+  libSalomeSession_la_CPPFLAGS+= $(TESTRECORDER_INCLUDES)
+else !ENABLE_TESTRECORDER
+  libSalomeSession_la_CPPFLAGS+= -DDISABLE_TESTRECORDER
+endif
+
 libSalomeSession_la_LDFLAGS = $(QT_MT_LIBS) $(KERNEL_LDFLAGS) -lSalomeNS       \
        -lSalomeLifeCycleCORBA -lOpUtil -lSALOMELocalTrace -lSalomeCatalog      \
        -lSalomeDSClient $(CAS_KERNEL) -lwith_loggerTraceCollector              \
        ../SUIT/libsuit.la ../Event/libEvent.la ../../idl/libSalomeIDLGUI.la    \
        ../Style/libSalomeStyle.la
 
+if ENABLE_TESTRECORDER
+  libSalomeSession_la_LDFLAGS+= $(TESTRECORDER_LIBS)
+endif
+
 # Executable
 bin_PROGRAMS = SALOME_Session_Server
 
@@ -72,3 +82,7 @@ SALOME_Session_Server_LDADD    = $(libSalomeSession_la_LDFLAGS) $(OMNIORB_LIBS)
        -lSalomeNotification -lSALOMEBasics -lSalomeLauncher ../Qtx/libqtx.la   \
        $(top_builddir)/idl/libSalomeIDLGUI.la                                  \
        libSalomeSession.la
+
+if ENABLE_TESTRECORDER
+  SALOME_Session_Server_LDADD+= $(TESTRECORDER_LIBS)
+endif
index 9ddfbd8f819390b60426fd4e2875adf70ded87a3..18365ce9f1b158e9b31c9241abd6e15a3b7463f6 100755 (executable)
 #include <ConnectionManager_i.hxx>
 #include <SALOME_LifeCycleCORBA.hxx>
 
+#ifndef DISABLE_TESTRECORDER
+  #include <TestApplication.h>
+#endif
+
 #include <QDir>
 #include <QFile>
 #include <QApplication>
@@ -245,10 +249,18 @@ protected:
   }
 };
 
-class SALOME_QApplication : public QApplication
+#ifndef DISABLE_TESTRECORDER
+  class SALOME_QApplication : public TestApplication
+#else
+  class SALOME_QApplication : public QApplication
+#endif
 {
 public:
+#ifndef DISABLE_TESTRECORDER
+  SALOME_QApplication( int& argc, char** argv ) : TestApplication( argc, argv ), myHandler ( 0 ) {}
+#else
   SALOME_QApplication( int& argc, char** argv ) : QApplication( argc, argv ), myHandler ( 0 ) {}
+#endif
 
   virtual bool notify( QObject* receiver, QEvent* e )
   {
@@ -266,8 +278,13 @@ public:
     }
 #endif
 
+#ifndef DISABLE_TESTRECORDER
+    return myHandler ? myHandler->handle( receiver, e ) :
+      TestApplication::notify( receiver, e );
+#else
     return myHandler ? myHandler->handle( receiver, e ) :
       QApplication::notify( receiver, e );
+#endif
   }
   SUIT_ExceptionHandler* handler() const { return myHandler; }
   void setHandler( SUIT_ExceptionHandler* h ) { myHandler = h; }