Unverified Commit ca4d085e authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #7783 from DonLakeFlyer/QTFatalWarnings

QT_FATAL_WARNINGS on for unit tests
parents eb7f384c 501c4c2a
...@@ -187,6 +187,7 @@ script: ...@@ -187,6 +187,7 @@ script:
- if [[ "${SPEC}" = "linux-g++-64" && "${CONFIG}" = "debug" ]]; then - if [[ "${SPEC}" = "linux-g++-64" && "${CONFIG}" = "debug" ]]; then
mkdir -p ~/.config/QtProject/ && mkdir -p ~/.config/QtProject/ &&
cp ${TRAVIS_BUILD_DIR}/test/qtlogging.ini ~/.config/QtProject/ && cp ${TRAVIS_BUILD_DIR}/test/qtlogging.ini ~/.config/QtProject/ &&
export QT_FATAL_WARNINGS=1 &&
./debug/qgroundcontrol-start.sh --unittest; ./debug/qgroundcontrol-start.sh --unittest;
fi fi
......
...@@ -17,9 +17,17 @@ ...@@ -17,9 +17,17 @@
#include "SettingsManager.h" #include "SettingsManager.h"
AudioOutput::AudioOutput(QGCApplication* app, QGCToolbox* toolbox) AudioOutput::AudioOutput(QGCApplication* app, QGCToolbox* toolbox)
: QGCTool(app, toolbox) : QGCTool (app, toolbox)
, _tts(new QTextToSpeech(this)) , _tts (nullptr)
{ {
if (qgcApp()->runningUnitTests()) {
// Cloud based unit tests don't have speech capabilty. If you try to crank up
// speech engine it will pop a qWarning which prevents usage of QT_FATAL_WARNINGS
return;
}
_tts = new QTextToSpeech(this);
//-- Force TTS engine to English as all incoming messages from the autopilot //-- Force TTS engine to English as all incoming messages from the autopilot
// are in English and not localized. // are in English and not localized.
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
...@@ -28,8 +36,13 @@ AudioOutput::AudioOutput(QGCApplication* app, QGCToolbox* toolbox) ...@@ -28,8 +36,13 @@ AudioOutput::AudioOutput(QGCApplication* app, QGCToolbox* toolbox)
connect(_tts, &QTextToSpeech::stateChanged, this, &AudioOutput::_stateChanged); connect(_tts, &QTextToSpeech::stateChanged, this, &AudioOutput::_stateChanged);
} }
bool AudioOutput::say(const QString& inText) void AudioOutput::say(const QString& inText)
{ {
if (!_tts) {
qDebug() << "say" << inText;
return;
}
bool muted = qgcApp()->toolbox()->settingsManager()->appSettings()->audioMuted()->rawValue().toBool(); bool muted = qgcApp()->toolbox()->settingsManager()->appSettings()->audioMuted()->rawValue().toBool();
muted |= qgcApp()->runningUnitTests(); muted |= qgcApp()->runningUnitTests();
if (!muted && !qgcApp()->runningUnitTests()) { if (!muted && !qgcApp()->runningUnitTests()) {
...@@ -46,7 +59,6 @@ bool AudioOutput::say(const QString& inText) ...@@ -46,7 +59,6 @@ bool AudioOutput::say(const QString& inText)
_tts->say(text); _tts->say(text);
} }
} }
return true;
} }
void AudioOutput::_stateChanged(QTextToSpeech::State state) void AudioOutput::_stateChanged(QTextToSpeech::State state)
......
...@@ -29,7 +29,7 @@ public: ...@@ -29,7 +29,7 @@ public:
static QString fixTextMessageForAudio (const QString& string); static QString fixTextMessageForAudio (const QString& string);
public slots: public slots:
bool say (const QString& text); void say (const QString& text);
private slots: private slots:
void _stateChanged (QTextToSpeech::State state); void _stateChanged (QTextToSpeech::State state);
......
...@@ -34,7 +34,13 @@ void QGCPositionManager::setToolbox(QGCToolbox *toolbox) ...@@ -34,7 +34,13 @@ void QGCPositionManager::setToolbox(QGCToolbox *toolbox)
QGCTool::setToolbox(toolbox); QGCTool::setToolbox(toolbox);
//-- First see if plugin provides a position source //-- First see if plugin provides a position source
_defaultSource = toolbox->corePlugin()->createPositionSource(this); _defaultSource = toolbox->corePlugin()->createPositionSource(this);
if(!_defaultSource) {
if (qgcApp()->runningUnitTests()) {
// Units test on travis fail due to lack of position source
return;
}
if (!_defaultSource) {
//-- Otherwise, create a default one //-- Otherwise, create a default one
_defaultSource = QGeoPositionInfoSource::createDefaultSource(this); _defaultSource = QGeoPositionInfoSource::createDefaultSource(this);
} }
......
...@@ -724,6 +724,9 @@ void QGCApplication::showMessage(const QString& message) ...@@ -724,6 +724,9 @@ void QGCApplication::showMessage(const QString& message)
QVariant varReturn; QVariant varReturn;
QVariant varMessage = QVariant::fromValue(message); QVariant varMessage = QVariant::fromValue(message);
QMetaObject::invokeMethod(_rootQmlObject(), "showMessage", Q_RETURN_ARG(QVariant, varReturn), Q_ARG(QVariant, varMessage)); QMetaObject::invokeMethod(_rootQmlObject(), "showMessage", Q_RETURN_ARG(QVariant, varReturn), Q_ARG(QVariant, varMessage));
} else if (runningUnitTests()) {
// Unit tests can run without UI
qDebug() << "QGCApplication::showMessage unittest" << message;
} else { } else {
qWarning() << "Internal error"; qWarning() << "Internal error";
} }
......
...@@ -1136,7 +1136,7 @@ QGCCacheWorker::_lookupReady(QHostInfo info) ...@@ -1136,7 +1136,7 @@ QGCCacheWorker::_lookupReady(QHostInfo info)
return; return;
} }
} }
qWarning() << "No Internet Access"; qDebug() << "No Internet Access";
emit internetStatus(false); emit internetStatus(false);
#endif #endif
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment