Test the C locale options. Better be sure that the C locale have not thousand

separator.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-02-28 19:58:41 +02:00
parent 8d628404df
commit 8ec60b22b1
2 changed files with 26 additions and 0 deletions

View File

@ -130,3 +130,26 @@ void TST_Misc::TestAbsoluteFilePath()
const QString result = AbsoluteMPath(patternPath, relativeMPath); const QString result = AbsoluteMPath(patternPath, relativeMPath);
QCOMPARE(output, result); QCOMPARE(output, result);
} }
//---------------------------------------------------------------------------------------------------------------------
void TST_Misc::TestCLocale_data()
{
QTest::addColumn<qreal>("number");
QTest::addColumn<QString>("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);
}

View File

@ -44,6 +44,9 @@ private slots:
void TestAbsoluteFilePath_data(); void TestAbsoluteFilePath_data();
void TestAbsoluteFilePath(); void TestAbsoluteFilePath();
void TestCLocale_data();
void TestCLocale();
private: private:
Q_DISABLE_COPY(TST_Misc) Q_DISABLE_COPY(TST_Misc)
}; };