kernel32: Fix GetCurrencyFormat grouping.

This commit is contained in:
Viliam Lejcik 2009-11-09 10:41:54 +01:00 committed by Alexandre Julliard
parent 937fd39894
commit 3dc8b28d84
2 changed files with 25 additions and 1 deletions

View File

@ -1521,7 +1521,7 @@ GetCurrencyFormatW_Error:
dwState |= NF_DIGITS_OUT; dwState |= NF_DIGITS_OUT;
dwCurrentGroupCount++; dwCurrentGroupCount++;
if (szSrc >= lpszValue && dwCurrentGroupCount == dwGroupCount) if (szSrc >= lpszValue && dwCurrentGroupCount == dwGroupCount && *szSrc != '-')
{ {
LPWSTR lpszGrp = lpFormat->lpThousandSep + strlenW(lpFormat->lpThousandSep) - 1; LPWSTR lpszGrp = lpFormat->lpThousandSep + strlenW(lpFormat->lpThousandSep) - 1;

View File

@ -743,6 +743,18 @@ static void test_GetCurrencyFormatA(void)
ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError()); ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
EXPECT_LENA; EXPECT_EQA; 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 */ format.LeadingZero = 1; /* Always provide leading zero */
STRINGSA(".5","$0.5"); STRINGSA(".5","$0.5");
ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); 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()); ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError());
EXPECT_LENA; EXPECT_EQA; 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 */ format.LeadingZero = 1; /* Always provide leading zero */
STRINGSA(".5","0.5"); STRINGSA(".5","0.5");
ret = GetNumberFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); ret = GetNumberFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer));