Added Unicode tests

This commit is contained in:
Edgar 2021-10-16 11:50:24 +02:00
parent de39303b65
commit a254d89311
5 changed files with 78 additions and 37 deletions

View File

@ -1,2 +1,2 @@
#!/bin/sh
xgettext -o test.pot -k_ -k"_LC:1c,2" -s -c --package-name=moFileReader test.cpp
xgettext -o test.pot -k"_L" -k"_LC:1c,2" -s -c --package-name=moFileReader --from-code=UTF-8 test.cpp

Binary file not shown.

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: moFileReader\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-12-13 14:39+0100\n"
"PO-Revision-Date: 2021-08-25 09:01+0000\n"
"POT-Creation-Date: 2021-10-16 11:52+0200\n"
"PO-Revision-Date: 2021-10-16 11:53+0200\n"
"Last-Translator: Edgar <Edgar@AnotherFoxGuy.com>\n"
"Language-Team: Dutch <https://weblate.anotherfoxguy.com/projects/"
"mofilereader/mofilereader/nl/>\n"
@ -17,53 +17,61 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.8\n"
"X-Generator: Poedit 3.0\n"
#: test.cpp:60
msgid ""
"De naam 'Omrop Fryslân' houdt in: Regionaal herkenbaar, actueel, "
"onafhankelijk, betrouwbaar, toegankelijk, vermakelijk en divers"
msgstr ""
"De namme Omrop Fryslân hâldt yn: regionaal werkenber, aktueel, "
"ûnôfhinklik, betrouber, tagonklik, ûnderhâldend en divers"
#: test.cpp:63
msgid "I 💚 Fryslân"
msgstr "Ik 💚 Friesland"
#: test.cpp:58
msgid ""
"Omrop Fryslân makket radio en telefyzje yn it Frysk, dêrmei is de omrop de "
"ienige stjoerder fan Nederlân dyt net yn it Nederlânsk útstjoert"
msgstr ""
"Omrop Fryslân maakt radio en televisie in het Fries, daarmee is de omroep de "
"enige zender van Nederland die niet in het Nederlanders uitzendt"
#. This is the first comment.
#: test.cpp:31
#: test.cpp:71
msgctxt "TEST|String|1"
msgid "String English"
msgstr "Text Nederlands Een"
#. This is the second comment.
#: test.cpp:33
#: test.cpp:73
msgctxt "TEST|String|2"
msgid "String English"
msgstr "Text Nederlands Twee"
#. This is the third comment.
#: test.cpp:35
#: test.cpp:75
msgctxt "TEST|String|3"
msgid "String English"
msgstr "Text Nederlands Drie"
#. This is the first comment.
#: test.cpp:19
#: test.cpp:46
msgid "String English One"
msgstr "Text Nederlands Een"
#. This is the third comment.
#: test.cpp:23
#: test.cpp:50
msgid "String English Three"
msgstr "Text Nederlands Drie"
#. This is the second comment.
#: test.cpp:21
#: test.cpp:48
msgid "String English Two"
msgstr "Text Nederlands Twee"
#~ msgctxt "TEST|String|1"
#~ msgid "String English One"
#~ msgstr "Text Nederlands Een"
#~ msgctxt "TEST|String|3"
#~ msgid "String English Three"
#~ msgstr "Text Nederlands Drie"
#~ msgctxt "TEST|String|2"
#~ msgid "String English Two"
#~ msgstr "Text Nederlands Twee"
#~ msgctxt "Menu|"
#~ msgid "File"
#~ msgstr "Bestand"
#: test.cpp:62
msgid "geändert ß"
msgstr "veranderd ß"

View File

