diff options
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/TestAudioReceiverBuffer/TestAudioReceiverBuffer.cpp | 64 | ||||
-rw-r--r-- | src/tests/TestMumbleProtocol/TestMumbleProtocol.cpp | 24 |
2 files changed, 44 insertions, 44 deletions
diff --git a/src/tests/TestAudioReceiverBuffer/TestAudioReceiverBuffer.cpp b/src/tests/TestAudioReceiverBuffer/TestAudioReceiverBuffer.cpp index 46cf8f5b5..3d37c3099 100644 --- a/src/tests/TestAudioReceiverBuffer/TestAudioReceiverBuffer.cpp +++ b/src/tests/TestAudioReceiverBuffer/TestAudioReceiverBuffer.cpp @@ -85,7 +85,7 @@ public: protected: std::size_t m_encodings = 0; Version::mumble_raw_version_t m_protocolVersion = Version::UNKNOWN; - Mumble::Protocol::audio_context_t m_context = Mumble::Protocol::AudioContext::Invalid; + Mumble::Protocol::audio_context_t m_context = Mumble::Protocol::AudioContext::INVALID; float m_volumeAdjustment = 0.0f; }; @@ -112,9 +112,9 @@ private slots: usedIDs.insert(current.uiSession); } - QVERIFY(Mumble::Protocol::AudioContext::Normal < Mumble::Protocol::AudioContext::Whisper); - QVERIFY(Mumble::Protocol::AudioContext::Normal < Mumble::Protocol::AudioContext::Shout); - QVERIFY(Mumble::Protocol::AudioContext::Normal < Mumble::Protocol::AudioContext::Listen); + QVERIFY(Mumble::Protocol::AudioContext::NORMAL < Mumble::Protocol::AudioContext::WHISPER); + QVERIFY(Mumble::Protocol::AudioContext::NORMAL < Mumble::Protocol::AudioContext::SHOUT); + QVERIFY(Mumble::Protocol::AudioContext::NORMAL < Mumble::Protocol::AudioContext::LISTEN); QVERIFY(contextUser1.ssContext == contextUser3.ssContext); QVERIFY(contextUser1.ssContext != contextUser2.ssContext); @@ -125,12 +125,12 @@ private slots: ServerUser &sender = users[0]; - buffer.addReceiver(sender, sender, Mumble::Protocol::AudioContext::Listen, false); - buffer.addReceiver(sender, users[1], Mumble::Protocol::AudioContext::Whisper, false); - buffer.addReceiver(sender, users[2], Mumble::Protocol::AudioContext::Shout, false); - buffer.addReceiver(sender, contextUser1, Mumble::Protocol::AudioContext::Shout, false); - buffer.addReceiver(sender, selfDeafUser, Mumble::Protocol::AudioContext::Shout, false); - buffer.addReceiver(sender, deafUser, Mumble::Protocol::AudioContext::Shout, false); + buffer.addReceiver(sender, sender, Mumble::Protocol::AudioContext::LISTEN, false); + buffer.addReceiver(sender, users[1], Mumble::Protocol::AudioContext::WHISPER, false); + buffer.addReceiver(sender, users[2], Mumble::Protocol::AudioContext::SHOUT, false); + buffer.addReceiver(sender, contextUser1, Mumble::Protocol::AudioContext::SHOUT, false); + buffer.addReceiver(sender, selfDeafUser, Mumble::Protocol::AudioContext::SHOUT, false); + buffer.addReceiver(sender, deafUser, Mumble::Protocol::AudioContext::SHOUT, false); QCOMPARE(buffer.getReceivers(false).size(), static_cast< std::size_t >(3)); QVERIFY(buffer.getReceivers(true).empty()); @@ -141,10 +141,10 @@ private slots: ServerUser &sender = contextUser1; - buffer.addReceiver(sender, users[0], Mumble::Protocol::AudioContext::Normal, true); - buffer.addReceiver(sender, users[1], Mumble::Protocol::AudioContext::Normal, true); - buffer.addReceiver(sender, contextUser2, Mumble::Protocol::AudioContext::Normal, true); - buffer.addReceiver(sender, contextUser3, Mumble::Protocol::AudioContext::Normal, true); + buffer.addReceiver(sender, users[0], Mumble::Protocol::AudioContext::NORMAL, true); + buffer.addReceiver(sender, users[1], Mumble::Protocol::AudioContext::NORMAL, true); + buffer.addReceiver(sender, contextUser2, Mumble::Protocol::AudioContext::NORMAL, true); + buffer.addReceiver(sender, contextUser3, Mumble::Protocol::AudioContext::NORMAL, true); // There is only one receiver whose context matches that of the sender QCOMPARE(buffer.getReceivers(true).size(), static_cast< std::size_t >(1)); @@ -157,7 +157,7 @@ private slots: ServerUser &sender = users[0]; - buffer.forceAddReceiver(sender, Mumble::Protocol::AudioContext::Normal, false); + buffer.forceAddReceiver(sender, Mumble::Protocol::AudioContext::NORMAL, false); QCOMPARE(buffer.getReceivers(false).size(), static_cast< std::size_t >(1)); QVERIFY(buffer.getReceivers(true).empty()); @@ -168,16 +168,16 @@ private slots: ServerUser &sender = users[0]; - buffer.addReceiver(sender, users[3], Mumble::Protocol::AudioContext::Listen, false, + buffer.addReceiver(sender, users[3], Mumble::Protocol::AudioContext::LISTEN, false, VolumeAdjustment::fromFactor(1.2f)); - buffer.addReceiver(sender, users[1], Mumble::Protocol::AudioContext::Whisper, false); - buffer.addReceiver(sender, users[1], Mumble::Protocol::AudioContext::Normal, false); - buffer.addReceiver(sender, users[2], Mumble::Protocol::AudioContext::Shout, false); - buffer.addReceiver(sender, users[1], Mumble::Protocol::AudioContext::Listen, false); - buffer.addReceiver(sender, users[1], Mumble::Protocol::AudioContext::Shout, false); - buffer.addReceiver(sender, users[3], Mumble::Protocol::AudioContext::Listen, false, + buffer.addReceiver(sender, users[1], Mumble::Protocol::AudioContext::WHISPER, false); + buffer.addReceiver(sender, users[1], Mumble::Protocol::AudioContext::NORMAL, false); + buffer.addReceiver(sender, users[2], Mumble::Protocol::AudioContext::SHOUT, false); + buffer.addReceiver(sender, users[1], Mumble::Protocol::AudioContext::LISTEN, false); + buffer.addReceiver(sender, users[1], Mumble::Protocol::AudioContext::SHOUT, false); + buffer.addReceiver(sender, users[3], Mumble::Protocol::AudioContext::LISTEN, false, VolumeAdjustment::fromFactor(1.4f)); - buffer.addReceiver(sender, contextUser1, Mumble::Protocol::AudioContext::Shout, false); + buffer.addReceiver(sender, contextUser1, Mumble::Protocol::AudioContext::SHOUT, false); buffer.preprocessBuffer(); @@ -199,7 +199,7 @@ private slots: QVERIFY(volumeReceiver != nullptr); // Verify that the "Normal" speech receiver has survived (instead of one of the other contexts) - QCOMPARE(duplicateReceiver->getContext(), Mumble::Protocol::AudioContext::Normal); + QCOMPARE(duplicateReceiver->getContext(), Mumble::Protocol::AudioContext::NORMAL); // Verify that the highest volume adjustment has survived QCOMPARE(volumeReceiver->getVolumeAdjustment().factor, 1.4f); } @@ -209,16 +209,16 @@ private slots: ServerUser &sender = contextUser2; - buffer.addReceiver(sender, users[3], Mumble::Protocol::AudioContext::Shout, false); - buffer.addReceiver(sender, users[1], Mumble::Protocol::AudioContext::Listen, false); - buffer.addReceiver(sender, users[4], Mumble::Protocol::AudioContext::Shout, false); - buffer.addReceiver(sender, users[2], Mumble::Protocol::AudioContext::Normal, false); - buffer.addReceiver(sender, users[0], Mumble::Protocol::AudioContext::Normal, false); - buffer.addReceiver(sender, contextUser1, Mumble::Protocol::AudioContext::Shout, false, + buffer.addReceiver(sender, users[3], Mumble::Protocol::AudioContext::SHOUT, false); + buffer.addReceiver(sender, users[1], Mumble::Protocol::AudioContext::LISTEN, false); + buffer.addReceiver(sender, users[4], Mumble::Protocol::AudioContext::SHOUT, false); + buffer.addReceiver(sender, users[2], Mumble::Protocol::AudioContext::NORMAL, false); + buffer.addReceiver(sender, users[0], Mumble::Protocol::AudioContext::NORMAL, false); + buffer.addReceiver(sender, contextUser1, Mumble::Protocol::AudioContext::SHOUT, false, VolumeAdjustment::fromFactor(1.4f)); - buffer.addReceiver(sender, contextUser2, Mumble::Protocol::AudioContext::Shout, false, + buffer.addReceiver(sender, contextUser2, Mumble::Protocol::AudioContext::SHOUT, false, VolumeAdjustment::fromFactor(1.2f)); - buffer.addReceiver(sender, contextUser3, Mumble::Protocol::AudioContext::Shout, false, + buffer.addReceiver(sender, contextUser3, Mumble::Protocol::AudioContext::SHOUT, false, VolumeAdjustment::fromFactor(1.2f)); buffer.preprocessBuffer(); diff --git a/src/tests/TestMumbleProtocol/TestMumbleProtocol.cpp b/src/tests/TestMumbleProtocol/TestMumbleProtocol.cpp index 85e0b502a..d284655c1 100644 --- a/src/tests/TestMumbleProtocol/TestMumbleProtocol.cpp +++ b/src/tests/TestMumbleProtocol/TestMumbleProtocol.cpp @@ -174,12 +174,12 @@ template< Mumble::Protocol::Role encoderRole, Mumble::Protocol::Role decoderRole if (decoderRole == Mumble::Protocol::Role::Client) { QVERIFY(encoder.getRole() == Mumble::Protocol::Role::Server); - data.targetOrContext = Mumble::Protocol::AudioContext::Shout; + data.targetOrContext = Mumble::Protocol::AudioContext::SHOUT; data.senderSession = 42; } else { QVERIFY(encoder.getRole() == Mumble::Protocol::Role::Client); - data.targetOrContext = Mumble::Protocol::ReservedTargetIDs::ServerLoopback; + data.targetOrContext = Mumble::Protocol::ReservedTargetIDs::SERVER_LOOPBACK; } auto encodedData = encoder.encodeAudioPacket(data); @@ -193,7 +193,7 @@ template< Mumble::Protocol::Role encoderRole, Mumble::Protocol::Role decoderRole qWarning() << "Partial re-encoding"; // Re-encode fields from the "variable" part - data.targetOrContext = Mumble::Protocol::AudioContext::Listen; + data.targetOrContext = Mumble::Protocol::AudioContext::LISTEN; if (version >= Mumble::Protocol::PROTOBUF_INTRODUCTION_VERSION && decoderRole == Mumble::Protocol::Role::Client) { data.volumeAdjustment = VolumeAdjustment::fromFactor(0.9f); @@ -210,7 +210,7 @@ template< Mumble::Protocol::Role encoderRole, Mumble::Protocol::Role decoderRole qWarning() << "Removing positional data"; // Update the audio packet to no longer contain positional data. data.containsPositionalData = false; - data.targetOrContext = Mumble::Protocol::AudioContext::Normal; + data.targetOrContext = Mumble::Protocol::AudioContext::NORMAL; encoder.dropPositionalData(); @@ -249,8 +249,8 @@ private slots: MumbleUDP::Audio msg; std::vector< Mumble::Protocol::byte > buffer; - for (Mumble::Protocol::audio_context_t currentContext = Mumble::Protocol::AudioContext::begin; - currentContext < Mumble::Protocol::AudioContext::end; currentContext++) { + for (Mumble::Protocol::audio_context_t currentContext = Mumble::Protocol::AudioContext::BEGIN; + currentContext < Mumble::Protocol::AudioContext::END; currentContext++) { gsl::span< const Mumble::Protocol::byte > snippet = encoder.getPreEncodedContext(currentContext); QVERIFY2(!snippet.empty(), "Unable to find pre-encoded snippet for audio context"); @@ -270,7 +270,7 @@ private slots: } // Ensure that an unknown context yields an empty span - QVERIFY(encoder.getPreEncodedContext(Mumble::Protocol::AudioContext::end).empty()); + QVERIFY(encoder.getPreEncodedContext(Mumble::Protocol::AudioContext::END).empty()); } void test_preEncode_volume_adjustments() { @@ -278,10 +278,10 @@ private slots: MumbleUDP::Audio msg; - constexpr int min = -60; - constexpr int max = 30; + constexpr int MIN = -60; + constexpr int MAX = 30; - for (int currentAdjustment = min; currentAdjustment <= max; ++currentAdjustment) { + for (int currentAdjustment = MIN; currentAdjustment <= MAX; ++currentAdjustment) { msg.Clear(); gsl::span< const Mumble::Protocol::byte > snippet = @@ -296,9 +296,9 @@ private slots: } // Ensure that an unknown/unexpected volume adjustment yields an empty span - QVERIFY(encoder.getPreEncodedVolumeAdjustment(VolumeAdjustment::fromDBAdjustment(min - 1)).empty()); + QVERIFY(encoder.getPreEncodedVolumeAdjustment(VolumeAdjustment::fromDBAdjustment(MIN - 1)).empty()); // We only expect pre-encoded values for integer dB adjustments - QVERIFY(encoder.getPreEncodedVolumeAdjustment(VolumeAdjustment(std::pow(2.0f, (min + 0.5) / 6.0f))).empty()); + QVERIFY(encoder.getPreEncodedVolumeAdjustment(VolumeAdjustment(std::pow(2.0f, (MAX + 0.5) / 6.0f))).empty()); } }; |