Просмотр исходного кода

Merge pull request #554 from finetjul/add-qttesting-qt5-support

Add qttesting qt5 support
Jean-Christophe Fillion-Robin лет назад: 10
Родитель
Сommit
58aac55ce7
40 измененных файлов с 109 добавлено и 85 удалено
  1. 13 2
      CMakeExternals/QtTesting.cmake
  2. 4 0
      Libs/QtTesting/CMakeLists.txt
  3. 5 1
      Libs/Widgets/Testing/Cpp/CMakeLists.txt
  4. 1 1
      Libs/Widgets/Testing/Cpp/ctkActionsWidgetEventTranslatorPlayerTest1.cpp
  5. 1 1
      Libs/Widgets/Testing/Cpp/ctkAddRemoveComboBoxEventTranslatorPlayerTest1.cpp
  6. 1 1
      Libs/Widgets/Testing/Cpp/ctkAxesWidgetEventTranslatorPlayerTest1.cpp
  7. 1 1
      Libs/Widgets/Testing/Cpp/ctkButtonGroupEventTranslatorPlayerTest1.cpp
  8. 1 1
      Libs/Widgets/Testing/Cpp/ctkCheckableComboBoxEventTranslatorPlayerTest1.cpp
  9. 10 2
      Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewEventTranslatorPlayerTest1.cpp
  10. 1 1
      Libs/Widgets/Testing/Cpp/ctkCheckablePushButtonEventTranslatorPlayerTest1.cpp
  11. 1 1
      Libs/Widgets/Testing/Cpp/ctkCollapsibleButtonEventTranslatorPlayerTest1.cpp
  12. 1 1
      Libs/Widgets/Testing/Cpp/ctkCollapsibleGroupBoxEventTranslatorPlayerTest1.cpp
  13. 3 3
      Libs/Widgets/Testing/Cpp/ctkColorDialogEventTranslatorPlayerTest1.cpp
  14. 1 1
      Libs/Widgets/Testing/Cpp/ctkColorPickerButtonEventTranslatorPlayerTest1.cpp
  15. 1 1
      Libs/Widgets/Testing/Cpp/ctkComboBoxEventTranslatorPlayerTest1.cpp
  16. 1 1
      Libs/Widgets/Testing/Cpp/ctkConsoleEventTranslatorPlayerTest1.cpp
  17. 1 1
      Libs/Widgets/Testing/Cpp/ctkCoordinatesWidgetEventTranslatorPlayerTest1.cpp
  18. 1 1
      Libs/Widgets/Testing/Cpp/ctkDirectoryButtonEventTranslatorPlayerTest1.cpp
  19. 1 1
      Libs/Widgets/Testing/Cpp/ctkDoubleRangeSliderEventTranslatorPlayerTest1.cpp
  20. 1 1
      Libs/Widgets/Testing/Cpp/ctkDoubleSliderEventTranslatorPlayerTest1.cpp
  21. 1 1
      Libs/Widgets/Testing/Cpp/ctkExpandButtonEventTranslatorPlayerTest1.cpp
  22. 14 23
      Libs/Widgets/Testing/Cpp/ctkFileDialogEventTranslatorPlayerTest1.cpp
  23. 1 1
      Libs/Widgets/Testing/Cpp/ctkFileDialogEventTranslatorPlayerTest1.xml
  24. 1 1
      Libs/Widgets/Testing/Cpp/ctkFileDialogEventTranslatorPlayerTest2.xml
  25. 1 1
      Libs/Widgets/Testing/Cpp/ctkFontButtonEventTranslatorPlayerTest1.cpp
  26. 1 1
      Libs/Widgets/Testing/Cpp/ctkMaterialPropertyWidgetEventTranslatorPlayerTest1.cpp
  27. 1 1
      Libs/Widgets/Testing/Cpp/ctkMatrixWidgetEventTranslatorPlayerTest1.cpp
  28. 1 1
      Libs/Widgets/Testing/Cpp/ctkMenuButtonEventTranslatorPlayerTest1.cpp
  29. 1 1
      Libs/Widgets/Testing/Cpp/ctkMenuComboBoxEventTranslatorPlayerTest1.cpp
  30. 1 1
      Libs/Widgets/Testing/Cpp/ctkMenuEventTranslatorPlayerTest1.cpp
  31. 1 1
      Libs/Widgets/Testing/Cpp/ctkModalityWidgetEventTranslatorPlayerTest1.cpp
  32. 1 1
      Libs/Widgets/Testing/Cpp/ctkPathLineEditEventTranslatorPlayerTest1.cpp
  33. 1 1
      Libs/Widgets/Testing/Cpp/ctkPopupWidgetEventTranslatorPlayerTest1.cpp
  34. 1 1
      Libs/Widgets/Testing/Cpp/ctkRangeSliderEventTranslatorPlayerTest1.cpp
  35. 1 1
      Libs/Widgets/Testing/Cpp/ctkRangeWidgetEventTranslatorPlayerTest1.cpp
  36. 1 1
      Libs/Widgets/Testing/Cpp/ctkSearchBoxEventTranslatorPlayerTest1.cpp
  37. 1 1
      Libs/Widgets/Testing/Cpp/ctkSettingsDialogEventTranslatorPlayerTest1.cpp
  38. 1 1
      Libs/Widgets/Testing/Cpp/ctkSliderWidgetEventTranslatorPlayerTest1.cpp
  39. 1 1
      Libs/Widgets/Testing/Cpp/ctkTreeComboBoxEventTranslatorPlayerTest1.cpp
  40. 27 21
      Libs/Widgets/ctkFileDialogEventPlayer.cpp

