зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1577021: Add test coverage for non-ascii characters in MimeType codecs. r=dminor
Provides coverage for an issue fixed in 1573381. Note that while that bug discusses big endian machines, the tests added will cover both the big and little endian case of the bug. This is because we have test cases that make sure both octets of 16 wide char are being correctly compared. Differential Revision: https://phabricator.services.mozilla.com/D44054 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
8fcd7c71a2
Коммит
068643968c
|
@ -154,6 +154,30 @@ TEST(MediaMIMETypes, MediaCodecs)
|
|||
EXPECT_TRUE(two.ContainsAll(two));
|
||||
EXPECT_TRUE(two.ContainsAll(one));
|
||||
EXPECT_FALSE(one.ContainsAll(two));
|
||||
|
||||
// Check wide char case where both octets/bytes are relevant. Note we don't
|
||||
// use `EqualsLiteral` here because at the time of writing it will place the
|
||||
// literal into a narrow string which then doesn't compare correctly with
|
||||
// the wide representation from MediaCodecs.
|
||||
MediaCodecs euroSign(u8" € "); // U+20AC
|
||||
EXPECT_FALSE(euroSign.IsEmpty());
|
||||
EXPECT_TRUE(euroSign.AsString().Equals(NS_LITERAL_STRING(" € ")));
|
||||
EXPECT_FALSE(euroSign.Contains(NS_LITERAL_STRING("")));
|
||||
EXPECT_TRUE(euroSign.Contains(NS_LITERAL_STRING("€")));
|
||||
EXPECT_FALSE(euroSign.Contains(NS_LITERAL_STRING("€€")));
|
||||
EXPECT_TRUE(euroSign.ContainsPrefix(NS_LITERAL_STRING("")));
|
||||
EXPECT_TRUE(euroSign.ContainsPrefix(NS_LITERAL_STRING("€")));
|
||||
EXPECT_FALSE(euroSign.ContainsPrefix(
|
||||
NS_LITERAL_STRING("₭"))); // U+20AD -- ensure second octet is compared
|
||||
EXPECT_FALSE(euroSign.ContainsPrefix(
|
||||
NS_LITERAL_STRING("↬"))); // U+21AC -- ensure first octet is compared
|
||||
EXPECT_FALSE(euroSign.ContainsPrefix(NS_LITERAL_STRING("€ ")));
|
||||
iterations = 0;
|
||||
for (const auto& codec : euroSign.Range()) {
|
||||
++iterations;
|
||||
EXPECT_TRUE(codec.Equals(NS_LITERAL_STRING("€")));
|
||||
}
|
||||
EXPECT_EQ(1, iterations);
|
||||
}
|
||||
|
||||
TEST(MediaMIMETypes, MakeMediaExtendedMIMEType_bad)
|
||||
|
|
Загрузка…
Ссылка в новой задаче