ctkDynamicSpacerEventTranslatorPlayerTest1.cpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0.txt
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. // Qt includes
  15. #include <QAction>
  16. #include <QApplication>
  17. #include <QDebug>
  18. #include <QStandardItemModel>
  19. #include <QTimer>
  20. #include <QTreeView>
  21. // CTK includes
  22. #include "ctkCallback.h"
  23. #include "ctkConfig.h"
  24. #include "ctkDynamicSpacer.h"
  25. #include "ctkEventTranslatorPlayerWidget.h"
  26. // QtTesting includes
  27. #include "pqTestUtility.h"
  28. // STD includes
  29. #include <cstdlib>
  30. #include <iostream>
  31. namespace
  32. {
  33. //-----------------------------------------------------------------------------
  34. void checkFinalWidgetState(void* data)
  35. {
  36. ctkDynamicSpacer* widget = reinterpret_cast<ctkDynamicSpacer*>(data);
  37. Q_UNUSED(widget);
  38. }
  39. }
  40. //-----------------------------------------------------------------------------
  41. int ctkDirectoryButtonEventTranslatorPlayerTest1(int argc, char * argv [] )
  42. {
  43. QApplication app(argc, argv);
  44. QString xmlDirectory = CTK_SOURCE_DIR "/Libs/Widgets/Testing/Cpp/";
  45. // ------------------------
  46. ctkEventTranslatorPlayerWidget etpWidget;
  47. pqTestUtility* testUtility = new pqTestUtility(&etpWidget);
  48. etpWidget.setTestUtility(testUtility);
  49. // Test case 1
  50. ctkDynamicSpacer* widget = new ctkDynamicSpacer();
  51. etpWidget.addTestCase(widget,
  52. xmlDirectory + "ctkDirectoryButtonEventTranslatorPlayerTest1.xml",
  53. &checkFinalWidgetState);
  54. // ------------------------
  55. if (!app.arguments().contains("-I"))
  56. {
  57. QTimer::singleShot(0, &etpWidget, SLOT(play()));
  58. }
  59. etpWidget.show();
  60. return app.exec();
  61. }