Viliam Lejcik : kernel32: Fix GetCurrencyFormat grouping.
Alexandre Julliard
julliard at winehq.org
Wed Nov 11 08:33:25 CST 2009
Module: wine
Branch: master
Commit: 3dc8b28d841a8f676b158bccbfe33ef1200e6e96
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3dc8b28d841a8f676b158bccbfe33ef1200e6e96
Author: Viliam Lejcik <lejcik at host.sk>
Date: Mon Nov 9 10:41:54 2009 +0100
kernel32: Fix GetCurrencyFormat grouping.
---
dlls/kernel32/lcformat.c | 2 +-
dlls/kernel32/tests/locale.c | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/dlls/kernel32/lcformat.c b/dlls/kernel32/lcformat.c
index 1b1dfcc..f1b5ba5 100644
--- a/dlls/kernel32/lcformat.c
+++ b/dlls/kernel32/lcformat.c
@@ -1521,7 +1521,7 @@ GetCurrencyFormatW_Error:
dwState |= NF_DIGITS_OUT;
dwCurrentGroupCount++;
- if (szSrc >= lpszValue && dwCurrentGroupCount == dwGroupCount)
+ if (szSrc >= lpszValue && dwCurrentGroupCount == dwGroupCount && *szSrc != '-')
{
LPWSTR lpszGrp = lpFormat->lpThousandSep + strlenW(lpFormat->lpThousandSep) - 1;
diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c
index 77fae8b..37dc0aa 100644
--- a/dlls/kernel32/tests/locale.c
+++ b/dlls/kernel32/tests/locale.c
@@ -743,6 +743,18 @@ static void test_GetCurrencyFormatA(void)
ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
EXPECT_LENA; EXPECT_EQA;
+ STRINGSA("235","$235.0"); /* Grouping of a positive number */
+ format.Grouping = 3;
+ ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer));
+ ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
+ EXPECT_LENA; EXPECT_EQA;
+
+ STRINGSA("-235","$-235.0"); /* Grouping of a negative number */
+ format.NegativeOrder = 2;
+ ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer));
+ ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
+ EXPECT_LENA; EXPECT_EQA;
+
format.LeadingZero = 1; /* Always provide leading zero */
STRINGSA(".5","$0.5");
ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer));
@@ -990,6 +1002,18 @@ static void test_GetNumberFormatA(void)
ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
EXPECT_LENA; EXPECT_EQA;
+ STRINGSA("235","235.0"); /* Grouping of a positive number */
+ format.Grouping = 3;
+ ret = GetNumberFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer));
+ ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
+ EXPECT_LENA; EXPECT_EQA;
+
+ STRINGSA("-235","-235.0"); /* Grouping of a negative number */
+ format.NegativeOrder = NEG_LEFT;
+ ret = GetNumberFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer));
+ ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
+ EXPECT_LENA; EXPECT_EQA;
+
format.LeadingZero = 1; /* Always provide leading zero */
STRINGSA(".5","0.5");
ret = GetNumberFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer));
More information about the wine-cvs
mailing list