Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Unified Diff: third_party/WebKit/Source/platform/fonts/CharacterTest.cpp

Issue 1825023002: Fix integer truncation in Character test functions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test for isNormalizedCanvasSpaceCharacter Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/Character.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/fonts/CharacterTest.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/CharacterTest.cpp b/third_party/WebKit/Source/platform/fonts/CharacterTest.cpp
index 4f0b86256dd6616e6e682f2484ea3b201e1beb16..419561a155687d335c02dddf4a643e3bf56636c3 100644
--- a/third_party/WebKit/Source/platform/fonts/CharacterTest.cpp
+++ b/third_party/WebKit/Source/platform/fonts/CharacterTest.cpp
@@ -386,4 +386,32 @@ TEST(CharacterTest, LineBreakAndQuoteNotEmoji)
EXPECT_FALSE(Character::isEmojiTextPresentation('"'));
}
+TEST(CharacterTest, Truncation)
+{
+ const UChar32 base = 0x90000;
+ UChar32 testChar = 0;
+
+ testChar = base + spaceCharacter;
+ EXPECT_FALSE(Character::treatAsSpace(testChar));
+ testChar = base + noBreakSpaceCharacter;
+ EXPECT_FALSE(Character::treatAsSpace(testChar));
+
+ testChar = base + zeroWidthNonJoinerCharacter;
+ EXPECT_FALSE(Character::treatAsZeroWidthSpace(testChar));
+ testChar = base + zeroWidthJoinerCharacter;
+ EXPECT_FALSE(Character::treatAsZeroWidthSpace(testChar));
+
+ testChar = base + 0x12;
+ EXPECT_FALSE(Character::treatAsZeroWidthSpaceInComplexScript(testChar));
+ EXPECT_FALSE(Character::treatAsZeroWidthSpaceInComplexScript(testChar));
+ testChar = base + objectReplacementCharacter;
+ EXPECT_FALSE(Character::treatAsZeroWidthSpaceInComplexScript(testChar));
+
+ testChar = base + 0xA;
+ EXPECT_FALSE(Character::isNormalizedCanvasSpaceCharacter(testChar));
+ testChar = base + 0x9;
+ EXPECT_FALSE(Character::isNormalizedCanvasSpaceCharacter(testChar));
+
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/Character.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698