@ -24,7 +24,7 @@ TEST_CASE("Count number of strings", "[Count]")
{
moFileReader moFR;
moFR.ReadFile(MO_TEST_FILE);
CHECK(7 == moFR.GetNumStrings());
CHECK(11 == moFR.GetNumStrings());
}
TEST_CASE("Empties the Lookup-Table", "[Count]")
@ -32,7 +32,7 @@ TEST_CASE("Empties the Lookup-Table", "[Count]")
moFileReader moFR;
moFR.ReadFile(MO_TEST_FILE);
CHECK("Text Nederlands Een" == moFR.Lookup("String English One"));
CHECK(7 == moFR.GetNumStrings());
CHECK(11 == moFR.GetNumStrings());
moFR.ClearTable();
CHECK("String English One" == moFR.Lookup("String English One"));
CHECK(0 == moFR.GetNumStrings());
@ -50,6 +50,19 @@ TEST_CASE("Lookup string", "[Lookup]")
CHECK("Text Nederlands Drie" == _L("String English Three"));
}
TEST_CASE("Lookup string with unicode", "[LookupUnicode]")
{
moFileReader moFR;
moFR.ReadFile(MO_TEST_FILE);
CHECK("Omrop Fryslân maakt radio en televisie in het Fries, daarmee is de omroep de enige zender van Nederland die niet in het Nederlanders uitzendt"
== _L("Omrop Fryslân makket radio en telefyzje yn it Frysk, dêrmei is de omrop de ienige stjoerder fan Nederlân dyt net yn it Nederlânsk útstjoert"));
CHECK("De namme Omrop Fryslân hâldt yn: regionaal werkenber, aktueel, ûnôfhinklik, betrouber, tagonklik, ûnderhâldend en divers"
== _L("De naam 'Omrop Fryslân' houdt in: Regionaal herkenbaar, actueel, onafhankelijk, betrouwbaar, toegankelijk, vermakelijk en divers"));
CHECK("Bûter, brea en brûne sûker" == moFR.Lookup("Bûter, brea en brûne sûker"));
CHECK("veranderd ß" == _L("geändert ß"));
CHECK("Ik 💚 Friesland" == _L("I 💚 Fryslân"));
}
TEST_CASE("Lookup string with context", "[LookupWithContext]")
{
moFileReader moFR;
@ -74,6 +87,6 @@ TEST_CASE("Lookup not existing strings with context", "[LookupWithContext-fail]"
{
moFileReader moFR;
moFR.ReadFile(MO_TEST_FILE);
CHECK("String English" == _LC("Nope", "String English"));
CHECK("Not this one" == _LC("TEST|String|1", "Not this one"));
CHECK("String English" == moFR.LookupWithContext("Nope", "String English"));
CHECK("Not this one" == moFR.LookupWithContext("TEST|String|1", "Not this one"));
}

View File

@ -8,44 +8,64 @@ msgid ""
msgstr ""
"Project-Id-Version: moFileReader\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-12-13 14:39+0100\n"
"POT-Creation-Date: 2021-10-16 11:52+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: test.cpp:60
msgid ""
"De naam 'Omrop Fryslân' houdt in: Regionaal herkenbaar, actueel, "
"onafhankelijk, betrouwbaar, toegankelijk, vermakelijk en divers"
msgstr ""
#: test.cpp:63
msgid "I 💚 Fryslân"
msgstr ""
#: test.cpp:58
msgid ""
"Omrop Fryslân makket radio en telefyzje yn it Frysk, dêrmei is de omrop de "
"ienige stjoerder fan Nederlân dyt net yn it Nederlânsk útstjoert"
msgstr ""
#. This is the first comment.
#: test.cpp:31
#: test.cpp:71
msgctxt "TEST|String|1"
msgid "String English"
msgstr ""
#. This is the second comment.
#: test.cpp:33
#: test.cpp:73
msgctxt "TEST|String|2"
msgid "String English"
msgstr ""
#. This is the third comment.
#: test.cpp:35
#: test.cpp:75
msgctxt "TEST|String|3"
msgid "String English"
msgstr ""
#. This is the first comment.
#: test.cpp:19
#: test.cpp:46
msgid "String English One"
msgstr ""
#. This is the third comment.
#: test.cpp:23
#: test.cpp:50
msgid "String English Three"
msgstr ""
#. This is the second comment.
#: test.cpp:21
#: test.cpp:48
msgid "String English Two"
msgstr ""
#: test.cpp:62
msgid "geändert ß"
msgstr ""