X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/ba6d6ed23dec08b1cd5700a128c0752491c10ac9..51004dcb01e06fef634b61be77ed73dd61cb6db9:/icuSources/test/intltest/dadrfmt.cpp?ds=inline diff --git a/icuSources/test/intltest/dadrfmt.cpp b/icuSources/test/intltest/dadrfmt.cpp index a3c58362..c3a533ae 100644 --- a/icuSources/test/intltest/dadrfmt.cpp +++ b/icuSources/test/intltest/dadrfmt.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2010, International Business Machines Corporation and + * Copyright (c) 1997-2010,2012, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ @@ -73,14 +73,16 @@ void DataDrivenFormatTest::runIndexedTest(int32_t index, UBool exec, /* - * Headers { "locale","spec", "date", "str"} + * Headers { "locale", "zone", "spec", "date", "str"} // locale: locale including calendar type + // zone: time zone name, or "" to not explicitly set zone // spec: either 'PATTERN=y mm h' etc, or 'DATE=SHORT,TIME=LONG' // date: either an unsigned long (millis), or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale // str: the expected unicode string Cases { { - "en_US@calendar=gregorian", + "en_US@calendar=gregorian", + "", "DATE=SHORT,TIME=SHORT", "ERA=1,YEAR=2007,MONTH=AUGUST,DATE=8,HOUR=18,MINUTE=54,SECOND=12", "8/8/2007 6:54pm" @@ -130,6 +132,11 @@ void DataDrivenFormatTest::testConvertDate(TestData *testData, errln("case %d: No 'locale' line.", n); continue; } + UnicodeString zone = currentCase->getString("zone", status); + if (U_FAILURE(status)) { + errln("case %d: No 'zone' line.", n); + continue; + } UnicodeString spec = currentCase->getString("spec", status); if(U_FAILURE(status)) { errln("case %d: No 'spec' line.", n); @@ -175,6 +182,13 @@ void DataDrivenFormatTest::testConvertDate(TestData *testData, if(U_FAILURE(status)) { errln("case %d: could not create calendar from %s", n, calLoc); } + + if (zone.length() > 0) { + TimeZone * tz = TimeZone::createTimeZone(zone); + cal->setTimeZone(*tz); + format->setTimeZone(*tz); + delete tz; + } // parse 'date' if(date.startsWith(kMILLIS)) { @@ -197,8 +211,13 @@ void DataDrivenFormatTest::testConvertDate(TestData *testData, for (int q=0; qget((UCalendarDateFields)q, status); - cal->add((UCalendarDateFields)q, - fromSet.get((UCalendarDateFields)q), status); + if (q == UCAL_DATE) { + cal->add((UCalendarDateFields)q, + fromSet.get((UCalendarDateFields)q), status); + } else { + cal->set((UCalendarDateFields)q, + fromSet.get((UCalendarDateFields)q)); + } //int32_t newv = cal->get((UCalendarDateFields)q, status); } }