+ 13 - 2
CMakeExternals/QtTesting.cmake

@@ -24,7 +24,7 @@ endif()
 
 if(NOT DEFINED QtTesting_DIR)
 
-  set(revision_tag 7dbef1003157941e7315220f53cf4e17d78b5e28)
+  set(revision_tag a5c52c52516d419802ee1e4b1800ee3aabc5cdd2)
   if(${proj}_REVISION_TAG)
     set(revision_tag ${${proj}_REVISION_TAG})
   endif()
@@ -49,6 +49,17 @@ if(NOT DEFINED QtTesting_DIR)
       -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET})
   endif()
 
+  set(proj_qt_args
+	  -DQtTesting_QT_VERSION:STRING=${CTK_QT_VERSION})
+  if(CTK_QT_VERSION VERSION_LESS "5")
+    list(APPEND proj_qt_args
+      -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
+    )
+  else()
+    list(APPEND proj_qt_args
+      -DCMAKE_PREFIX_PATH:FILEPATH=${CMAKE_PREFIX_PATH}
+    )
+  endif()
   message(STATUS "Adding project:${proj}")
   ExternalProject_Add(${proj}
     ${${proj}_EXTERNAL_PROJECT_ARGS}
@@ -58,8 +69,8 @@ if(NOT DEFINED QtTesting_DIR)
     ${location_args}
     CMAKE_CACHE_ARGS
       ${ep_common_cache_args}
+	  ${proj_qt_args}
       -DBUILD_SHARED_LIBS:BOOL=ON
-      -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
     DEPENDS
       ${${proj}_DEPENDENCIES}
     )

+ 4 - 0
Libs/QtTesting/CMakeLists.txt

@@ -150,6 +150,10 @@ set(QtTesting_LIBRARIES QtTesting)
 # The following macro will read the target libraries from the file 'target_libraries.cmake'
 ctkFunctionGetTargetLibraries(KIT_target_libraries)
 
