From 06eb7c3b75b6f3613a1f63cc135169254a5bd535 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 25 Oct 2016 19:11:26 +0300 Subject: [PATCH] Improve translation test for supporting Greek language. The '?' in Greek language is ';'. --HG-- branch : develop --- .../TranslationsTest/tst_tstranslation.cpp | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/test/TranslationsTest/tst_tstranslation.cpp b/src/test/TranslationsTest/tst_tstranslation.cpp index 584ba82d0..2d0c76a7d 100644 --- a/src/test/TranslationsTest/tst_tstranslation.cpp +++ b/src/test/TranslationsTest/tst_tstranslation.cpp @@ -302,6 +302,7 @@ void TST_TSTranslation::TestPunctuation_data() QVERIFY2(locales.size() == fileNames.size()-1, "Unexpected count of files."); } + QTest::addColumn("locale"); QTest::addColumn("source"); QTest::addColumn("translation"); @@ -342,7 +343,7 @@ void TST_TSTranslation::TestPunctuation_data() } const QString message = QString("File '%1'.").arg(filename); - QTest::newRow(qUtf8Printable(message)) << source << translation; + QTest::newRow(qUtf8Printable(message)) << locales.at(j) << source << translation; } else { @@ -356,6 +357,7 @@ void TST_TSTranslation::TestPunctuation_data() //--------------------------------------------------------------------------------------------------------------------- void TST_TSTranslation::TestPunctuation() { + QFETCH(QString, locale); QFETCH(QString, source); QFETCH(QString, translation); @@ -364,21 +366,29 @@ void TST_TSTranslation::TestPunctuation() << QLatin1String(" ") << QLatin1String("\n") << QLatin1String("!") - << QLatin1String("?"); + << QLatin1String("?") + << QLatin1String(";"); bool testFail = false; - QChar c = source.at(source.length()-1); - if (punctuation.contains(c)) + const QChar cSource = source.at(source.length()-1); + QChar cPunctuation = cSource; + const QChar cTranslation = translation.at(translation.length()-1); + if (punctuation.contains(cSource)) { - if (not (source.endsWith(c) && translation.endsWith(c))) + if (not translation.endsWith(cSource)) { testFail = true; + + if (locale == QLatin1String("el_GR") && cSource == QLatin1Char('?') && cTranslation == QLatin1Char(';')) + { + testFail = false; + } } } else { - c = translation.at(translation.length()-1); - if (punctuation.contains(c)) + if (punctuation.contains(cTranslation)) { + cPunctuation = cTranslation; testFail = true; } } @@ -386,7 +396,7 @@ void TST_TSTranslation::TestPunctuation() if (testFail) { const QString message = QString("Translation string does not end with the same punctuation character '%1' or " - "vice versa. ").arg(c) + QString("Original name:'%1'").arg(source) + + "vice versa. ").arg(cPunctuation) + QString("Original name:'%1'").arg(source) + QString(", translated name:'%1'").arg(translation); QFAIL(qUtf8Printable(message)); }