From f2c1e9b2c18851a5c9236d63d3d924d6aff51a34 Mon Sep 17 00:00:00 2001 From: DonLakeFlyer Date: Fri, 20 Oct 2017 13:00:52 -0700 Subject: [PATCH] AudioOuput class restructuring Also hand carried text to speech changes from Stable to master. Plus unit tests for that. --- qgroundcontrol.pro | 8 +- src/Audio/AudioOutput.cc | 165 ++++++++++++++++++++++++++++++++++++++++ src/Audio/AudioOutput.h | 41 ++++++++++ src/Audio/AudioOutputTest.cc | 32 ++++++++ src/Audio/AudioOutputTest.h | 23 ++++++ src/GAudioOutput.cc | 138 --------------------------------- src/GAudioOutput.h | 41 ---------- src/QGCApplication.cc | 2 +- src/QGCApplication.h | 2 +- src/QGCToolbox.cc | 4 +- src/QGCToolbox.h | 6 +- src/Vehicle/Vehicle.cc | 2 +- src/audio/QGCAudioWorkerTest.cc | 32 -------- src/audio/QGCAudioWorkerTest.h | 23 ------ src/qgcunittest/UnitTestList.cc | 11 +-- src/uas/UAS.cc | 2 +- src/ui/MainWindow.cc | 2 +- 17 files changed, 278 insertions(+), 256 deletions(-) create mode 100644 src/Audio/AudioOutput.cc create mode 100644 src/Audio/AudioOutput.h create mode 100644 src/Audio/AudioOutputTest.cc create mode 100644 src/Audio/AudioOutputTest.h delete mode 100644 src/GAudioOutput.cc delete mode 100644 src/GAudioOutput.h delete mode 100644 src/audio/QGCAudioWorkerTest.cc delete mode 100644 src/audio/QGCAudioWorkerTest.h diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index e8f5e04..32c149c 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -351,7 +351,7 @@ INCLUDEPATH += \ src/Settings \ src/VehicleSetup \ src/ViewWidgets \ - src/audio \ + src/Audio \ src/comm \ src/input \ src/lib/qmapcontrol \ @@ -413,6 +413,7 @@ DebugBuild { PX4FirmwarePlugin { PX4FirmwarePluginFactory { APMFirmwarePlugin { HEADERS += \ src/AnalyzeView/LogDownloadTest.h \ + src/Audio/AudioOutputTest.h \ src/FactSystem/FactSystemTestBase.h \ src/FactSystem/FactSystemTestGeneric.h \ src/FactSystem/FactSystemTestPX4.h \ @@ -448,6 +449,7 @@ DebugBuild { PX4FirmwarePlugin { PX4FirmwarePluginFactory { APMFirmwarePlugin { SOURCES += \ src/AnalyzeView/LogDownloadTest.cc \ + src/Audio/AudioOutputTest.cc \ src/FactSystem/FactSystemTestBase.cc \ src/FactSystem/FactSystemTestGeneric.cc \ src/FactSystem/FactSystemTestPX4.cc \ @@ -489,6 +491,7 @@ HEADERS += \ src/AnalyzeView/ExifParser.h \ src/AnalyzeView/ULogParser.h \ src/AnalyzeView/PX4LogParser.h \ + src/Audio/AudioOutput.h \ src/Camera/QGCCameraControl.h \ src/Camera/QGCCameraIO.h \ src/Camera/QGCCameraManager.h \ @@ -497,7 +500,6 @@ HEADERS += \ src/FlightDisplay/VideoManager.h \ src/FlightMap/Widgets/ValuesWidgetController.h \ src/FollowMe/FollowMe.h \ - src/GAudioOutput.h \ src/Joystick/Joystick.h \ src/Joystick/JoystickManager.h \ src/JsonHelper.h \ @@ -679,6 +681,7 @@ SOURCES += \ src/AnalyzeView/ExifParser.cc \ src/AnalyzeView/ULogParser.cc \ src/AnalyzeView/PX4LogParser.cc \ + src/Audio/AudioOutput.cc \ src/Camera/QGCCameraControl.cc \ src/Camera/QGCCameraIO.cc \ src/Camera/QGCCameraManager.cc \ @@ -686,7 +689,6 @@ SOURCES += \ src/FlightDisplay/VideoManager.cc \ src/FlightMap/Widgets/ValuesWidgetController.cc \ src/FollowMe/FollowMe.cc \ - src/GAudioOutput.cc \ src/Joystick/Joystick.cc \ src/Joystick/JoystickManager.cc \ src/JsonHelper.cc \ diff --git a/src/Audio/AudioOutput.cc b/src/Audio/AudioOutput.cc new file mode 100644 index 0000000..6a9e941 --- /dev/null +++ b/src/Audio/AudioOutput.cc @@ -0,0 +1,165 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +#include +#include +#include + +#include "AudioOutput.h" +#include "QGCApplication.h" +#include "QGC.h" +#include "SettingsManager.h" + +AudioOutput::AudioOutput(QGCApplication* app, QGCToolbox* toolbox) + : QGCTool(app, toolbox) +{ + _tts = new QTextToSpeech(this); + connect(_tts, &QTextToSpeech::stateChanged, this, &AudioOutput::_stateChanged); +} + +bool AudioOutput::say(const QString& inText) +{ + bool muted = qgcApp()->toolbox()->settingsManager()->appSettings()->audioMuted()->rawValue().toBool(); + muted |= qgcApp()->runningUnitTests(); + if (!muted && !qgcApp()->runningUnitTests()) { + QString text = fixTextMessageForAudio(inText); + if(_tts->state() == QTextToSpeech::Speaking) { + if(!_texts.contains(text)) { + //-- Some arbitrary limit + if(_texts.size() > 20) { + _texts.removeFirst(); + } + _texts.append(text); + } + } else { + _tts->say(text); + } + } + return true; +} + +void AudioOutput::_stateChanged(QTextToSpeech::State state) +{ + if(state == QTextToSpeech::Ready) { + if(_texts.size()) { + QString text = _texts.first(); + _texts.removeFirst(); + _tts->say(text); + } + } +} + +bool AudioOutput::getMillisecondString(const QString& string, QString& match, int& number) { + static QRegularExpression re("([0-9]+ms)"); + QRegularExpressionMatchIterator i = re.globalMatch(string); + while (i.hasNext()) { + QRegularExpressionMatch qmatch = i.next(); + if (qmatch.hasMatch()) { + match = qmatch.captured(0); + number = qmatch.captured(0).replace("ms", "").toInt(); + return true; + } + } + return false; +} + +QString AudioOutput::fixTextMessageForAudio(const QString& string) { + QString match; + QString newNumber; + QString result = string; + //-- Look for codified terms + if(result.contains("ERR ", Qt::CaseInsensitive)) { + result.replace("ERR ", "error ", Qt::CaseInsensitive); + } + if(result.contains("ERR:", Qt::CaseInsensitive)) { + result.replace("ERR:", "error.", Qt::CaseInsensitive); + } + if(result.contains("POSCTL", Qt::CaseInsensitive)) { + result.replace("POSCTL", "Position Control", Qt::CaseInsensitive); + } + if(result.contains("ALTCTL", Qt::CaseInsensitive)) { + result.replace("ALTCTL", "Altitude Control", Qt::CaseInsensitive); + } + if(result.contains("AUTO_RTL", Qt::CaseInsensitive)) { + result.replace("AUTO_RTL", "auto Return To Launch", Qt::CaseInsensitive); + } else if(result.contains("RTL", Qt::CaseInsensitive)) { + result.replace("RTL", "Return To Launch", Qt::CaseInsensitive); + } + if(result.contains("ACCEL ", Qt::CaseInsensitive)) { + result.replace("ACCEL ", "accelerometer ", Qt::CaseInsensitive); + } + if(result.contains("RC_MAP_MODE_SW", Qt::CaseInsensitive)) { + result.replace("RC_MAP_MODE_SW", "RC mode switch", Qt::CaseInsensitive); + } + if(result.contains("REJ.", Qt::CaseInsensitive)) { + result.replace("REJ.", "Rejected", Qt::CaseInsensitive); + } + if(result.contains("WP", Qt::CaseInsensitive)) { + result.replace("WP", "way point", Qt::CaseInsensitive); + } + if(result.contains("CMD", Qt::CaseInsensitive)) { + result.replace("CMD", "command", Qt::CaseInsensitive); + } + if(result.contains("COMPID", Qt::CaseInsensitive)) { + result.replace("COMPID", "component eye dee", Qt::CaseInsensitive); + } + if(result.contains(" params ", Qt::CaseInsensitive)) { + result.replace(" params ", " parameters ", Qt::CaseInsensitive); + } + if(result.contains(" id ", Qt::CaseInsensitive)) { + result.replace(" id ", " eye dee ", Qt::CaseInsensitive); + } + if(result.contains(" ADSB ", Qt::CaseInsensitive)) { + result.replace(" ADSB ", " Hey Dee Ess Bee ", Qt::CaseInsensitive); + } + + // Convert negative numbers + QRegularExpression re(QStringLiteral("(-)[0-9]*\\.?[0-9]")); + QRegularExpressionMatch reMatch = re.match(result); + while (reMatch.hasMatch()) { + if (!reMatch.captured(1).isNull()) { + // There is a negative prefix + qDebug() << "negative" << reMatch.captured(1) << reMatch.capturedStart(1) << reMatch.capturedEnd(1); + result.replace(reMatch.capturedStart(1), reMatch.capturedEnd(1) - reMatch.capturedStart(1), tr(" negative ")); + qDebug() << result; + } + reMatch = re.match(result); + } + + // Convert meter postfix after real number + re.setPattern(QStringLiteral("[0-9]*\\.?[0-9]\\s?(m)([^A-Za-z]|$)")); + reMatch = re.match(result); + while (reMatch.hasMatch()) { + if (!reMatch.captured(1).isNull()) { + // There is a meter postfix + qDebug() << "meters" << reMatch.captured(1) << reMatch.capturedStart(1) << reMatch.capturedEnd(1); + result.replace(reMatch.capturedStart(1), reMatch.capturedEnd(1) - reMatch.capturedStart(1), tr(" meters")); + qDebug() << result; + } + reMatch = re.match(result); + } + + int number; + if(getMillisecondString(string, match, number) && number > 1000) { + if(number < 60000) { + int seconds = number / 1000; + newNumber = QString("%1 second%2").arg(seconds).arg(seconds > 1 ? "s" : ""); + } else { + int minutes = number / 60000; + int seconds = (number - (minutes * 60000)) / 1000; + if (!seconds) { + newNumber = QString("%1 minute%2").arg(minutes).arg(minutes > 1 ? "s" : ""); + } else { + newNumber = QString("%1 minute%2 and %3 second%4").arg(minutes).arg(minutes > 1 ? "s" : "").arg(seconds).arg(seconds > 1 ? "s" : ""); + } + } + result.replace(match, newNumber); + } + return result; +} diff --git a/src/Audio/AudioOutput.h b/src/Audio/AudioOutput.h new file mode 100644 index 0000000..b97d81f --- /dev/null +++ b/src/Audio/AudioOutput.h @@ -0,0 +1,41 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +#pragma once + +#include +#include +#include +#include +#include + +#include "QGCToolbox.h" + +class QGCApplication; + +class AudioOutput : public QGCTool +{ + Q_OBJECT +public: + AudioOutput(QGCApplication* app, QGCToolbox* toolbox); + + static bool getMillisecondString (const QString& string, QString& match, int& number); + static QString fixTextMessageForAudio (const QString& string); + +public slots: + bool say (const QString& text); + +private slots: + void _stateChanged (QTextToSpeech::State state); + +protected: + QTextToSpeech* _tts; + QStringList _texts; +}; + diff --git a/src/Audio/AudioOutputTest.cc b/src/Audio/AudioOutputTest.cc new file mode 100644 index 0000000..3395b89 --- /dev/null +++ b/src/Audio/AudioOutputTest.cc @@ -0,0 +1,32 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +#include "AudioOutputTest.h" +#include "AudioOutput.h" + +AudioOutputTest::AudioOutputTest(void) +{ + +} + +void AudioOutputTest::_testSpokenReplacements(void) +{ + QString result = AudioOutput::fixTextMessageForAudio(QStringLiteral("-10.5m, -10.5m. -10.5 m")); + QCOMPARE(result, QStringLiteral(" negative 10.5 meters, negative 10.5 meters. negative 10.5 meters")); + result = AudioOutput::fixTextMessageForAudio(QStringLiteral("-10m -10 m")); + QCOMPARE(result, QStringLiteral(" negative 10 meters negative 10 meters")); + result = AudioOutput::fixTextMessageForAudio(QStringLiteral("foo -10m -10 m bar")); + QCOMPARE(result, QStringLiteral("foo negative 10 meters negative 10 meters bar")); + result = AudioOutput::fixTextMessageForAudio(QStringLiteral("-foom")); + QCOMPARE(result, QStringLiteral("-foom")); + result = AudioOutput::fixTextMessageForAudio(QStringLiteral("10 moo")); + QCOMPARE(result, QStringLiteral("10 moo")); + result = AudioOutput::fixTextMessageForAudio(QStringLiteral("10moo")); + QCOMPARE(result, QStringLiteral("10moo")); +} diff --git a/src/Audio/AudioOutputTest.h b/src/Audio/AudioOutputTest.h new file mode 100644 index 0000000..cecd30e --- /dev/null +++ b/src/Audio/AudioOutputTest.h @@ -0,0 +1,23 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +#pragma once + +#include "UnitTest.h" + +class AudioOutputTest : public UnitTest +{ + Q_OBJECT + +public: + AudioOutputTest(void); + +private slots: + void _testSpokenReplacements(void); +}; diff --git a/src/GAudioOutput.cc b/src/GAudioOutput.cc deleted file mode 100644 index b14f930..0000000 --- a/src/GAudioOutput.cc +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - -#include -#include -#include - -#include "GAudioOutput.h" -#include "QGCApplication.h" -#include "QGC.h" -#include "SettingsManager.h" - -GAudioOutput::GAudioOutput(QGCApplication* app, QGCToolbox* toolbox) - : QGCTool(app, toolbox) -{ - _tts = new QTextToSpeech(this); - connect(_tts, &QTextToSpeech::stateChanged, this, &GAudioOutput::_stateChanged); -} - -bool GAudioOutput::say(const QString& inText) -{ - bool muted = qgcApp()->toolbox()->settingsManager()->appSettings()->audioMuted()->rawValue().toBool(); - muted |= qgcApp()->runningUnitTests(); - if (!muted && !qgcApp()->runningUnitTests()) { - QString text = fixTextMessageForAudio(inText); - if(_tts->state() == QTextToSpeech::Speaking) { - if(!_texts.contains(text)) { - //-- Some arbitrary limit - if(_texts.size() > 20) { - _texts.removeFirst(); - } - _texts.append(text); - } - } else { - _tts->say(text); - } - } - return true; -} - -void GAudioOutput::_stateChanged(QTextToSpeech::State state) -{ - if(state == QTextToSpeech::Ready) { - if(_texts.size()) { - QString text = _texts.first(); - _texts.removeFirst(); - _tts->say(text); - } - } -} - -bool GAudioOutput::getMillisecondString(const QString& string, QString& match, int& number) { - static QRegularExpression re("([0-9]+ms)"); - QRegularExpressionMatchIterator i = re.globalMatch(string); - while (i.hasNext()) { - QRegularExpressionMatch qmatch = i.next(); - if (qmatch.hasMatch()) { - match = qmatch.captured(0); - number = qmatch.captured(0).replace("ms", "").toInt(); - return true; - } - } - return false; -} - -QString GAudioOutput::fixTextMessageForAudio(const QString& string) { - QString match; - QString newNumber; - QString result = string; - //-- Look for codified terms - if(result.contains("ERR ", Qt::CaseInsensitive)) { - result.replace("ERR ", "error ", Qt::CaseInsensitive); - } - if(result.contains("ERR:", Qt::CaseInsensitive)) { - result.replace("ERR:", "error.", Qt::CaseInsensitive); - } - if(result.contains("POSCTL", Qt::CaseInsensitive)) { - result.replace("POSCTL", "Position Control", Qt::CaseInsensitive); - } - if(result.contains("ALTCTL", Qt::CaseInsensitive)) { - result.replace("ALTCTL", "Altitude Control", Qt::CaseInsensitive); - } - if(result.contains("AUTO_RTL", Qt::CaseInsensitive)) { - result.replace("AUTO_RTL", "auto Return To Launch", Qt::CaseInsensitive); - } else if(result.contains("RTL", Qt::CaseInsensitive)) { - result.replace("RTL", "Return To Launch", Qt::CaseInsensitive); - } - if(result.contains("ACCEL ", Qt::CaseInsensitive)) { - result.replace("ACCEL ", "accelerometer ", Qt::CaseInsensitive); - } - if(result.contains("RC_MAP_MODE_SW", Qt::CaseInsensitive)) { - result.replace("RC_MAP_MODE_SW", "RC mode switch", Qt::CaseInsensitive); - } - if(result.contains("REJ.", Qt::CaseInsensitive)) { - result.replace("REJ.", "Rejected", Qt::CaseInsensitive); - } - if(result.contains("WP", Qt::CaseInsensitive)) { - result.replace("WP", "way point", Qt::CaseInsensitive); - } - if(result.contains("CMD", Qt::CaseInsensitive)) { - result.replace("CMD", "command", Qt::CaseInsensitive); - } - if(result.contains("COMPID", Qt::CaseInsensitive)) { - result.replace("COMPID", "component eye dee", Qt::CaseInsensitive); - } - if(result.contains(" params ", Qt::CaseInsensitive)) { - result.replace(" params ", " parameters ", Qt::CaseInsensitive); - } - if(result.contains(" id ", Qt::CaseInsensitive)) { - result.replace(" id ", " eye dee ", Qt::CaseInsensitive); - } - if(result.contains(" ADSB ", Qt::CaseInsensitive)) { - result.replace(" ADSB ", " Hey Dee Ess Bee ", Qt::CaseInsensitive); - } - int number; - if(getMillisecondString(string, match, number) && number > 1000) { - if(number < 60000) { - int seconds = number / 1000; - newNumber = QString("%1 second%2").arg(seconds).arg(seconds > 1 ? "s" : ""); - } else { - int minutes = number / 60000; - int seconds = (number - (minutes * 60000)) / 1000; - if (!seconds) { - newNumber = QString("%1 minute%2").arg(minutes).arg(minutes > 1 ? "s" : ""); - } else { - newNumber = QString("%1 minute%2 and %3 second%4").arg(minutes).arg(minutes > 1 ? "s" : "").arg(seconds).arg(seconds > 1 ? "s" : ""); - } - } - result.replace(match, newNumber); - } - return result; -} diff --git a/src/GAudioOutput.h b/src/GAudioOutput.h deleted file mode 100644 index 44a839a..0000000 --- a/src/GAudioOutput.h +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - -#pragma once - -#include -#include -#include -#include -#include - -#include "QGCToolbox.h" - -class QGCApplication; - -class GAudioOutput : public QGCTool -{ - Q_OBJECT -public: - GAudioOutput(QGCApplication* app, QGCToolbox* toolbox); - - static bool getMillisecondString (const QString& string, QString& match, int& number); - static QString fixTextMessageForAudio (const QString& string); - -public slots: - bool say (const QString& text); - -private slots: - void _stateChanged (QTextToSpeech::State state); - -protected: - QTextToSpeech* _tts; - QStringList _texts; -}; - diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc index 7583630..66b0d95 100644 --- a/src/QGCApplication.cc +++ b/src/QGCApplication.cc @@ -35,7 +35,7 @@ #include "QGC.h" #include "QGCApplication.h" -#include "GAudioOutput.h" +#include "AudioOutput.h" #include "CmdLineOptParser.h" #include "UDPLink.h" #include "LinkManager.h" diff --git a/src/QGCApplication.h b/src/QGCApplication.h index fb4ec5d..f2459a6 100644 --- a/src/QGCApplication.h +++ b/src/QGCApplication.h @@ -30,7 +30,7 @@ #include "FirmwarePluginManager.h" #include "MultiVehicleManager.h" #include "JoystickManager.h" -#include "GAudioOutput.h" +#include "AudioOutput.h" #include "UASMessageHandler.h" #include "FactSystem.h" diff --git a/src/QGCToolbox.cc b/src/QGCToolbox.cc index 92f43eb..c2eadcf 100644 --- a/src/QGCToolbox.cc +++ b/src/QGCToolbox.cc @@ -10,7 +10,7 @@ #include "FactSystem.h" #include "FirmwarePluginManager.h" -#include "GAudioOutput.h" +#include "AudioOutput.h" #ifndef __mobile__ #include "GPSManager.h" #endif @@ -62,7 +62,7 @@ QGCToolbox::QGCToolbox(QGCApplication* app) //-- Scan and load plugins _scanAndLoadPlugins(app); - _audioOutput = new GAudioOutput (app, this); + _audioOutput = new AudioOutput (app, this); _factSystem = new FactSystem (app, this); _firmwarePluginManager = new FirmwarePluginManager (app, this); #ifndef __mobile__ diff --git a/src/QGCToolbox.h b/src/QGCToolbox.h index fb5c230..a45e37e 100644 --- a/src/QGCToolbox.h +++ b/src/QGCToolbox.h @@ -15,7 +15,7 @@ class FactSystem; class FirmwarePluginManager; -class GAudioOutput; +class AudioOutput; class GPSManager; class JoystickManager; class FollowMe; @@ -41,7 +41,7 @@ public: QGCToolbox(QGCApplication* app); FirmwarePluginManager* firmwarePluginManager(void) { return _firmwarePluginManager; } - GAudioOutput* audioOutput(void) { return _audioOutput; } + AudioOutput* audioOutput(void) { return _audioOutput; } JoystickManager* joystickManager(void) { return _joystickManager; } LinkManager* linkManager(void) { return _linkManager; } MAVLinkProtocol* mavlinkProtocol(void) { return _mavlinkProtocol; } @@ -66,7 +66,7 @@ private: void _scanAndLoadPlugins(QGCApplication *app); - GAudioOutput* _audioOutput; + AudioOutput* _audioOutput; FactSystem* _factSystem; FirmwarePluginManager* _firmwarePluginManager; #ifndef __mobile__ diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index 3ab4b2a..c7ba531 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -24,7 +24,7 @@ #include "ParameterManager.h" #include "QGCApplication.h" #include "QGCImageProvider.h" -#include "GAudioOutput.h" +#include "AudioOutput.h" #include "FollowMe.h" #include "MissionCommandTree.h" #include "QGroundControlQmlGlobal.h" diff --git a/src/audio/QGCAudioWorkerTest.cc b/src/audio/QGCAudioWorkerTest.cc deleted file mode 100644 index 3d2e6b0..0000000 --- a/src/audio/QGCAudioWorkerTest.cc +++ /dev/null @@ -1,32 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - -#include "QGCAudioWorkerTest.h" -#include "QGCAudioWorker.h" - -QGCAudioWorkerTest::QGCAudioWorkerTest(void) -{ - -} - -void QGCAudioWorkerTest::_testSpokenReplacements(void) -{ - QString result = QGCAudioWorker::fixTextMessageForAudio(QStringLiteral("-10.5m, -10.5m. -10.5 m")); - QCOMPARE(result, QStringLiteral(" negative 10.5 meters, negative 10.5 meters. negative 10.5 meters")); - result = QGCAudioWorker::fixTextMessageForAudio(QStringLiteral("-10m -10 m")); - QCOMPARE(result, QStringLiteral(" negative 10 meters negative 10 meters")); - result = QGCAudioWorker::fixTextMessageForAudio(QStringLiteral("foo -10m -10 m bar")); - QCOMPARE(result, QStringLiteral("foo negative 10 meters negative 10 meters bar")); - result = QGCAudioWorker::fixTextMessageForAudio(QStringLiteral("-foom")); - QCOMPARE(result, QStringLiteral("-foom")); - result = QGCAudioWorker::fixTextMessageForAudio(QStringLiteral("10 moo")); - QCOMPARE(result, QStringLiteral("10 moo")); - result = QGCAudioWorker::fixTextMessageForAudio(QStringLiteral("10moo")); - QCOMPARE(result, QStringLiteral("10moo")); -} diff --git a/src/audio/QGCAudioWorkerTest.h b/src/audio/QGCAudioWorkerTest.h deleted file mode 100644 index b0432e2..0000000 --- a/src/audio/QGCAudioWorkerTest.h +++ /dev/null @@ -1,23 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - -#pragma once - -#include "UnitTest.h" - -class QGCAudioWorkerTest : public UnitTest -{ - Q_OBJECT - -public: - QGCAudioWorkerTest(void); - -private slots: - void _testSpokenReplacements(void); -}; diff --git a/src/qgcunittest/UnitTestList.cc b/src/qgcunittest/UnitTestList.cc index 2a4bee0..0fb23b5 100644 --- a/src/qgcunittest/UnitTestList.cc +++ b/src/qgcunittest/UnitTestList.cc @@ -38,11 +38,7 @@ #include "PlanMasterControllerTest.h" #include "MissionSettingsTest.h" #include "QGCMapPolygonTest.h" - -#if 0 -// Temporarily disabled until I move some stuff from Stable to master -#include "QGCAudioWorkerTest.h" -#endif +#include "AudioOutputTest.h" UT_REGISTER_TEST(FactSystemTestGeneric) UT_REGISTER_TEST(FactSystemTestPX4) @@ -68,10 +64,7 @@ UT_REGISTER_TEST(SpeedSectionTest) UT_REGISTER_TEST(PlanMasterControllerTest) UT_REGISTER_TEST(MissionSettingsTest) UT_REGISTER_TEST(QGCMapPolygonTest) -#if 0 -// Temporarily disabled until I move some stuff from Stable to master -UT_REGISTER_TEST(QGCAudioWorkerTest) -#endif +UT_REGISTER_TEST(AudioOutputTest) // List of unit test which are currently disabled. // If disabling a new test, include reason in comment. diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index f13cfd0..1258ead 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -26,7 +26,7 @@ #include "UAS.h" #include "LinkInterface.h" #include "QGC.h" -#include "GAudioOutput.h" +#include "AudioOutput.h" #include "MAVLinkProtocol.h" #include "QGCMAVLink.h" #include "LinkManager.h" diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index 0690ad2..041cbe5 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -30,7 +30,7 @@ #include "QGC.h" #include "MAVLinkProtocol.h" #include "MainWindow.h" -#include "GAudioOutput.h" +#include "AudioOutput.h" #ifndef __mobile__ #include "QGCMAVLinkLogPlayer.h" #endif