+if(CTK_QT_VERSION VERSION_GREATER "4")
+  list(APPEND KIT_target_libraries Qt5::Xml Qt5::XmlPatterns)
+endif()
+
 ctkMacroBuildLib(
   NAME ${PROJECT_NAME}
   EXPORT_DIRECTIVE ${KIT_export_directive}

+ 5 - 1
Libs/Widgets/Testing/Cpp/CMakeLists.txt

@@ -250,7 +250,11 @@ add_executable(${KIT}CppTests ${Tests} ${Tests_SRCS} ${Tests_MOC_CPP} ${Tests_UI
 target_link_libraries(${KIT}CppTests ${LIBRARY_NAME})
 
 if(CTK_QT_VERSION VERSION_GREATER "4")
-  target_link_libraries(${KIT}CppTests Qt5::Test)
+  list(APPEND KIT_target_libraries Qt5::Test)
+  if(CTK_USE_QTTESTING)
+    list(APPEND KIT_target_libraries Qt5::Xml Qt5::XmlPatterns)
+  endif()
+  target_link_libraries(${KIT}CppTests ${KIT_target_libraries})
 endif()
 
 #

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkActionsWidgetEventTranslatorPlayerTest1.cpp

@@ -77,7 +77,7 @@ int ctkActionsWidgetEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkAddRemoveComboBoxEventTranslatorPlayerTest1.cpp

@@ -70,7 +70,7 @@ int ctkAddRemoveComboBoxEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkAxesWidgetEventTranslatorPlayerTest1.cpp

@@ -84,7 +84,7 @@ int ctkAxesWidgetEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState2);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkButtonGroupEventTranslatorPlayerTest1.cpp

@@ -116,7 +116,7 @@ int ctkButtonGroupEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkCheckableComboBoxEventTranslatorPlayerTest1.cpp

@@ -116,7 +116,7 @@ int ctkCheckableComboBoxEventTranslatorPlayerTest1(int argc, char * argv [])
                         &checkFinalWidgetState2);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 10 - 2
Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewEventTranslatorPlayerTest1.cpp

@@ -106,12 +106,20 @@ int ctkCheckableHeaderViewEventTranslatorPlayerTest1(int argc, char * argv [] )
   model.setHeaderData(0, Qt::Horizontal, Qt::Checked, Qt::CheckStateRole);
 
   QHeaderView* previousHeaderView = table.horizontalHeader();
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
   bool oldClickable = previousHeaderView->isClickable();
-
+#else
+  bool oldClickable = previousHeaderView->sectionsClickable();
+#endif
   ctkCheckableHeaderView* headerView =
     new ctkCheckableHeaderView(Qt::Horizontal, &table);
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
   headerView->setClickable(oldClickable);
   headerView->setMovable(previousHeaderView->isMovable());
+#else
+  headerView->setSectionsClickable(oldClickable);
+  headerView->setSectionsMovable(previousHeaderView->sectionsMovable());
+#endif
   headerView->setHighlightSections(previousHeaderView->highlightSections());
   // propagatetoitems is true by default
   //headerView->setPropagateToItems(true);
@@ -131,7 +139,7 @@ int ctkCheckableHeaderViewEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkCheckablePushButtonEventTranslatorPlayerTest1.cpp

@@ -136,7 +136,7 @@ int ctkCheckablePushButtonEventTranslatorPlayerTest1(int argc, char * argv [])
                         &checkFinalWidgetState3);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkCollapsibleButtonEventTranslatorPlayerTest1.cpp

@@ -92,7 +92,7 @@ int ctkCollapsibleButtonEventTranslatorPlayerTest1(int argc, char * argv [])
                         &checkFinalWidgetState);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkCollapsibleGroupBoxEventTranslatorPlayerTest1.cpp

@@ -120,7 +120,7 @@ int ctkCollapsibleGroupBoxEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 3 - 3
Libs/Widgets/Testing/Cpp/ctkColorDialogEventTranslatorPlayerTest1.cpp

@@ -46,8 +46,8 @@ void checkFinalWidgetState(void* data)
   {
   ctkColorDialog* widget = reinterpret_cast<ctkColorDialog*>(data);
 
-  CTKCOMPARE(QColor::fromRgb(widget->customColor(0)), QColor::fromRgb(0,255,127));
-  CTKCOMPARE(QColor::fromRgb(widget->customColor(2)), QColor::fromRgb(255,255,255));
+  CTKCOMPARE(widget->customColor(0), QColor::fromRgb(0,255,127));
+  CTKCOMPARE(widget->customColor(2), QColor::fromRgb(255,255,255));
   CTKCOMPARE(widget->selectedColor(), QColor(128, 255, 60));
   }
 }
