[office/kmymoney/5.2] kmymoney/widgets/tests: Fix testcase

Thomas Baumgart <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 48bcbb095ac1d159b297f3f2e67839242d4934a4 by Thomas Baumgart.
Committed on 26/07/2026 at 06:24.
Pushed by tbaumgart into branch '5.2'.

Fix testcase

AmountValidator sets its locale based on the LC_MONETARY environment
variable so we have to tweak that here, otherwise AmountValidator will
use the system value

(cherry picked from commit bdbb71c2195bbd5d0efde910cdc844f2db8792e7)

M  +4    -0    kmymoney/widgets/tests/amountvalidator-test.cpp

https://invent.kde.org/office/kmymoney/-/commit/48bcbb095ac1d159b297f3f2e67839242d4934a4

diff --git a/kmymoney/widgets/tests/amountvalidator-test.cpp b/kmymoney/widgets/tests/amountvalidator-test.cpp
index 82d5b6a2d..8a9608a41 100644
--- a/kmymoney/widgets/tests/amountvalidator-test.cpp
+++ b/kmymoney/widgets/tests/amountvalidator-test.cpp
@@ -109,6 +109,10 @@ void AmountValidatorTest::testValidator()
                           .arg(locale, QLocale().groupSeparator(), groupSeparator);
         QSKIP(msg.toLatin1());
     }
+
+    // AmountValidator sets its locale based on the LC_MONETARY environment variable
+    // so we have to tweak that here, otherwise AmountValidator will use the system value
+    qputenv("LC_MONETARY", locale.toLatin1());
     AmountValidator m(nullptr);
     int pos = inputValue.length();
     // QCOMPARE(m->validate(inputValue, pos), static_cast<QValidator::State>(result));
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.