ICU-8892 merge of #9191 r31603 for 4.4x

X-SVN-Rev: 31605
This commit is contained in:
Steven R. Loomis 2012-03-08 19:44:16 +00:00
parent 1f0301a972
commit 8850c7f3f8
3 changed files with 35 additions and 3 deletions

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 1997-2010, International Business Machines Corporation and *
* Copyright (C) 1997-2012, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
@ -748,6 +748,8 @@ Calendar::operator=(const Calendar &right)
fWeekendCease = right.fWeekendCease;
fWeekendCeaseMillis = right.fWeekendCeaseMillis;
fNextStamp = right.fNextStamp;
uprv_strcpy(validLocale, right.validLocale);
uprv_strcpy(actualLocale, right.actualLocale);
}
return *this;

View file

@ -1,6 +1,6 @@
/************************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2010, International Business Machines Corporation
* Copyright (c) 1997-2012, International Business Machines Corporation
* and others. All Rights Reserved.
************************************************************************/
@ -17,9 +17,15 @@
#include "unicode/dbgutil.h"
#include "unicode/udat.h"
#include "unicode/ustring.h"
#include "unicode/localpointer.h"
#define mkcstr(U) u_austrcpy(calloc(8, u_strlen(U) + 1), U)
#define TEST_CHECK_STATUS {if (U_FAILURE(status)) {errln("%s:%d: Test failure. status=%s", \
__FILE__, __LINE__, u_errorName(status)); return;}}
#define TEST_ASSERT(expr) {if ((expr)==FALSE) {errln("%s:%d: Test failure \n", __FILE__, __LINE__);};}
// *****************************************************************************
// class CalendarTest
// *****************************************************************************
@ -229,6 +235,13 @@ void CalendarTest::runIndexedTest( int32_t index, UBool exec, const char* &name,
Test1624();
}
break;
case 25:
name = "TestCloneLocale";
if(exec) {
logln("TestCloneLocale---"); logln("");
TestCloneLocale();
}
break;
default: name = ""; break;
}
}
@ -2158,6 +2171,21 @@ void CalendarTest::Test1624() {
return;
}
void CalendarTest::TestCloneLocale(void) {
UErrorCode status = U_ZERO_ERROR;
LocalPointer<Calendar> cal(Calendar::createInstance(TimeZone::getGMT()->clone(),
Locale::createFromName("en"), status));
TEST_CHECK_STATUS;
Locale l0 = cal->getLocale(ULOC_VALID_LOCALE, status);
TEST_CHECK_STATUS;
LocalPointer<Calendar> cal2(cal->clone());
Locale l = cal2->getLocale(ULOC_VALID_LOCALE, status);
if(l0!=l) {
errln("Error: cloned locale %s != original locale %s, status %s\n", l0.getName(), l.getName(), u_errorName(status));
}
TEST_CHECK_STATUS;
}
#endif /* #if !UCONFIG_NO_FORMATTING */
//eof

View file

@ -1,5 +1,5 @@
/***********************************************************************
* Copyright (c) 1997-2009, International Business Machines Corporation
* Copyright (c) 1997-2012, International Business Machines Corporation
* and others. All Rights Reserved.
***********************************************************************/
@ -219,6 +219,8 @@ public: // package
void Test6703(void);
void Test3785(void);
void Test1624(void);
void TestCloneLocale(void);
};
#endif /* #if !UCONFIG_NO_FORMATTING */