@@ -71,7 +71,7 @@ int ctkColorDialogEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkColorPickerButtonEventTranslatorPlayerTest1.cpp

@@ -129,7 +129,7 @@ int ctkColorPickerButtonEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState3);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkComboBoxEventTranslatorPlayerTest1.cpp

@@ -75,7 +75,7 @@ int ctkComboBoxEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkConsoleEventTranslatorPlayerTest1.cpp

@@ -72,7 +72,7 @@ int ctkConsoleEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkCoordinatesWidgetEventTranslatorPlayerTest1.cpp

@@ -71,7 +71,7 @@ int ctkCoordinatesWidgetEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkDirectoryButtonEventTranslatorPlayerTest1.cpp

@@ -69,7 +69,7 @@ int ctkDirectoryButtonEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkDoubleRangeSliderEventTranslatorPlayerTest1.cpp

@@ -107,7 +107,7 @@ int ctkDoubleRangeSliderEventTranslatorPlayerTest1(int argc, char * argv [])
                         &checkFinalWidgetState3);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkDoubleSliderEventTranslatorPlayerTest1.cpp

@@ -89,7 +89,7 @@ int ctkDoubleSliderEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState3);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkExpandButtonEventTranslatorPlayerTest1.cpp

@@ -122,7 +122,7 @@ int ctkExpandButtonEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 14 - 23
Libs/Widgets/Testing/Cpp/ctkFileDialogEventTranslatorPlayerTest1.cpp

@@ -47,31 +47,21 @@ namespace
 {
 //-----------------------------------------------------------------------------
 void checkFinalWidgetState(void* data)
-  {
+{
   ctkFileDialog* widget = reinterpret_cast<ctkFileDialog*>(data);
-  QStringList listActual =  widget->selectedFiles();
-  QStringList listExpected;
-  listExpected << "/home/benjaminlong/Documents/ctk-QtTesting-renderView/ctkVTKRenderViewEventTranslatorPlayerTest1Screenshot.png";
-  listExpected << "/home/benjaminlong/Documents/ctk-QtTesting-renderView/ctkVTKRenderViewEventTranslatorPlayerTest1ScreenshotTest.png";
+  QStringList expectedSelectedFiles;
+  expectedSelectedFiles << CTK_SOURCE_DIR"/ctkLogo.png";
+  expectedSelectedFiles << CTK_SOURCE_DIR"/ctkLogo-small.png";
+
+  CTKCOMPARE(widget->selectedFiles(), expectedSelectedFiles);
+}
 
-  if( listActual.count() == listExpected.count())
-    {
-    for(int i = 0 ; i < listActual.count() ; i++)
-      {
-      CTKCOMPARE(listExpected[i], listActual[i]);
-      }
-    }
-  else
-    {
-    QApplication::exit(EXIT_FAILURE);
-    }
-  }
 //-----------------------------------------------------------------------------
 void checkFinalWidgetState2(void* data)
-  {
+{
   ctkFileDialog* widget = reinterpret_cast<ctkFileDialog*>(data);
   QStringList actual =  widget->selectedFiles();
-  QString expected = "/home/benjaminlong/GroupBox.png";
+  QString expected = CTK_SOURCE_DIR"/ctkLogo.png";
 
   if( actual.count() == 1)
     {
@@ -81,13 +71,13 @@ void checkFinalWidgetState2(void* data)
     {
     QApplication::exit(EXIT_FAILURE);
     }
-  }
+}
 //-----------------------------------------------------------------------------
 void checkFinalWidgetState3(void* data)
-  {
+{
   ctkFileDialog* widget = reinterpret_cast<ctkFileDialog*>(data);
   CTKCOMPARE(widget->isHidden(), true);
-  }
+}
 }
 
 //-----------------------------------------------------------------------------
@@ -100,6 +90,7 @@ int ctkFileDialogEventTranslatorPlayerTest1(int argc, char * argv [] )
   // ------------------------
   ctkEventTranslatorPlayerWidget etpWidget;
   pqTestUtility* testUtility = new pqTestUtility(&etpWidget);
+  testUtility->addDataDirectory("CTK_SOURCE_DIR", QDir(CTK_SOURCE_DIR));
   etpWidget.setTestUtility(testUtility);
   etpWidget.addWidgetEventPlayer(new ctkFileDialogEventPlayer(etpWidget.testUtility()));
   etpWidget.addWidgetEventTranslator(new ctkFileDialogEventTranslator(etpWidget.testUtility()));
@@ -148,7 +139,7 @@ int ctkFileDialogEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState3);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkFileDialogEventTranslatorPlayerTest1.xml

