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

Side by Side Diff: source/test/intltest/tztest.cpp

Issue 1062503003: Cherry pick an upstream cl for host tz detection (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: add a patch file Created 5 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
« no previous file with comments | « source/i18n/unicode/timezone.h ('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 /*********************************************************************** 1 /***********************************************************************
2 * COPYRIGHT: 2 * COPYRIGHT:
3 * Copyright (c) 1997-2014, International Business Machines Corporation 3 * Copyright (c) 1997-2014, International Business Machines Corporation
4 * and others. All Rights Reserved. 4 * and others. All Rights Reserved.
5 ***********************************************************************/ 5 ***********************************************************************/
6 6
7 #include "unicode/utypes.h" 7 #include "unicode/utypes.h"
8 8
9 #if !UCONFIG_NO_FORMATTING 9 #if !UCONFIG_NO_FORMATTING
10 10
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 /* 128 /*
129 * Ticket#6364 and #7648 129 * Ticket#6364 and #7648
130 * A few time zones are using GMT offests not a multiple of 15 minutes. 130 * A few time zones are using GMT offests not a multiple of 15 minutes.
131 * Therefore, we should not interpret such case as an error. 131 * Therefore, we should not interpret such case as an error.
132 * We downgrade this from errln to infoln. When we see this message, 132 * We downgrade this from errln to infoln. When we see this message,
133 * we should examine if it is ignorable or not. 133 * we should examine if it is ignorable or not.
134 */ 134 */
135 infoln("WARNING: t_timezone may be incorrect. It is not a multiple of 15 min.", tzoffset); 135 infoln("WARNING: t_timezone may be incorrect. It is not a multiple of 15 min.", tzoffset);
136 } 136 }
137 137
138 TimeZone* hostZone = TimeZone::detectHostTimeZone();
139 /* Host time zone's offset should match the offset returned by uprv_timezone () */
140 if (hostZone->getRawOffset() != tzoffset * (-1000)) {
141 errln("FAIL: detectHostTimeZone()'s raw offset != host timezone's offset ");
142 }
143 delete hostZone;
144
138 UErrorCode status = U_ZERO_ERROR; 145 UErrorCode status = U_ZERO_ERROR;
139 const char* tzver = TimeZone::getTZDataVersion(status); 146 const char* tzver = TimeZone::getTZDataVersion(status);
140 if (U_FAILURE(status)) { 147 if (U_FAILURE(status)) {
141 errcheckln(status, "FAIL: getTZDataVersion failed - %s", u_errorName(sta tus)); 148 errcheckln(status, "FAIL: getTZDataVersion failed - %s", u_errorName(sta tus));
142 } else if (uprv_strlen(tzver) != 5 /* 4 digits + 1 letter */) { 149 } else if (uprv_strlen(tzver) != 5 /* 4 digits + 1 letter */) {
143 errln((UnicodeString)"FAIL: getTZDataVersion returned " + tzver); 150 errln((UnicodeString)"FAIL: getTZDataVersion returned " + tzver);
144 } else { 151 } else {
145 logln((UnicodeString)"tzdata version: " + tzver); 152 logln((UnicodeString)"tzdata version: " + tzver);
146 } 153 }
147 } 154 }
(...skipping 2269 matching lines...) Expand 10 before | Expand all | Expand 10 after
2417 UnicodeString id; 2424 UnicodeString id;
2418 2425
2419 TimeZone::getIDForWindowsID(UnicodeString(TESTDATA[i].winid), TESTDATA[i ].region, 2426 TimeZone::getIDForWindowsID(UnicodeString(TESTDATA[i].winid), TESTDATA[i ].region,
2420 id, sts); 2427 id, sts);
2421 assertSuccess(UnicodeString(TESTDATA[i].winid) + "/" + TESTDATA[i].regio n, sts); 2428 assertSuccess(UnicodeString(TESTDATA[i].winid) + "/" + TESTDATA[i].regio n, sts);
2422 assertEquals(UnicodeString(TESTDATA[i].winid) + "/" + TESTDATA[i].region , TESTDATA[i].id, id, TRUE); 2429 assertEquals(UnicodeString(TESTDATA[i].winid) + "/" + TESTDATA[i].region , TESTDATA[i].id, id, TRUE);
2423 } 2430 }
2424 } 2431 }
2425 2432
2426 #endif /* #if !UCONFIG_NO_FORMATTING */ 2433 #endif /* #if !UCONFIG_NO_FORMATTING */
OLDNEW
« no previous file with comments | « source/i18n/unicode/timezone.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698