Add a test that verifies that all fields are converted

Bug: webrtc:358039777
Change-Id: Ie97a3212077b1a989d2063c6dad0d41582b28bde
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/363800
Commit-Queue: Erik Språng <sprang@webrtc.org>
Auto-Submit: Fanny Linderborg <linderborg@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43086}
This commit is contained in:
Fanny Linderborg 2024-09-26 09:16:27 +02:00 committed by WebRTC LUCI CQ
parent b28d0698a2
commit f4aa6953f9

View File

@ -302,5 +302,30 @@ TEST(
EXPECT_EQ(data->sequence_index, 11 + 128);
}
TEST(CorruptionDetectionMessageToFrameInstrumentationData, ConvertAllFields) {
std::vector<double> sample_values = {1.0, 2.0, 3.0, 4.0, 5.0};
std::optional<CorruptionDetectionMessage> message =
CorruptionDetectionMessage::Builder()
.WithSequenceIndex(11)
.WithInterpretSequenceIndexAsMostSignificantBits(false)
.WithStdDev(1.2)
.WithLumaErrorThreshold(10)
.WithChromaErrorThreshold(10)
.WithSampleValues(sample_values)
.Build();
ASSERT_TRUE(message.has_value());
std::optional<FrameInstrumentationData> data =
ConvertCorruptionDetectionMessageToFrameInstrumentationData(*message, 0);
ASSERT_TRUE(data.has_value());
EXPECT_EQ(data->sequence_index, 11);
EXPECT_FALSE(data->communicate_upper_bits);
EXPECT_NEAR(data->std_dev, 1.2, 0.024); // ~2%
EXPECT_EQ(data->luma_error_threshold, 10);
EXPECT_EQ(data->chroma_error_threshold, 10);
EXPECT_THAT(data->sample_values, ElementsAre(1.0, 2.0, 3.0, 4.0, 5.0));
}
} // namespace
} // namespace webrtc