Skip to content

Commit

Permalink
Tests: skip test cases more related to ICU than mlocale
Browse files Browse the repository at this point in the history
Many test cases verify ICU does its job as expected. This is not our
focus nowadays while it requires to update testcases whenever ICU
changes (as ICU continuously improves its job especially in case of
"exotic" languages).

This commit excludes those test cases where such changes can be
expected. Full test set can be included by #defining
ALSO_VERIFY_ICU_DOES_ITS_JOB_AS_WE_EXPECT

My aim was to (1) have the patch as compact as possible while (2) having
the limited test set as the default configuration - hence the inversed
pattern which the reader's eyes quicky adapt to IMO :)

Signed-off-by: Martin Kampas <martin.kampas@tieto.com>
  • Loading branch information
martyone committed Dec 4, 2014
1 parent 0119285 commit 33aef48
Show file tree
Hide file tree
Showing 8 changed files with 532 additions and 2 deletions.
9 changes: 9 additions & 0 deletions tests/ft_breakiterator/ft_breakiterator.cpp
Expand Up @@ -60,6 +60,15 @@ void defaultData()
QTest::addColumn<QString>("sourceString");
QTest::addColumn<QList<int> >("correctBoundaries");

#if !defined(ALSO_VERIFY_ICU_DOES_ITS_JOB_AS_WE_EXPECT)
QTest::newRow("en_GB")
<< QString("en_GB")
<< MBreakIterator::WordIterator
<< "This is a simple sentence. Täst."
<< (QList<int> ()<< 0 << 4 << 5 << 7 << 8 << 9 << 10 << 16 << 17 << 25 << 26 << 27 << 31 << 32);
return;
#endif

// an empty locale_name should be equivalent to the locale_name "en_US_POSIX"
QTest::newRow("")
<< QString("")
Expand Down
95 changes: 95 additions & 0 deletions tests/ft_locales/ft_locales.cpp
Expand Up @@ -593,6 +593,16 @@ void Ft_Locales::testMLocaleLanguageEndonym_data()
QTest::addColumn<QString>("locale_name");
QTest::addColumn<QString>("endonym_result");

#if !defined(ALSO_VERIFY_ICU_DOES_ITS_JOB_AS_WE_EXPECT)
QTest::newRow("en_GB")
<< QString("en_GB")
<< QString("English (United Kingdom)");
QTest::newRow("en_US")
<< QString("en_US")
<< QString("English (United States)");
return;
#endif

QTest::newRow("ar")
<< QString("ar")
<< QString("العربية");
Expand Down Expand Up @@ -795,6 +805,16 @@ void Ft_Locales::testMLocaleCountryEndonym_data()
QTest::addColumn<QString>("locale_name");
QTest::addColumn<QString>("endonym_result");

#if !defined(ALSO_VERIFY_ICU_DOES_ITS_JOB_AS_WE_EXPECT)
QTest::newRow("en_GB")
<< QString("en_GB")
<< QString("United Kingdom");
QTest::newRow("en_US")
<< QString("en_US")
<< QString("United States");
return;
#endif

QTest::newRow("fi_FI")
<< QString("fi_FI")
<< QString("Suomi");
Expand Down Expand Up @@ -831,6 +851,16 @@ void Ft_Locales::testMLocaleLocaleScripts_data()
QTest::addColumn<QString>("localeName");
QTest::addColumn<QStringList>("localeScripts");

#if !defined(ALSO_VERIFY_ICU_DOES_ITS_JOB_AS_WE_EXPECT)
QTest::newRow("en_GB")
<< QString("en_GB")
<< (QStringList () << "Latn");
QTest::newRow("ru_RU")
<< QString("ru_RU")
<< (QStringList () << "Cyrl");
return;
#endif

QTest::newRow("fi_FI")
<< QString("fi_FI")
<< (QStringList () << "Latn");
Expand Down Expand Up @@ -887,6 +917,24 @@ void Ft_Locales::testMLocaleToLower_data()
QTest::addColumn<QString>("expectedMLocale");
QTest::addColumn<QString>("expectedQt");

#if !defined(ALSO_VERIFY_ICU_DOES_ITS_JOB_AS_WE_EXPECT)
QTest::newRow("en_GB")
<< QString("en_GB")
<< QString("Big")
<< QString("big")
<< QString("big")
;

QTest::newRow("de_DE")
<< QString("de_DE")
<< QString("Größe")
<< QString("größe")
<< QString("größe")
;

return;
#endif

QTest::newRow("de_DE")
<< QString("de_DE")
<< QString("Größe")
Expand Down Expand Up @@ -1149,6 +1197,24 @@ void Ft_Locales::testMLocaleToUpper_data()
QTest::addColumn<QString>("expectedMLocale");
QTest::addColumn<QString>("expectedQt");

#if !defined(ALSO_VERIFY_ICU_DOES_ITS_JOB_AS_WE_EXPECT)
QTest::newRow("en_GB")
<< QString("en_GB")
<< QString("Big")
<< QString("BIG")
<< QString("BIG")
;

QTest::newRow("de_DE")
<< QString("de_DE")
<< QString("Größe")
<< QString("GRÖSSE")
<< QString("GRÖSSE")
;

return;
#endif

