diff --git a/src/test/ValentinaTest/tst_misc.cpp b/src/test/ValentinaTest/tst_misc.cpp index f5b4ff4f0..fb979ca53 100644 --- a/src/test/ValentinaTest/tst_misc.cpp +++ b/src/test/ValentinaTest/tst_misc.cpp @@ -130,3 +130,26 @@ void TST_Misc::TestAbsoluteFilePath() const QString result = AbsoluteMPath(patternPath, relativeMPath); QCOMPARE(output, result); } + +//--------------------------------------------------------------------------------------------------------------------- +void TST_Misc::TestCLocale_data() +{ + QTest::addColumn("number"); + QTest::addColumn("expected"); + + QTest::newRow("10000") << 10000.0 << "10000"; + QTest::newRow("10000.5") << 10000.5 << "10000.5"; +} + +//--------------------------------------------------------------------------------------------------------------------- +// Need for testing thousand separator in the C locale. +// Better be sure that the C locale have not thousand separator +void TST_Misc::TestCLocale() +{ + QFETCH(qreal, number); + QFETCH(QString, expected); + + const QString localized = QString().number(number); + + QCOMPARE(localized, expected); +} diff --git a/src/test/ValentinaTest/tst_misc.h b/src/test/ValentinaTest/tst_misc.h index 61455a655..14f76cd47 100644 --- a/src/test/ValentinaTest/tst_misc.h +++ b/src/test/ValentinaTest/tst_misc.h @@ -44,6 +44,9 @@ private slots: void TestAbsoluteFilePath_data(); void TestAbsoluteFilePath(); + void TestCLocale_data(); + void TestCLocale(); + private: Q_DISABLE_COPY(TST_Misc) };