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

Side by Side Diff: Source/WebKit/chromium/tests/LocaleMacTest.cpp

Issue 18318002: DateComponents shouldn't use bloatedCharacters (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix build Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/html/BaseDateAndTimeInputType.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 double msForDate(int year, int month, int day) 67 double msForDate(int year, int month, int day)
68 { 68 {
69 return dateToDaysFrom1970(year, month, day) * msPerDay; 69 return dateToDaysFrom1970(year, month, day) * msPerDay;
70 } 70 }
71 71
72 String formatWeek(const String& localeString, const String& isoString) 72 String formatWeek(const String& localeString, const String& isoString)
73 { 73 {
74 OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); 74 OwnPtr<LocaleMac> locale = LocaleMac::create(localeString);
75 DateComponents date; 75 DateComponents date;
76 unsigned end; 76 unsigned end;
77 date.parseWeek(isoString.bloatedCharacters(), isoString.length(), 0, end ); 77 date.parseWeek(isoString, 0, end);
78 return locale->formatDateTime(date); 78 return locale->formatDateTime(date);
79 } 79 }
80 80
81 String formatMonth(const String& localeString, const String& isoString, bool useShortFormat) 81 String formatMonth(const String& localeString, const String& isoString, bool useShortFormat)
82 { 82 {
83 OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); 83 OwnPtr<LocaleMac> locale = LocaleMac::create(localeString);
84 DateComponents date; 84 DateComponents date;
85 unsigned end; 85 unsigned end;
86 date.parseMonth(isoString.bloatedCharacters(), isoString.length(), 0, en d); 86 date.parseMonth(isoString, 0, end);
87 return locale->formatDateTime(date, (useShortFormat ? Locale::FormatType Short : Locale::FormatTypeMedium)); 87 return locale->formatDateTime(date, (useShortFormat ? Locale::FormatType Short : Locale::FormatTypeMedium));
88 } 88 }
89 89
90 String formatDate(const String& localeString, int year, int month, int day) 90 String formatDate(const String& localeString, int year, int month, int day)
91 { 91 {
92 OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); 92 OwnPtr<LocaleMac> locale = LocaleMac::create(localeString);
93 return locale->formatDateTime(dateComponents(year, month, day)); 93 return locale->formatDateTime(dateComponents(year, month, day));
94 } 94 }
95 95
96 String formatTime(const String& localeString, int hour, int minute, int seco nd, int millisecond, bool useShortFormat) 96 String formatTime(const String& localeString, int hour, int minute, int seco nd, int millisecond, bool useShortFormat)
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 testNumbers("ar"); 383 testNumbers("ar");
384 testNumbers("de_DE"); 384 testNumbers("de_DE");
385 testNumbers("es_ES"); 385 testNumbers("es_ES");
386 testNumbers("fa"); 386 testNumbers("fa");
387 testNumbers("ja_JP"); 387 testNumbers("ja_JP");
388 testNumbers("ko_KR"); 388 testNumbers("ko_KR");
389 testNumbers("zh_CN"); 389 testNumbers("zh_CN");
390 testNumbers("zh_HK"); 390 testNumbers("zh_HK");
391 testNumbers("zh_TW"); 391 testNumbers("zh_TW");
392 } 392 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/BaseDateAndTimeInputType.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698