]> granicus.if.org Git - icu/commitdiff
ICU-11713 Ensure that what getGroupingSize() returns doesn't change just because...
authorTravis Keep <keep94@gmail.com>
Thu, 28 May 2015 22:45:45 +0000 (22:45 +0000)
committerTravis Keep <keep94@gmail.com>
Thu, 28 May 2015 22:45:45 +0000 (22:45 +0000)
X-SVN-Rev: 37472

icu4c/source/i18n/decimfmt.cpp
icu4c/source/test/intltest/dcfmapts.cpp

index 0478c07ccc4a39ebd5085c2c74042b3ae0ea0728..c003932415e3d4ac7d3eaccff2862f12193c4c1f 100644 (file)
@@ -4128,7 +4128,7 @@ void DecimalFormat::setExponentSignAlwaysShown(UBool expSignAlways) {
 int32_t
 DecimalFormat::getGroupingSize() const
 {
-    return isGroupingUsed() ? fGroupingSize : 0;
+    return fGroupingSize;
 }
 
 //------------------------------------------------------------------------------
@@ -4985,6 +4985,9 @@ DecimalFormat::applyPatternWithoutExpandAffix(const UnicodeString& pattern,
     if (out.fGroupingUsed) {
         fGroupingSize = out.fGroupingSize;
         fGroupingSize2 = out.fGroupingSize2;
+    } else {
+        fGroupingSize = 0;
+        fGroupingSize2 = 0;
     }
     setMultiplier(out.fMultiplier);
     fDecimalSeparatorAlwaysShown = out.fDecimalSeparatorAlwaysShown;
index 9e66f3de98656890869e01e00a41afc8f6561025..c7dba5ca12cd2934bbeafcf8c1c74d37a8fe4ce7 100644 (file)
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT:
- * Copyright (c) 1997-2014, International Business Machines Corporation and
+ * Copyright (c) 1997-2015, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 
@@ -113,6 +113,10 @@ void IntlTestDecimalFormatAPI::testAPI(/*char *par*/)
     if (noGrouping.getGroupingSize() != 0) {
       errln("Grouping size should be 0 for no grouping.");
     }
+    noGrouping.setGroupingUsed(TRUE);
+    if (noGrouping.getGroupingSize() != 0) {
+      errln("Grouping size should still be 0.");
+    }
     // end bug 10864
 
     status = U_ZERO_ERROR;
@@ -828,6 +832,7 @@ void IntlTestDecimalFormatAPI::TestBadFastpath() {
     fmt.remove();
     assertEquals("Format 1234", "1234", df->format(1234, fmt));
     df->setGroupingUsed(TRUE);
+    df->setGroupingSize(3);
     fmt.remove();
     assertEquals("Format 1234 w/ grouping", "1,234", df->format(1234, fmt));
 }