[kmymoney] [Bug 491828] Currency settings show incorrect

Ralf Habacker bugzilla_noreply at kde.org
Fri Aug 23 08:20:23 BST 2024


https://bugs.kde.org/show_bug.cgi?id=491828

--- Comment #19 from Ralf Habacker <ralf.habacker at freenet.de> ---
Created attachment 172871
  --> https://bugs.kde.org/attachment.cgi?id=172871&action=edit
QLocale testcase source

Since kmymoney uses QLocale for formatting currency amounts, I created a
Qt-only test case to see if the problem exists in the Qt library.

The result is that the tests performed on native Linux, Linux with Wine and
native Windows 10 produce identical results.

$  test-qlocale-tocurrencystring/build-linux/testqlocaletocurrencystring
********* Start testing of QLocaleTest *********
Config: Using QtTest library 5.15.8, Qt 5.15.8 (x86_64-little_endian-lp64
shared (dynamic) release build; by GCC 7.5.0), opensuse-leap 15.5
PASS   : QLocaleTest::initTestCase()
PASS   : QLocaleTest::TestToCurrencyString()
PASS   : QLocaleTest::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped, 0 blacklisted, 1ms
********* Finished testing of QLocaleTest *********

 $ wine build/testqlocaletocurrencystring.exe 
********* Start testing of QLocaleTest *********
Config: Using QtTest library 5.15.14, Qt 5.15.14 (i386-little_endian-ilp32
shared (dynamic) release build; by GCC 13.
2.0), windows 10
PASS   : QLocaleTest::initTestCase()
PASS   : QLocaleTest::testToCurrencyString()
PASS   : QLocaleTest::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped, 0 blacklisted, 52ms
********* Finished testing of QLocaleTest *********

W:\src\test-qt5\test-qlocale-toCurrencyString\build>
testqlocaletocurrencystring.exe
********* Start testing of QLocaleTest *********
Config: Using QtTest library 5.15.14, Qt 5.15.14 (i386-little_endian-ilp32
shared (dynamic) release build; by GCC 13.2.0), windows 10
PASS   : QLocaleTest::initTestCase()
PASS   : QLocaleTest::TestToCurrencyString()
PASS   : QLocaleTest::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped, 0 blacklisted, 4ms
********* Finished testing of QLocaleTest *********

For the output of the smallest part of virtual currencies, such as
cryptocurrencies, there is a flaw in the method used.

QString QLocale::toCurrencyString(double value, const QString &symbol, int
precision)

If the value for the parameter symbol is NULL, QString() or QString(""), a
currency symbol is always output in the default currency of the relevant locale
(and this is also different, e.g. in the last two cases '€' or 'EUR' is used
for 'de_DE'), which is inappropriate for outputting the smallest part of
virtual currencies such as cryptocurrencies. 

If no output of a currency symbol is desired, a workaround is to use QString("
") as the parameter (see the last 3 tests in the test case).

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the KMyMoney-devel mailing list