TestSchedule.qml 724 B

123456789101112131415161718192021222324252627282930
  1. // Copyright (C) 2022 The Qt Company Ltd.
  2. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
  3. // Qt-Security score:significant reason:default
  4. pragma Singleton
  5. import QtQml
  6. Timer {
  7. property list<QtObject> testCases
  8. property QtObject currentTest: null
  9. running: testCases.length > 0 && !currentTest
  10. interval: 1
  11. repeat: true
  12. onTriggered: {
  13. if (currentTest) {
  14. console.error("Interleaved test execution detected. This shouldn't happen")
  15. return;
  16. }
  17. try {
  18. currentTest = testCases.shift()
  19. currentTest.qtest_run()
  20. } finally {
  21. currentTest = null
  22. }
  23. }
  24. }