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

Side by Side Diff: third_party/WebKit/Source/platform/text/TextBreakIteratorTest.cpp

Issue 2478383003: Remove isBreakValid for Emoji sequences (Closed)
Patch Set: Created 4 years, 1 month 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/text/TextBreakIterator.cpp ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/text/TextBreakIterator.h" 5 #include "platform/text/TextBreakIterator.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "wtf/text/WTFString.h" 8 #include "wtf/text/WTFString.h"
9 9
10 namespace blink { 10 namespace blink {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 60
61 TEST_F(TextBreakIteratorTest, Chinese) { 61 TEST_F(TextBreakIteratorTest, Chinese) {
62 SetTestString("標準萬國碼"); 62 SetTestString("標準萬國碼");
63 MATCH_LINE_BREAKS(LineBreakType::Normal, {1, 2, 3, 4, 5}); 63 MATCH_LINE_BREAKS(LineBreakType::Normal, {1, 2, 3, 4, 5});
64 MATCH_LINE_BREAKS(LineBreakType::BreakAll, {1, 2, 3, 4, 5}); 64 MATCH_LINE_BREAKS(LineBreakType::BreakAll, {1, 2, 3, 4, 5});
65 MATCH_LINE_BREAKS(LineBreakType::KeepAll, {5}); 65 MATCH_LINE_BREAKS(LineBreakType::KeepAll, {5});
66 } 66 }
67 67
68 TEST_F(TextBreakIteratorTest, KeepEmojiZWJFamilyIsolate) { 68 TEST_F(TextBreakIteratorTest, KeepEmojiZWJFamilyIsolate) {
69 SetTestString( 69 SetTestString(u8"\U0001F468\u200D\U0001F469\u200D\U0001F467\u200D\U0001F466");
70 "\xF0\x9F\x91\xA8\xE2\x80\x8D\xF0\x9F\x91\xA9\xE2\x80\x8D\xF0\x9F\x91\xA7"
71 "\xE2\x80\x8D\xF0\x9F\x91\xA6");
72 MATCH_LINE_BREAKS(LineBreakType::Normal, {11}); 70 MATCH_LINE_BREAKS(LineBreakType::Normal, {11});
73 MATCH_LINE_BREAKS(LineBreakType::BreakAll, {11}); 71 MATCH_LINE_BREAKS(LineBreakType::BreakAll, {11});
74 MATCH_LINE_BREAKS(LineBreakType::KeepAll, {11}); 72 MATCH_LINE_BREAKS(LineBreakType::KeepAll, {11});
75 } 73 }
76 74
77 TEST_F(TextBreakIteratorTest, KeepEmojiModifierSequenceIsolate) { 75 TEST_F(TextBreakIteratorTest, KeepEmojiModifierSequenceIsolate) {
78 SetTestString("\xE2\x98\x9D\xF0\x9F\x8F\xBB"); 76 SetTestString(u8"\u261D\U0001F3FB");
79 MATCH_LINE_BREAKS(LineBreakType::Normal, {3}); 77 MATCH_LINE_BREAKS(LineBreakType::Normal, {3});
80 MATCH_LINE_BREAKS(LineBreakType::BreakAll, {3}); 78 MATCH_LINE_BREAKS(LineBreakType::BreakAll, {3});
81 MATCH_LINE_BREAKS(LineBreakType::KeepAll, {3}); 79 MATCH_LINE_BREAKS(LineBreakType::KeepAll, {3});
82 } 80 }
83 81
84 TEST_F(TextBreakIteratorTest, KeepEmojiZWJSequence) { 82 TEST_F(TextBreakIteratorTest, KeepEmojiZWJSequence) {
85 SetTestString( 83 SetTestString(
86 "abc " 84 u8"abc \U0001F469\u200D\U0001F469\u200D\U0001F467\u200D\U0001F467 def");
87 "\xF0\x9F\x91\xA9\xE2\x80\x8D\xF0\x9F\x91\xA9\xE2\x80\x8D\xF0\x9F\x91\xA7"
88 "\xE2\x80\x8D\xF0\x9F\x91\xA7 def");
89 MATCH_LINE_BREAKS(LineBreakType::Normal, {3, 15, 19}); 85 MATCH_LINE_BREAKS(LineBreakType::Normal, {3, 15, 19});
90 MATCH_LINE_BREAKS(LineBreakType::BreakAll, {1, 2, 3, 15, 17, 18, 19}); 86 MATCH_LINE_BREAKS(LineBreakType::BreakAll, {1, 2, 3, 15, 17, 18, 19});
91 MATCH_LINE_BREAKS(LineBreakType::KeepAll, {3, 15, 19}); 87 MATCH_LINE_BREAKS(LineBreakType::KeepAll, {3, 15, 19});
92 } 88 }
93 89
94 TEST_F(TextBreakIteratorTest, KeepEmojiModifierSequence) { 90 TEST_F(TextBreakIteratorTest, KeepEmojiModifierSequence) {
95 SetTestString("abc \xE2\x98\x9D\xF0\x9F\x8F\xBB def"); 91 SetTestString(u8"abc \u261D\U0001F3FB def");
96 MATCH_LINE_BREAKS(LineBreakType::Normal, {3, 7, 11}); 92 MATCH_LINE_BREAKS(LineBreakType::Normal, {3, 7, 11});
97 MATCH_LINE_BREAKS(LineBreakType::BreakAll, {1, 2, 3, 7, 9, 10, 11}); 93 MATCH_LINE_BREAKS(LineBreakType::BreakAll, {1, 2, 3, 7, 9, 10, 11});
98 MATCH_LINE_BREAKS(LineBreakType::KeepAll, {3, 7, 11}); 94 MATCH_LINE_BREAKS(LineBreakType::KeepAll, {3, 7, 11});
99 } 95 }
100 96
101 } // namespace blink 97 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/text/TextBreakIterator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698