| OLD | NEW |
| 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 22 matching lines...) Expand all Loading... |
| 33 ASSERT_EQ(triggerPos, breakPosition); | 33 ASSERT_EQ(triggerPos, breakPosition); |
| 34 } | 34 } |
| 35 ASSERT_EQ(breakPosition, nextBreakable); | 35 ASSERT_EQ(breakPosition, nextBreakable); |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 String m_testString; | 40 String m_testString; |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 // Initializing Vector from an initializer list still not possible, C++ feature
banned in Blink. | 43 // Initializing Vector from an initializer list still not possible, C++ feature |
| 44 // banned in Blink. |
| 44 #define DECLARE_BREAKSVECTOR(...) \ | 45 #define DECLARE_BREAKSVECTOR(...) \ |
| 45 static const int32_t breaksArray[] = __VA_ARGS__; \ | 46 static const int32_t breaksArray[] = __VA_ARGS__; \ |
| 46 Vector<int> breaks; \ | 47 Vector<int> breaks; \ |
| 47 breaks.append(breaksArray, sizeof(breaksArray) / sizeof(*breaksArray)); | 48 breaks.append(breaksArray, sizeof(breaksArray) / sizeof(*breaksArray)); |
| 48 | 49 |
| 49 #define MATCH_LINE_BREAKS(LINEBREAKTYPE, ...) \ | 50 #define MATCH_LINE_BREAKS(LINEBREAKTYPE, ...) \ |
| 50 { \ | 51 { \ |
| 51 DECLARE_BREAKSVECTOR(__VA_ARGS__); \ | 52 DECLARE_BREAKSVECTOR(__VA_ARGS__); \ |
| 52 MatchLineBreaks(LINEBREAKTYPE, breaks); \ | 53 MatchLineBreaks(LINEBREAKTYPE, breaks); \ |
| 53 } | 54 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 92 } |
| 92 | 93 |
| 93 TEST_F(TextBreakIteratorTest, KeepEmojiModifierSequence) { | 94 TEST_F(TextBreakIteratorTest, KeepEmojiModifierSequence) { |
| 94 SetTestString("abc \xE2\x98\x9D\xF0\x9F\x8F\xBB def"); | 95 SetTestString("abc \xE2\x98\x9D\xF0\x9F\x8F\xBB def"); |
| 95 MATCH_LINE_BREAKS(LineBreakType::Normal, {3, 7, 11}); | 96 MATCH_LINE_BREAKS(LineBreakType::Normal, {3, 7, 11}); |
| 96 MATCH_LINE_BREAKS(LineBreakType::BreakAll, {1, 2, 3, 7, 9, 10, 11}); | 97 MATCH_LINE_BREAKS(LineBreakType::BreakAll, {1, 2, 3, 7, 9, 10, 11}); |
| 97 MATCH_LINE_BREAKS(LineBreakType::KeepAll, {3, 7, 11}); | 98 MATCH_LINE_BREAKS(LineBreakType::KeepAll, {3, 7, 11}); |
| 98 } | 99 } |
| 99 | 100 |
| 100 } // namespace blink | 101 } // namespace blink |
| OLD | NEW |