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

Unified Diff: third_party/WebKit/Source/platform/text/BidiResolverTest.cpp

Issue 2555923002: Changed TextDirection to an enum class and renamed its members (Closed)
Patch Set: Rebase after reopen Created 4 years 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
Index: third_party/WebKit/Source/platform/text/BidiResolverTest.cpp
diff --git a/third_party/WebKit/Source/platform/text/BidiResolverTest.cpp b/third_party/WebKit/Source/platform/text/BidiResolverTest.cpp
index e89da4d023b7a61187f4de54deec3c2a477ed02a..5be771accbf2c348cc9ca0b22e94b007044857fe 100644
--- a/third_party/WebKit/Source/platform/text/BidiResolverTest.cpp
+++ b/third_party/WebKit/Source/platform/text/BidiResolverTest.cpp
@@ -48,14 +48,14 @@ TEST(BidiResolver, Basic) {
TextDirection direction =
bidiResolver.determineParagraphDirectionality(&hasStrongDirectionality);
EXPECT_TRUE(hasStrongDirectionality);
- EXPECT_EQ(LTR, direction);
+ EXPECT_EQ(TextDirection::Ltr, direction);
}
TextDirection determineParagraphDirectionality(
const TextRun& textRun,
bool* hasStrongDirectionality = 0) {
BidiResolver<TextRunIterator, BidiCharacterRun> resolver;
- resolver.setStatus(BidiStatus(LTR, false));
+ resolver.setStatus(BidiStatus(TextDirection::Ltr, false));
resolver.setPositionIgnoringNestedIsolates(TextRunIterator(&textRun, 0));
return resolver.determineParagraphDirectionality(hasStrongDirectionality);
}
@@ -78,33 +78,34 @@ void testDirectionality(const TestData& entry) {
}
TEST(BidiResolver, ParagraphDirectionSurrogates) {
- const TestData testData[] = {// Test strong RTL, non-BMP. (U+10858 Imperial
- // Aramaic number one, strong RTL)
- {{0xD802, 0xDC58}, 2, RTL, true},
-
- // Test strong LTR, non-BMP. (U+1D15F Musical
- // symbol quarter note, strong LTR)
- {{0xD834, 0xDD5F}, 2, LTR, true},
-
- // Test broken surrogate: valid leading, invalid
- // trail. (Lead of U+10858, space)
- {{0xD802, ' '}, 2, LTR, false},
-
- // Test broken surrogate: invalid leading. (Trail
- // of U+10858, U+05D0 Hebrew Alef)
- {{0xDC58, 0x05D0}, 2, RTL, true},
-
- // Test broken surrogate: valid leading, invalid
- // trail/valid lead, valid trail.
- {{0xD802, 0xD802, 0xDC58}, 3, RTL, true},
-
- // Test broken surrogate: valid leading, no trail
- // (string too short). (Lead of U+10858)
- {{0xD802, 0xDC58}, 1, LTR, false},
-
- // Test broken surrogate: trail appearing before
- // lead. (U+10858 units reversed)
- {{0xDC58, 0xD802}, 2, LTR, false}};
+ const TestData testData[] = {
+ // Test strong RTL, non-BMP. (U+10858 Imperial
+ // Aramaic number one, strong RTL)
+ {{0xD802, 0xDC58}, 2, TextDirection::Rtl, true},
+
+ // Test strong LTR, non-BMP. (U+1D15F Musical
+ // symbol quarter note, strong LTR)
+ {{0xD834, 0xDD5F}, 2, TextDirection::Ltr, true},
+
+ // Test broken surrogate: valid leading, invalid
+ // trail. (Lead of U+10858, space)
+ {{0xD802, ' '}, 2, TextDirection::Ltr, false},
+
+ // Test broken surrogate: invalid leading. (Trail
+ // of U+10858, U+05D0 Hebrew Alef)
+ {{0xDC58, 0x05D0}, 2, TextDirection::Rtl, true},
+
+ // Test broken surrogate: valid leading, invalid
+ // trail/valid lead, valid trail.
+ {{0xD802, 0xD802, 0xDC58}, 3, TextDirection::Rtl, true},
+
+ // Test broken surrogate: valid leading, no trail
+ // (string too short). (Lead of U+10858)
+ {{0xD802, 0xDC58}, 1, TextDirection::Ltr, false},
+
+ // Test broken surrogate: trail appearing before
+ // lead. (U+10858 units reversed)
+ {{0xDC58, 0xD802}, 2, TextDirection::Ltr, false}};
for (size_t i = 0; i < WTF_ARRAY_LENGTH(testData); ++i)
testDirectionality(testData[i]);
}
@@ -184,10 +185,10 @@ void BidiTestRunner::runTest(const std::basic_string<UChar>& input,
textRun.setDirection(determineParagraphDirectionality(textRun));
break;
case bidi_test::DirectionLTR:
- textRun.setDirection(LTR);
+ textRun.setDirection(TextDirection::Ltr);
break;
case bidi_test::DirectionRTL:
- textRun.setDirection(RTL);
+ textRun.setDirection(TextDirection::Rtl);
break;
}
BidiResolver<TextRunIterator, BidiCharacterRun> resolver;
« no previous file with comments | « third_party/WebKit/Source/platform/text/BidiResolver.h ('k') | third_party/WebKit/Source/platform/text/BidiTextRun.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698