Browse Source

Merge pull request #687 from finetjul/increment-qttesting

Increment QtTesting version
Jean-Christophe Fillion-Robin 8 years ago
parent
commit
25f90c4e60

+ 1 - 1
CMakeExternals/QtTesting.cmake

@@ -24,7 +24,7 @@ endif()
 
 if(NOT DEFINED QtTesting_DIR)
 
-  set(revision_tag a5c52c52516d419802ee1e4b1800ee3aabc5cdd2)
+  set(revision_tag 9951bc69b007812dd5172218dd219a4e98e0fcf8)
   if(${proj}_REVISION_TAG)
     set(revision_tag ${${proj}_REVISION_TAG})
   endif()

+ 4 - 2
Libs/QtTesting/ctkXMLEventObserver.cpp

@@ -142,8 +142,9 @@ void ctkXMLEventObserver::setStream(QTextStream* stream)
 
 //-----------------------------------------------------------------------------
 void ctkXMLEventObserver::onRecordEvent(const QString& widget,
-                                     const QString& command,
-                                     const QString& arguments)
+                                        const QString& command,
+                                        const QString& arguments,
+                                        const int& eventType)
 {
   if(this->XMLStream)
     {
@@ -151,6 +152,7 @@ void ctkXMLEventObserver::onRecordEvent(const QString& widget,
     this->XMLStream->writeAttribute("widget", widget);
     this->XMLStream->writeAttribute("command", command);
     this->XMLStream->writeAttribute("arguments", arguments);
+    this->XMLStream->writeAttribute("eventType", QString::number(eventType));
     this->XMLStream->writeEndElement();
     if (this->Stream)
       {

+ 3 - 1
Libs/QtTesting/ctkXMLEventObserver.h

@@ -50,9 +50,11 @@ public:
   ~ctkXMLEventObserver();
 
   virtual void setStream(QTextStream* stream);
+
   virtual void onRecordEvent(const QString& widget,
                              const QString& command,
-                             const QString& arguments);
+                             const QString& arguments,
+                             const int& eventType);
 
   void recordApplicationSettings();
   void recordApplicationSetting(const QString& startElement,

+ 11 - 6
Libs/QtTesting/ctkXMLEventSource.cpp

@@ -25,8 +25,8 @@
 #include <QFile>
 #include <QMap>
 #include <QMessageBox>
-#include <QXmlSchema>
-#include <QXmlSchemaValidator>
+#include <QtXmlPatterns/QXmlSchema>
+#include <QtXmlPatterns/QXmlSchemaValidator>
 #include <QVariant>
 
 // CTKQtTesting includes
@@ -110,7 +110,8 @@ void ctkXMLEventSource::setContent(const QString& xmlfilename)
 }
 
 //-----------------------------------------------------------------------------
-int ctkXMLEventSource::getNextEvent(QString& widget, QString& command, QString&arguments)
+int ctkXMLEventSource::getNextEvent(QString& widget, QString& command,
+  QString& arguments, int& eventType)
 {
   if (!this->XMLStream)
     {
@@ -135,9 +136,13 @@ int ctkXMLEventSource::getNextEvent(QString& widget, QString& command, QString&a
     {
     return DONE;
     }
-  widget = this->XMLStream->attributes().value("widget").toString();
-  command = this->XMLStream->attributes().value("command").toString();
-  arguments = this->XMLStream->attributes().value("arguments").toString();
+  const QXmlStreamAttributes attributes = this->XMLStream->attributes();
+  widget = attributes.value("widget").toString();
+  command = attributes.value("command").toString();
+  arguments = attributes.value("arguments").toString();
+  eventType = attributes.hasAttribute("eventType") ?
+    this->XMLStream->attributes().value("eventType").toInt() :
+    pqEventTypes::ACTION_EVENT;
   return SUCCESS;
 }
 

+ 1 - 1
Libs/QtTesting/ctkXMLEventSource.h

@@ -48,7 +48,7 @@ public:
   ~ctkXMLEventSource();
 
   virtual void setContent(const QString& xmlfilename);
-  int getNextEvent(QString& widget, QString& command, QString&arguments);
+  int getNextEvent(QString& widget, QString& command, QString&arguments, int& eventType);
 
   void setRestoreSettingsAuto(bool value);
   bool restoreSettingsAuto() const;

+ 5 - 5
Libs/Visualization/VTK/Widgets/Testing/Cpp/CMakeLists.txt

@@ -95,9 +95,6 @@ REMOVE (TestsToRun ${KIT}CppTests.cpp)
 
 set(LIBRARY_NAME ${PROJECT_NAME})
 
-#
-# If CTK_USE_QTTESTING is ON
-#
 if(CTK_USE_QTTESTING)
   include(${CMAKE_SOURCE_DIR}/Libs/QtTesting/CMake/ctkQtTesting.cmake)
   ctkQtTesting(Tests TEST_MOC_SOURCES TEST_UI_FORMS Tests_RESOURCES)
@@ -139,10 +136,13 @@ endif()
 
 
 
-target_link_libraries(${KIT}CppTests ${LIBRARY_NAME} ${VTK_CHARTS_LIB} ${CTK_BASE_LIBRARIES})
+target_link_libraries(${KIT}CppTests ${LIBRARY_NAME} ${VTK_CHARTS_LIB} ${CTK_BASE_LIBRARIES} CTKQtTesting)
 
 if(CTK_QT_VERSION VERSION_GREATER "4")
-    target_link_libraries(${KIT}CppTests ${Qt5Test_LIBRARIES})
+  target_link_libraries(${KIT}CppTests ${Qt5Test_LIBRARIES})
+endif()
+if(CTK_USE_QTTESTING)
+  target_link_libraries(${KIT}CppTests CTKQtTesting)
 endif()
 
 #