summaryrefslogtreecommitdiff
path: root/WavDecodeTestController.hpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-10-09 14:12:35 +0200
committerChristoph Berg <myon@debian.org>2026-10-09 14:12:35 +0200
commitffc62c792c9a5196cb4ce7a353287dfe20db6524 (patch)
tree1269efa852935b183daae4bb33a58d1b4d2ffb53 /WavDecodeTestController.hpp
parent059831534c7e884f0a607ed86b582fd00d821731 (diff)
New upstream version 3.3.0~beta1+dfsgupstream/3.3.0_beta1+dfsg
Diffstat (limited to 'WavDecodeTestController.hpp')
-rw-r--r--WavDecodeTestController.hpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/WavDecodeTestController.hpp b/WavDecodeTestController.hpp
new file mode 100644
index 00000000..39336a59
--- /dev/null
+++ b/WavDecodeTestController.hpp
@@ -0,0 +1,53 @@
+#ifndef WAV_DECODE_TEST_CONTROLLER_HPP__
+#define WAV_DECODE_TEST_CONTROLLER_HPP__
+
+#include <QObject>
+#include <QString>
+#include <QTemporaryDir>
+#include <QTimer>
+
+class MainWindow;
+
+class WavDecodeTestController final : public QObject
+{
+public:
+ enum class Mode {Jt9, Jt65, Q65, Fst4, Fst4w};
+
+ WavDecodeTestController (MainWindow * window, QString wavPath,
+ QString expectedMessage, Mode mode, QObject * parent = nullptr);
+ void begin ();
+ bool succeeded () const {return m_succeeded;}
+
+private:
+ void prepareWhenReady ();
+ enum class Stage {ShortFirst, Initial, Repeat, ShortBeforeMonitoring, ShortReplacement, ShortRepeat};
+ bool expectsMessage () const {return m_stage == Stage::Initial || m_stage == Stage::Repeat;}
+ void loadShortWav ();
+ void decodeShortWavWhenReady ();
+ bool rejectsLiveRepeat ();
+ void completeCycle (quint64 generation);
+ void finish (QString const& error = {});
+
+ MainWindow * m_window;
+ Mode m_mode;
+ int m_period;
+ QString m_modeName;
+ QString m_wavPath;
+ QString m_expectedMessage;
+ QTemporaryDir m_fixtureDirectory;
+ Stage m_stage {Stage::ShortFirst};
+ QTimer m_timeout;
+ QTimer m_prepareTimer;
+ QTimer m_modalTimer;
+ quint64 m_activeGeneration {0};
+ quint64 m_lastGeneration {0};
+ int m_completedCycles {0};
+ bool m_awaitingCycle {false};
+ bool m_observed {false};
+ bool m_configured {false};
+ bool m_started {false};
+ bool m_finished {false};
+ bool m_succeeded {false};
+};
+
+#endif