@@ -12,6 +12,6 @@
         <event widget="fileDialog1/checkBox1" command="set_boolean" arguments="true"/>
         <event widget="fileDialog1/checkBox1" command="set_boolean" arguments="false"/>
         <event widget="fileDialog1/checkBox1" command="set_boolean" arguments="true"/>
-        <event widget="fileDialog1" command="newFile" arguments="/home/benjaminlong/Documents/ctk-QtTesting-renderView/ctkVTKRenderViewEventTranslatorPlayerTest1Screenshot.png#/home/benjaminlong/Documents/ctk-QtTesting-renderView/ctkVTKRenderViewEventTranslatorPlayerTest1ScreenshotTest.png"/>
+        <event widget="fileDialog1" command="newFile" arguments="${CTK_SOURCE_DIR}/ctkLogo.png#${CTK_SOURCE_DIR}/ctkLogo-small.png"/>
     </events>
 </QtTesting>

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkFileDialogEventTranslatorPlayerTest2.xml

@@ -14,6 +14,6 @@
         <event widget="fileDialog2/checkBox2" command="set_boolean" arguments="true"/>
         <event widget="fileDialog2/checkBox2" command="set_boolean" arguments="false"/>
         <event widget="fileDialog2/checkBox2" command="set_boolean" arguments="true"/>
-        <event widget="fileDialog2" command="newFile" arguments="/home/benjaminlong/GroupBox.png"/>
+        <event widget="fileDialog2" command="newFile" arguments="${CTK_SOURCE_DIR}/ctkLogo.png"/>
     </events>
 </QtTesting>

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkFontButtonEventTranslatorPlayerTest1.cpp

@@ -94,7 +94,7 @@ int ctkFontButtonEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState2);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkMaterialPropertyWidgetEventTranslatorPlayerTest1.cpp

@@ -92,7 +92,7 @@ int ctkMaterialPropertyWidgetEventTranslatorPlayerTest1(int argc, char * argv []
                         &checkFinalWidgetState2);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkMatrixWidgetEventTranslatorPlayerTest1.cpp

@@ -76,7 +76,7 @@ int ctkMatrixWidgetEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkMenuButtonEventTranslatorPlayerTest1.cpp

@@ -99,7 +99,7 @@ int ctkMenuButtonEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkMenuComboBoxEventTranslatorPlayerTest1.cpp

@@ -165,7 +165,7 @@ int ctkMenuComboBoxEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState2);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkMenuEventTranslatorPlayerTest1.cpp

@@ -155,7 +155,7 @@ int ctkMenuEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkModalityWidgetEventTranslatorPlayerTest1.cpp

@@ -71,7 +71,7 @@ int ctkModalityWidgetEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkPathLineEditEventTranslatorPlayerTest1.cpp

@@ -93,7 +93,7 @@ int ctkPathLineEditEventTranslatorPlayerTest1(int argc, char * argv [] )
                         xmlDirectory + "ctkPathLineEditEventTranslatorPlayerTest2.xml",
                         &checkFinalWidgetState2);
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkPopupWidgetEventTranslatorPlayerTest1.cpp

@@ -118,7 +118,7 @@ int ctkPopupWidgetEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkRangeSliderEventTranslatorPlayerTest1.cpp

@@ -92,7 +92,7 @@ int ctkRangeSliderEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState2);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkRangeWidgetEventTranslatorPlayerTest1.cpp

@@ -91,7 +91,7 @@ int ctkRangeWidgetEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState2);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkSearchBoxEventTranslatorPlayerTest1.cpp

