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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/Character.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/fonts/Character.h" 5 #include "platform/fonts/Character.h"
6 6
7 #include "platform/Logging.h" 7 #include "platform/Logging.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "wtf/text/CharacterNames.h" 9 #include "wtf/text/CharacterNames.h"
10 10
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 EXPECT_FALSE(Character::isEmojiModifierBase('A')); 379 EXPECT_FALSE(Character::isEmojiModifierBase('A'));
380 EXPECT_FALSE(Character::isEmojiModifierBase(0x1F47D)); 380 EXPECT_FALSE(Character::isEmojiModifierBase(0x1F47D));
381 } 381 }
382 382
383 TEST(CharacterTest, LineBreakAndQuoteNotEmoji) 383 TEST(CharacterTest, LineBreakAndQuoteNotEmoji)
384 { 384 {
385 EXPECT_FALSE(Character::isEmojiTextPresentation('\n')); 385 EXPECT_FALSE(Character::isEmojiTextPresentation('\n'));
386 EXPECT_FALSE(Character::isEmojiTextPresentation('"')); 386 EXPECT_FALSE(Character::isEmojiTextPresentation('"'));
387 } 387 }
388 388
389 TEST(CharacterTest, Truncation)
390 {
391 const UChar32 base = 0x90000;
392 UChar32 testChar = 0;
393
394 testChar = base + spaceCharacter;
395 EXPECT_FALSE(Character::treatAsSpace(testChar));
396 testChar = base + noBreakSpaceCharacter;
397 EXPECT_FALSE(Character::treatAsSpace(testChar));
398
399 testChar = base + zeroWidthNonJoinerCharacter;
400 EXPECT_FALSE(Character::treatAsZeroWidthSpace(testChar));
401 testChar = base + zeroWidthJoinerCharacter;
402 EXPECT_FALSE(Character::treatAsZeroWidthSpace(testChar));
403
404 testChar = base + 0x12;
405 EXPECT_FALSE(Character::treatAsZeroWidthSpaceInComplexScript(testChar));
406 EXPECT_FALSE(Character::treatAsZeroWidthSpaceInComplexScript(testChar));
407 testChar = base + objectReplacementCharacter;
408 EXPECT_FALSE(Character::treatAsZeroWidthSpaceInComplexScript(testChar));
409
410 testChar = base + 0xA;
411 EXPECT_FALSE(Character::isNormalizedCanvasSpaceCharacter(testChar));
412 testChar = base + 0x9;
413 EXPECT_FALSE(Character::isNormalizedCanvasSpaceCharacter(testChar));
414
415 }
416
389 } // namespace blink 417 } // namespace blink
OLDNEW
« 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