From 8ec60b22b1d7c23cc5fb62f81e10f36f2bd92ab3 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 28 Feb 2016 19:58:41 +0200 Subject: [PATCH] Test the C locale options. Better be sure that the C locale have not thousand separator. --HG-- branch : feature --- src/test/ValentinaTest/tst_misc.cpp | 23 +++++++++++++++++++++++ src/test/ValentinaTest/tst_misc.h | 3 +++ 2 files changed, 26 insertions(+) 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) };