ctkCmdLineModuleSignalTester.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) German Cancer Research Center,
  4. Division of Medical and Biological Informatics
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. =============================================================================*/
  15. #ifndef CTKCMDLINEMODULESIGNALTESTER_H
  16. #define CTKCMDLINEMODULESIGNALTESTER_H
  17. #include "ctkCmdLineModuleFutureWatcher.h"
  18. #include <QObject>
  19. #include <QList>
  20. class ctkCmdLineModuleFuture;
  21. class ctkCmdLineModuleSignalTester : public QObject
  22. {
  23. Q_OBJECT
  24. public:
  25. ctkCmdLineModuleSignalTester();
  26. void setFuture(const ctkCmdLineModuleFuture& future);
  27. ctkCmdLineModuleFutureWatcher* watcher();
  28. bool checkSignals(const QList<QString>& expectedSignals);
  29. void dumpSignals(const QList<QString>& expectedSignals);
  30. QList<ctkCmdLineModuleResult> results() const;
  31. public Q_SLOTS:
  32. virtual void moduleStarted();
  33. virtual void moduleFinished();
  34. virtual void moduleProgressValueChanged(int progress);
  35. virtual void moduleProgressTextChanged(const QString& text);
  36. virtual void modulePaused();
  37. virtual void moduleResumed();
  38. virtual void moduleCanceled();
  39. virtual void resultReadyAt(int resultIndex);
  40. virtual void resultReadyAt(int beginIndex, int endIndex);
  41. virtual void progressRangeChanged(int minimum, int maximum);
  42. virtual void progressValueChanged(int progressValue);
  43. virtual void progressTextChanged(const QString &progressText);
  44. virtual void outputDataReady();
  45. virtual void errorDataReady();
  46. private:
  47. ctkCmdLineModuleFutureWatcher Watcher;
  48. QList<QString> Events;
  49. QList<ctkCmdLineModuleResult> Results;
  50. };
  51. #endif // CTKCMDLINEMODULESIGNALTESTER_H