QGCAudioWorkerTest.cc 1.44 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * 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"));
}