QTest::newRow("de_DE")
<< QString("de_DE")
<< QString("Größe")
Expand Down Expand Up @@ -1362,6 +1428,35 @@ void Ft_Locales::testMLocaleIndexBucket_data()
QTest::addColumn<QStringList>("stringsSorted");
QTest::addColumn<QStringList>("expectedBuckets");

#if !defined(ALSO_VERIFY_ICU_DOES_ITS_JOB_AS_WE_EXPECT)
QStringList basicEnglishStringsSorted =
(QStringList()
<<"ç"<<"Ç"<<"cote"<<"coté"<<"côte"<<"côté"
<<"f"<<"F"<<"ff"<<""<<"Ff"<<"ffi"<<""<<"Ffi"<<""<<""<<""
<<"i"<<"I"<<"ï"<<"Ï"<<"İ"<<"ı"
<<"ö"<<"Ö"<<"öe"<<"Öe"<<"ÖE"
<<"s"<<"S"<<"ſ"<<"ß"<<""
<<"test"<<"Test"
<<"z"<<"Z"<<"zx"<<"Zx"<<"ZX"
);
QStringList basicEnglishExpectedBuckets =
(QStringList()
<<"C"<<"C"<<"C"<<"C"<<"C"<<"C"
<<"F"<<"F"<<"F"<<"F"<<"F"<<"F"<<"F"<<"F"<<"F"<<"F"<<"F"
<<"I"<<"I"<<"I"<<"I"<<"I"<<"I"
<<"O"<<"O"<<"O" <<"O" <<"O"
<<"S"<<"S"<<"S"<<"S"<<"S"
<<"T"<<"T"
<<"Z"<<"Z"<<"Z"<<"Z"<<"Z"
);
QTest::newRow("en_US")
<<"ja_JP"
<<"en_US"
<< basicEnglishStringsSorted
<< basicEnglishExpectedBuckets;
return;
#endif

QStringList englishStringsSorted =
(QStringList()
<<"ç"<<"Ç"<<"cote"<<"coté"<<"côte"<<"côté"
Expand Down
28 changes: 28 additions & 0 deletions tests/ft_mcharsetdetector/ft_mcharsetdetector.cpp
Expand Up @@ -281,6 +281,34 @@ void Ft_MCharsetDetector::testDetection_data()
QTest::addColumn<QString>("bestMatchName");
QTest::addColumn<QString>("bestMatchLanguage");

#if !defined(ALSO_VERIFY_ICU_DOES_ITS_JOB_AS_WE_EXPECT)
QTest::newRow("Short German UTF-8")
<< "Grüße"
<< ""
<< ""
<< false
<< "UTF-8"
<< "UTF-8"
<< "";
QTest::newRow("Short German Latin1")
<< "Grüße"
<< ""
<< "ISO-8859-1" // declared encoding, makes it work
<< false
<< "ISO-8859-1"
<< "ISO-8859-1"
<< "";
QTest::newRow("Short German Latin1")
<< "Grüße"
<< "de" // declared locale, makes it work
<< ""
<< false
<< "ISO-8859-1"
<< "ISO-8859-1"
<< "de";
return;
#endif

QString longGerman("Als Menschenrechte werden subjektive Rechte bezeichnet, die jedem Menschen gleichermaßen zustehen. Das Konzept der Menschenrechte geht davon aus, dass alle Menschen allein aufgrund ihres Menschseins[1] mit gleichen Rechten ausgestattet und dass diese egalitär begründeten Rechte universell, unveräußerlich und unteilbar sind. Die Idee der Menschenrechte ist eng verbunden mit dem Humanismus und der im Zeitalter der Aufklärung entwickelten Idee des Naturrechts.");
QTest::newRow("Long German UTF-8")
<< longGerman
Expand Down
8 changes: 6 additions & 2 deletions tests/ft_mlocalebuckets/ft_mlocalebuckets.h
Expand Up @@ -36,11 +36,15 @@ private slots:
void cleanupTestCase();
void initTestCase();
void testEnglishGrouping();
void testRemove();
void testCopy();

#if !defined(ALSO_VERIFY_ICU_DOES_ITS_JOB_AS_WE_EXPECT)
private:
#endif
void testChinesePinyinGrouping();
void testGermanPhonebookGrouping();
void testCzechGrouping();
void testRemove();
void testCopy();

void sortTestFiles_data();
void sortTestFiles();
Expand Down
15 changes: 15 additions & 0 deletions tests/ft_mstringsearch/ft_mstringsearch.cpp
Expand Up @@ -104,6 +104,21 @@ void Ft_MStringSearch::testSearch_data()
QTest::addColumn<QList<int> >("matchLengths");
QTest::addColumn<QStringList>("matchTexts");

#if !defined(ALSO_VERIFY_ICU_DOES_ITS_JOB_AS_WE_EXPECT)
QTest::newRow("English en_GB")
<< "en_GB"
<< "en_GB"
<< "aa"
<< "Hello Aalto and Åse áá!"
<< MBreakIterator::CharacterIterator
<< MLocale::CollatorStrengthPrimary
<< true
<< (QList<int> () << 6 << 20)
<< (QList<int> () << 2 << 2)
<< (QStringList() << "Aa" << "áá");
return;
#endif

QTest::newRow("Danish da_DK")
<< "da_DK"
<< "da_DK"
Expand Down

0 comments on commit 33aef48

Please sign in to comment.