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

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

Issue 1897163002: Remove ENABLE(INPUT_MULTIPLE_FIELDS_UI) conditional compilation in platform/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */); 105 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */);
106 return locale->weekDayShortLabels()[index]; 106 return locale->weekDayShortLabels()[index];
107 } 107 }
108 108
109 bool isRTL(LCID lcid) 109 bool isRTL(LCID lcid)
110 { 110 {
111 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */); 111 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */);
112 return locale->isRTL(); 112 return locale->isRTL();
113 } 113 }
114 114
115 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
116 String monthFormat(LCID lcid) 115 String monthFormat(LCID lcid)
117 { 116 {
118 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */); 117 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */);
119 return locale->monthFormat(); 118 return locale->monthFormat();
120 } 119 }
121 120
122 String timeFormat(LCID lcid) 121 String timeFormat(LCID lcid)
123 { 122 {
124 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */); 123 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */);
125 return locale->timeFormat(); 124 return locale->timeFormat();
(...skipping 15 matching lines...) Expand all
141 { 140 {
142 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */); 141 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */);
143 return locale->timeAMPMLabels()[index]; 142 return locale->timeAMPMLabels()[index];
144 } 143 }
145 144
146 String decimalSeparator(LCID lcid) 145 String decimalSeparator(LCID lcid)
147 { 146 {
148 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */); 147 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */);
149 return locale->localizedDecimalSeparator(); 148 return locale->localizedDecimalSeparator();
150 } 149 }
151 #endif
152 }; 150 };
153 151
154 TEST_F(LocaleWinTest, formatDate) 152 TEST_F(LocaleWinTest, formatDate)
155 { 153 {
156 EXPECT_STREQ("04/27/2005", formatDate(EnglishUS, 2005, April, 27).utf8().dat a()); 154 EXPECT_STREQ("04/27/2005", formatDate(EnglishUS, 2005, April, 27).utf8().dat a());
157 EXPECT_STREQ("27/04/2005", formatDate(FrenchFR, 2005, April, 27).utf8().data ()); 155 EXPECT_STREQ("27/04/2005", formatDate(FrenchFR, 2005, April, 27).utf8().data ());
158 EXPECT_STREQ("2005/04/27", formatDate(JapaneseJP, 2005, April, 27).utf8().da ta()); 156 EXPECT_STREQ("2005/04/27", formatDate(JapaneseJP, 2005, April, 27).utf8().da ta());
159 } 157 }
160 158
161 TEST_F(LocaleWinTest, firstDayOfWeek) 159 TEST_F(LocaleWinTest, firstDayOfWeek)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 EXPECT_STREQ("\xE6\xB0\xB4", weekDayShortLabel(JapaneseJP, Wednesday).utf8() .data()); 192 EXPECT_STREQ("\xE6\xB0\xB4", weekDayShortLabel(JapaneseJP, Wednesday).utf8() .data());
195 EXPECT_STREQ("\xE5\x9C\x9F", weekDayShortLabel(JapaneseJP, Saturday).utf8(). data()); 193 EXPECT_STREQ("\xE5\x9C\x9F", weekDayShortLabel(JapaneseJP, Saturday).utf8(). data());
196 } 194 }
197 195
198 TEST_F(LocaleWinTest, isRTL) 196 TEST_F(LocaleWinTest, isRTL)
199 { 197 {
200 EXPECT_TRUE(isRTL(ArabicEG)); 198 EXPECT_TRUE(isRTL(ArabicEG));
201 EXPECT_FALSE(isRTL(EnglishUS)); 199 EXPECT_FALSE(isRTL(EnglishUS));
202 } 200 }
203 201
204 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
205 TEST_F(LocaleWinTest, dateFormat) 202 TEST_F(LocaleWinTest, dateFormat)
206 { 203 {
207 EXPECT_STREQ("y-M-d", LocaleWin::dateFormat("y-M-d").utf8().data()); 204 EXPECT_STREQ("y-M-d", LocaleWin::dateFormat("y-M-d").utf8().data());
208 EXPECT_STREQ("''yy'-'''MM'''-'dd", LocaleWin::dateFormat("''yy-''MM''-dd").u tf8().data()); 205 EXPECT_STREQ("''yy'-'''MM'''-'dd", LocaleWin::dateFormat("''yy-''MM''-dd").u tf8().data());
209 EXPECT_STREQ("yyyy'-''''-'MMM'''''-'dd", LocaleWin::dateFormat("yyyy-''''-MM M''''-dd").utf8().data()); 206 EXPECT_STREQ("yyyy'-''''-'MMM'''''-'dd", LocaleWin::dateFormat("yyyy-''''-MM M''''-dd").utf8().data());
210 EXPECT_STREQ("yyyy'-'''''MMMM-dd", LocaleWin::dateFormat("yyyy-''''MMMM-dd") .utf8().data()); 207 EXPECT_STREQ("yyyy'-'''''MMMM-dd", LocaleWin::dateFormat("yyyy-''''MMMM-dd") .utf8().data());
211 } 208 }
212 209
213 TEST_F(LocaleWinTest, monthFormat) 210 TEST_F(LocaleWinTest, monthFormat)
214 { 211 {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 251
255 EXPECT_STREQ("\xE5\x8D\x88\xE5\x89\x8D", timeAMPMLabel(JapaneseJP, 0).utf8() .data()); 252 EXPECT_STREQ("\xE5\x8D\x88\xE5\x89\x8D", timeAMPMLabel(JapaneseJP, 0).utf8() .data());
256 EXPECT_STREQ("\xE5\x8D\x88\xE5\xBE\x8C", timeAMPMLabel(JapaneseJP, 1).utf8() .data()); 253 EXPECT_STREQ("\xE5\x8D\x88\xE5\xBE\x8C", timeAMPMLabel(JapaneseJP, 1).utf8() .data());
257 } 254 }
258 255
259 TEST_F(LocaleWinTest, decimalSeparator) 256 TEST_F(LocaleWinTest, decimalSeparator)
260 { 257 {
261 EXPECT_STREQ(".", decimalSeparator(EnglishUS).utf8().data()); 258 EXPECT_STREQ(".", decimalSeparator(EnglishUS).utf8().data());
262 EXPECT_STREQ(",", decimalSeparator(FrenchFR).utf8().data()); 259 EXPECT_STREQ(",", decimalSeparator(FrenchFR).utf8().data());
263 } 260 }
264 #endif
265 261
266 static void testNumberIsReversible(LCID lcid, const char* original, const char* shouldHave = 0) 262 static void testNumberIsReversible(LCID lcid, const char* original, const char* shouldHave = 0)
267 { 263 {
268 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); 264 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */);
269 String localized = locale->convertToLocalizedNumber(original); 265 String localized = locale->convertToLocalizedNumber(original);
270 if (shouldHave) 266 if (shouldHave)
271 EXPECT_TRUE(localized.contains(shouldHave)); 267 EXPECT_TRUE(localized.contains(shouldHave));
272 String converted = locale->convertFromLocalizedNumber(localized); 268 String converted = locale->convertFromLocalizedNumber(localized);
273 EXPECT_STREQ(original, converted.utf8().data()); 269 EXPECT_STREQ(original, converted.utf8().data());
274 } 270 }
(...skipping 24 matching lines...) Expand all
299 testNumbers(Spanish); 295 testNumbers(Spanish);
300 testNumbers(Persian); 296 testNumbers(Persian);
301 testNumbers(JapaneseJP); 297 testNumbers(JapaneseJP);
302 testNumbers(KoreanKR); 298 testNumbers(KoreanKR);
303 testNumbers(ChineseCN); 299 testNumbers(ChineseCN);
304 testNumbers(ChineseHK); 300 testNumbers(ChineseHK);
305 testNumbers(ChineseTW); 301 testNumbers(ChineseTW);
306 } 302 }
307 303
308 } // namespace blink 304 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/text/LocaleMacTest.cpp ('k') | third_party/WebKit/Source/platform/text/PlatformLocale.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698