@@ -79,7 +79,7 @@ int ctkSearchBoxEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkSettingsDialogEventTranslatorPlayerTest1.cpp

@@ -92,7 +92,7 @@ int ctkSettingsDialogEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkSliderWidgetEventTranslatorPlayerTest1.cpp

@@ -70,7 +70,7 @@ int ctkSliderWidgetEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkTreeComboBoxEventTranslatorPlayerTest1.cpp

@@ -130,7 +130,7 @@ int ctkTreeComboBoxEventTranslatorPlayerTest1(int argc, char * argv [] )
                         &checkFinalWidgetState2);
 
   // ------------------------
-  if (!app.arguments().contains("-I"))
+  if (argc < 2 || QString(argv[1]) != "-I")
     {
     QTimer::singleShot(0, &etpWidget, SLOT(play()));
     }

+ 27 - 21
Libs/Widgets/ctkFileDialogEventPlayer.cpp

@@ -28,6 +28,9 @@
 #include "ctkFileDialog.h"
 #include "ctkFileDialogEventPlayer.h"
 
+// QtTesting includes
+#include <pqTestUtility.h>
+
 // ----------------------------------------------------------------------------
 ctkFileDialogEventPlayer::ctkFileDialogEventPlayer(pqTestUtility* util, QObject *parent)
   : pqNativeFileDialogEventPlayer(util, parent)
@@ -36,39 +39,42 @@ ctkFileDialogEventPlayer::ctkFileDialogEventPlayer(pqTestUtility* util, QObject
 }
 
 // ----------------------------------------------------------------------------
-bool ctkFileDialogEventPlayer::playEvent(QObject *Object,
-                                                const QString &Command,
-                                                const QString &Arguments,
-                                                bool &Error)
+bool ctkFileDialogEventPlayer::playEvent(QObject *object,
+                                         const QString &command,
+                                         const QString &arguments,
+                                         bool &error)
 {
-  if (Command == "FileOpen" || Command == "DirOpen" ||
-      Command == "FileSave" || Command == "FilesOpen")
+  if (command == "FileOpen" || command == "DirOpen" ||
+      command == "FileSave" || command == "FilesOpen")
     {
-    return this->Superclass::playEvent(Object, Command, Arguments, Error);
+    return this->Superclass::playEvent(object, command, arguments, error);
     }
 
-  if (Command != "newFile" &&
-      Command != "rejected" &&
-      Command != "fileSave")
+  if (command != "newFile" &&
+      command != "rejected" &&
+      command != "fileSave")
     {
     return false;
     }
 
-  if(ctkFileDialog* const object =
-       qobject_cast<ctkFileDialog*>(Object))
+  if(ctkFileDialog* const fileDialog = qobject_cast<ctkFileDialog*>(object))
     {
-    if (Command == "newFile")
+    if (command == "newFile")
       {
       // set the directory
-      QStringList files = Arguments.split("#");
+      QStringList files;
+	  foreach(const QString& file, arguments.split("#"))
+	  {
+        files.append(mUtil->convertFromDataDirectory(file));
+	  }
       QFileInfo infoFile(files.at(0));
       if(!infoFile.exists())
         {
-        qWarning() << "The File doesn't exist, or wasn't finded.";
+        qWarning() << "File does not exist or can't be found.";
         return false;
         }
-      object->setDirectory(infoFile.absoluteDir().absolutePath());
-      if(object->directory() != infoFile.absoluteDir())
+	  fileDialog->setDirectory(infoFile.absoluteDir().absolutePath());
+	  if (fileDialog->directory() != infoFile.absoluteDir())
         {
         qWarning() << "The Directory wasn't selected.";
         }
@@ -108,15 +114,15 @@ bool ctkFileDialogEventPlayer::playEvent(QObject *Object,
         }
       return true;
       }
-    if (Command == "rejected")
+    if (command == "rejected")
       {
-      object->close();
+      fileDialog->close();
       return true;
       }
     }
 
-  qCritical() << "calling newFile/rejected on unhandled type " << Object;
-  Error = true;
+  qCritical() << "calling newFile/rejected on unhandled type " << object;
+  error = true;
   return true;
 }