summaryrefslogtreecommitdiffstats
path: root/tests/auto/linguist/lconvert
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/linguist/lconvert')
-rw-r--r--tests/auto/linguist/lconvert/data/codec-cp1252.ts28
-rw-r--r--tests/auto/linguist/lconvert/data/codec-utf8.ts28
-rw-r--r--tests/auto/linguist/lconvert/data/dual-encoding.ts11
-rw-r--r--tests/auto/linguist/lconvert/data/endless-po-loop.ts16
-rwxr-xr-xtests/auto/linguist/lconvert/data/makeplurals.sh43
-rw-r--r--tests/auto/linguist/lconvert/data/msgid.ts27
-rw-r--r--tests/auto/linguist/lconvert/data/plurals-cn.ts17
-rw-r--r--tests/auto/linguist/lconvert/data/plurals-de.ts18
-rw-r--r--tests/auto/linguist/lconvert/data/relative.ts74
-rw-r--r--tests/auto/linguist/lconvert/data/singular.po42
-rw-r--r--tests/auto/linguist/lconvert/data/test-broken-utf8.po9
-rw-r--r--tests/auto/linguist/lconvert/data/test-broken-utf8.po.out9
-rw-r--r--tests/auto/linguist/lconvert/data/test-developer-comment.po23
-rw-r--r--tests/auto/linguist/lconvert/data/test-empty-comment.po24
-rw-r--r--tests/auto/linguist/lconvert/data/test-escapes.po11
-rw-r--r--tests/auto/linguist/lconvert/data/test-escapes.po.out13
-rw-r--r--tests/auto/linguist/lconvert/data/test-kde-ctxt.po25
-rw-r--r--tests/auto/linguist/lconvert/data/test-kde-fuzzy.po31
-rw-r--r--tests/auto/linguist/lconvert/data/test-kde-multiline.po32
-rw-r--r--tests/auto/linguist/lconvert/data/test-kde-plurals.po27
-rw-r--r--tests/auto/linguist/lconvert/data/test-slurp.po19
-rw-r--r--tests/auto/linguist/lconvert/data/test-slurp.po.out19
-rw-r--r--tests/auto/linguist/lconvert/data/test-translator-comment.po41
-rw-r--r--tests/auto/linguist/lconvert/data/test1-cn.po67
-rw-r--r--tests/auto/linguist/lconvert/data/test1-de.po75
-rw-r--r--tests/auto/linguist/lconvert/data/test11.ts32
-rw-r--r--tests/auto/linguist/lconvert/data/test20.ts150
-rw-r--r--tests/auto/linguist/lconvert/data/variants.ts24
-rw-r--r--tests/auto/linguist/lconvert/data/wrapping.po58
-rw-r--r--tests/auto/linguist/lconvert/lconvert.pro8
-rw-r--r--tests/auto/linguist/lconvert/tst_lconvert.cpp341
31 files changed, 1342 insertions, 0 deletions
diff --git a/tests/auto/linguist/lconvert/data/codec-cp1252.ts b/tests/auto/linguist/lconvert/data/codec-cp1252.ts
new file mode 100644
index 0000000..5ffa2f3
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/codec-cp1252.ts
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0">
+<defaultcodec>windows-1252</defaultcodec>
+<context>
+ <name>FooBar</name>
+ <message>
+ <location filename="main.cpp" line="10"/>
+ <source>random ascii only</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="11"/>
+ <source>this contains an umlaut ü &amp;uuml;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="12"/>
+ <source>random ascii only in utf8</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message utf8="true">
+ <location filename="main.cpp" line="13"/>
+ <source>umlaut ü &amp;uuml; in utf8</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lconvert/data/codec-utf8.ts b/tests/auto/linguist/lconvert/data/codec-utf8.ts
new file mode 100644
index 0000000..0ebdbfd
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/codec-utf8.ts
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0">
+<defaultcodec>UTF-8</defaultcodec>
+<context>
+ <name>FooBar</name>
+ <message>
+ <location filename="main.cpp" line="10"/>
+ <source>random ascii only</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="11"/>
+ <source>this contains an umlaut ü &amp;uuml;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="12"/>
+ <source>random ascii only in utf8</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="13"/>
+ <source>umlaut ü &amp;uuml; in utf8</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lconvert/data/dual-encoding.ts b/tests/auto/linguist/lconvert/data/dual-encoding.ts
new file mode 100644
index 0000000..5023a04
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/dual-encoding.ts
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0">
+<context>
+ <name></name>
+ <message utf8="both">
+ <source>Mühsam</source>
+ <translation>tedious</translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lconvert/data/endless-po-loop.ts b/tests/auto/linguist/lconvert/data/endless-po-loop.ts
new file mode 100644
index 0000000..6212fbd
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/endless-po-loop.ts
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="de">
+<context>
+ <name>Assistant</name>
+ <message>
+ <source>This is some text which introduces the DonauDampfSchifffahrtsKapitaensMuetzeMitKomischenUltraViolettenFransenUndEinemKnopf</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location filename="this/is/a/really/really/absurdly/no,/grotesquely/long/path/supposed/to/blow/up.cpp" line="20"/>
+ <source>%n document(s) found.</source>
+ <translation></translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lconvert/data/makeplurals.sh b/tests/auto/linguist/lconvert/data/makeplurals.sh
new file mode 100755
index 0000000..2e0f375
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/makeplurals.sh
@@ -0,0 +1,43 @@
+#! /bin/bash
+
+function makeit2()
+{
+ for ((i = 0; i < (1 << $1); i++)); do
+ echo
+ test -n "$3" && echo "$3"
+ echo "msgid \"singular $2 $i\""
+ echo "msgid_plural \"plural $2 $i\""
+ for ((j = 0; j < $1; j++)); do
+ tr=
+ if test $((i & (1 << j))) = 0; then
+ tr="translated $2 $i $j"
+ fi
+ echo "msgstr[$j] \"$tr\""
+ done
+ done
+}
+
+function makeit()
+{
+ {
+ cat <<EOF
+msgid ""
+msgstr ""
+"X-FooBar: yup\n"
+"X-Language: $2\n"
+EOF
+ makeit2 $1 one ""
+ makeit2 $1 two "#, fuzzy
+#| msgid \"old untranslated one\""
+ makeit2 $1 three "#, fuzzy
+#| msgid \"old untranslated two\"
+#| msgid_plural \"old untranslated plural two\""
+ makeit2 $1 four "#, fuzzy
+#| msgid_plural \"old untranslated only plural three\""
+ } > ${OUTDIR}plural-$1.po
+}
+
+OUTDIR=$1
+makeit 1 zh_CN
+makeit 2 de_DE
+makeit 3 pl_PL
diff --git a/tests/auto/linguist/lconvert/data/msgid.ts b/tests/auto/linguist/lconvert/data/msgid.ts
new file mode 100644
index 0000000..ab65845
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/msgid.ts
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" sourcelanguage="en">
+<context>
+ <name>Dialog2</name>
+ <message numerus="yes">
+ <source>%n files</source>
+ <translation>
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message id="this_is_some_id" numerus="yes">
+ <source>%n cars</source>
+ <translation>
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message>
+ <source>Age: %1</source>
+ <translation></translation>
+ </message>
+ <message id="this_is_another_id">
+ <source>func3</source>
+ <translation></translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lconvert/data/plurals-cn.ts b/tests/auto/linguist/lconvert/data/plurals-cn.ts
new file mode 100644
index 0000000..966ec77
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/plurals-cn.ts
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="cn">
+<context>
+ <name>Assistant</name>
+ <message>
+ <source>Source</source>
+ <translation>Translation</translation>
+ </message>
+ <message numerus="yes">
+ <source>%n document(s) found.</source>
+ <translation>
+ <numerusform>1 Dokument gefunden.</numerusform>
+ </translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lconvert/data/plurals-de.ts b/tests/auto/linguist/lconvert/data/plurals-de.ts
new file mode 100644
index 0000000..6cbadff
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/plurals-de.ts
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="de">
+<context>
+ <name>Assistant</name>
+ <message>
+ <source>Not plural</source>
+ <translation>Kein plural</translation>
+ </message>
+ <message numerus="yes">
+ <source>%n document(s) found.</source>
+ <translation>
+ <numerusform>1 Dokument gefunden.</numerusform>
+ <numerusform>%n Dokumente gefunden.</numerusform>
+ </translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lconvert/data/relative.ts b/tests/auto/linguist/lconvert/data/relative.ts
new file mode 100644
index 0000000..b8eaaca
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/relative.ts
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0">
+<context>
+ <name>Foo</name>
+ <message>
+ <location filename="foo.cpp" line="+13"/>
+ <source>This is the first entry.</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location line="+0"/>
+ <source>And a second one on the same line.</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location line="+2"/>
+ <source>This tr is new.</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <location line="+16"/>
+ <source>This one moved in from another file.</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location line="-2"/>
+ <source>Just as this one.</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <location filename="bar.cpp" line="+100"/>
+ <source>Another alien.</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location line="+4"/>
+ <source>They are coming!</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>They are everywhere!</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location filename="bar.cpp" line="+20"/>
+ <source>An earthling again.</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location line="-5"/>
+ <source>This is from the bottom, too.</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Third string from the bottom.</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Fourth one!</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location line="-9"/>
+ <source>This string did move from the bottom.</source>
+ <translation></translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lconvert/data/singular.po b/tests/auto/linguist/lconvert/data/singular.po
new file mode 100644
index 0000000..a0d4019
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/singular.po
@@ -0,0 +1,42 @@
+msgid ""
+msgstr ""
+
+msgid "untranslated one"
+msgstr "translated"
+
+#, fuzzy
+#| msgid "old untranslated"
+msgid "untranslated two"
+msgstr "translated"
+
+#, fuzzy
+#| msgid "old untranslated"
+msgid "untranslated two b"
+msgstr ""
+
+#, fuzzy
+#| msgid "old untranslated"
+#| msgid_plural "old untranslated plural"
+msgid "untranslated three"
+msgstr "translated"
+
+#, fuzzy
+#| msgid "old untranslated"
+#| msgid_plural "old untranslated plural"
+msgid "untranslated three b"
+msgstr ""
+
+#, fuzzy
+#| msgid_plural "old untranslated only plural"
+msgid "untranslated four"
+msgstr "translated"
+
+#, fuzzy
+#| msgid_plural "old untranslated only plural"
+msgid "untranslated four b"
+msgstr ""
+
+#, fuzzy
+#| msgctxt "old context"
+msgid "untranslated five"
+msgstr "translated"
diff --git a/tests/auto/linguist/lconvert/data/test-broken-utf8.po b/tests/auto/linguist/lconvert/data/test-broken-utf8.po
new file mode 100644
index 0000000..20b58a0
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/test-broken-utf8.po
@@ -0,0 +1,9 @@
+# no comment
+msgid ""
+msgstr ""
+
+msgid "this works"
+msgstr "das geht: ä"
+
+msgid "this is broken"
+msgstr "das ist kaputt: i"
diff --git a/tests/auto/linguist/lconvert/data/test-broken-utf8.po.out b/tests/auto/linguist/lconvert/data/test-broken-utf8.po.out
new file mode 100644
index 0000000..c00fd19
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/test-broken-utf8.po.out
@@ -0,0 +1,9 @@
+# no comment
+msgid ""
+msgstr ""
+
+msgid "this works"
+msgstr "das geht: ä"
+
+msgid "this is broken"
+msgstr "das ist kaputt: i"
diff --git a/tests/auto/linguist/lconvert/data/test-developer-comment.po b/tests/auto/linguist/lconvert/data/test-developer-comment.po
new file mode 100644
index 0000000..787f312
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/test-developer-comment.po
@@ -0,0 +1,23 @@
+# translation of kdmgreet.po to zh_CN
+# Simp. Chinese Translation for kdmgreet.
+# Copyright (C) 2001,2003 Free Software Foundation, Inc.
+# Gou Zhuang <gouzhuang@bigfoot.com>, 2001.
+# Xiong Jiang <jxiong@offtopic.org>, 2003.
+# Yan Shuangchun <yahzee@d3eye.com>, 2003.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: kdmgreet\n"
+"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
+"POT-Creation-Date: 2008-04-28 18:47+0200\n"
+"PO-Revision-Date: 2008-04-22 16:56+0800\n"
+"Last-Translator: Lie_Ex <lilith.ex@gmail.com>\n"
+"Language-Team: zh_CN <kde-china@kde.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+
+#. I'm a clever developer. Right? Uhm ...
+msgid "User %u will log in in %t"
+msgstr "用户 %u 将在 %t 秒后登录"
diff --git a/tests/auto/linguist/lconvert/data/test-empty-comment.po b/tests/auto/linguist/lconvert/data/test-empty-comment.po
new file mode 100644
index 0000000..ce74c46
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/test-empty-comment.po
@@ -0,0 +1,24 @@
+# translation of kdmgreet.po to zh_CN
+# Simp. Chinese Translation for kdmgreet.
+# Copyright (C) 2001,2003 Free Software Foundation, Inc.
+# Gou Zhuang <gouzhuang@bigfoot.com>, 2001.
+# Xiong Jiang <jxiong@offtopic.org>, 2003.
+# Yan Shuangchun <yahzee@d3eye.com>, 2003.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: kdmgreet\n"
+"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
+"POT-Creation-Date: 2008-04-28 18:47+0200\n"
+"PO-Revision-Date: 2008-04-22 16:56+0800\n"
+"Last-Translator: Lie_Ex <lilith.ex@gmail.com>\n"
+"Language-Team: zh_CN <kde-china@kde.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+
+#
+#: themer/kdmlabel.cpp:236
+msgid "User %u will log in in %t"
+msgstr "用户 %u 将在 %t 秒后登录"
diff --git a/tests/auto/linguist/lconvert/data/test-escapes.po b/tests/auto/linguist/lconvert/data/test-escapes.po
new file mode 100644
index 0000000..059dc58
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/test-escapes.po
@@ -0,0 +1,11 @@
+msgid ""
+msgstr ""
+
+msgid "this comes\non a new line"
+msgstr "yup"
+
+msgid "come to \"quote\" me"
+msgstr "sure?"
+
+msgid "\x1a\45\r\t\v\a\b"
+msgstr "yup"
diff --git a/tests/auto/linguist/lconvert/data/test-escapes.po.out b/tests/auto/linguist/lconvert/data/test-escapes.po.out
new file mode 100644
index 0000000..10eefb2
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/test-escapes.po.out
@@ -0,0 +1,13 @@
+msgid ""
+msgstr ""
+
+msgid ""
+"this comes\n"
+"on a new line"
+msgstr "yup"
+
+msgid "come to \"quote\" me"
+msgstr "sure?"
+
+msgid "\x1a%\r\t\v\a\b"
+msgstr "yup"
diff --git a/tests/auto/linguist/lconvert/data/test-kde-ctxt.po b/tests/auto/linguist/lconvert/data/test-kde-ctxt.po
new file mode 100644
index 0000000..b510538
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/test-kde-ctxt.po
@@ -0,0 +1,25 @@
+# translation of kdmgreet.po to zh_CN
+# Simp. Chinese Translation for kdmgreet.
+# Copyright (C) 2001,2003 Free Software Foundation, Inc.
+# Gou Zhuang <gouzhuang@bigfoot.com>, 2001.
+# Xiong Jiang <jxiong@offtopic.org>, 2003.
+# Yan Shuangchun <yahzee@d3eye.com>, 2003.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: kdmgreet\n"
+"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
+"POT-Creation-Date: 2008-04-28 18:47+0200\n"
+"PO-Revision-Date: 2008-04-22 16:56+0800\n"
+"Last-Translator: Lie_Ex <lilith.ex@gmail.com>\n"
+"Language-Team: zh_CN <kde-china@kde.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+
+#: kgdialog.cpp:231
+#, kde-format
+msgctxt "session (location)"
+msgid "%1 (%2)"
+msgstr "%1(%2)"
diff --git a/tests/auto/linguist/lconvert/data/test-kde-fuzzy.po b/tests/auto/linguist/lconvert/data/test-kde-fuzzy.po
new file mode 100644
index 0000000..b3f6e03
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/test-kde-fuzzy.po
@@ -0,0 +1,31 @@
+# translation of kdmgreet.po to German
+# Übersetzung von kdmgreet.po ins Deutsche
+# Copyright (C)
+# Thomas Diehl <thd@kde.org>, 2002, 2003, 2004.
+# Stephan Johach <hunsum@gmx.de>, 2005.
+# Thomas Reitelbach <tr@erdfunkstelle.de>, 2005, 2006, 2007.
+msgid ""
+msgstr ""
+"Project-Id-Version: kdmgreet\n"
+"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
+"POT-Creation-Date: 2008-04-28 18:47+0200\n"
+"PO-Revision-Date: 2007-12-06 20:50+0100\n"
+"Last-Translator: Thomas Reitelbach <tr@erdfunkstelle.de>\n"
+"Language-Team: German <kde-i18n-de@kde.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KAider 0.1\n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+
+#: kgverify.cpp:459
+#, fuzzy, kde-format
+#| msgid ""
+#| "Logging in %1 ...\n"
+#| "\n"
+msgid ""
+"Logging in %1...\n"
+"\n"
+msgstr ""
+"%1 wird angemeldet ...\n"
+"\n"
diff --git a/tests/auto/linguist/lconvert/data/test-kde-multiline.po b/tests/auto/linguist/lconvert/data/test-kde-multiline.po
new file mode 100644
index 0000000..0ca714c
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/test-kde-multiline.po
@@ -0,0 +1,32 @@
+# translation of kdmgreet.po to German
+# Übersetzung von kdmgreet.po ins Deutsche
+# Copyright (C)
+# Thomas Diehl <thd@kde.org>, 2002, 2003, 2004.
+# Stephan Johach <hunsum@gmx.de>, 2005.
+# Thomas Reitelbach <tr@erdfunkstelle.de>, 2005, 2006, 2007.
+msgid ""
+msgstr ""
+"Project-Id-Version: kdmgreet\n"
+"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
+"POT-Creation-Date: 2008-04-28 18:47+0200\n"
+"PO-Revision-Date: 2007-12-06 20:50+0100\n"
+"Last-Translator: Thomas Reitelbach <tr@erdfunkstelle.de>\n"
+"Language-Team: German <kde-i18n-de@kde.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KAider 0.1\n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+
+#: kdmshutdown.cpp:706
+#, kde-format
+msgid ""
+"Owner: %1\n"
+"Type: %2%5\n"
+"Start: %3\n"
+"Timeout: %4"
+msgstr ""
+"Eigentümer: %1\n"
+"Typ: %2%5\n"
+"Start: %3\n"
+"Zeitlimit: %4"
diff --git a/tests/auto/linguist/lconvert/data/test-kde-plurals.po b/tests/auto/linguist/lconvert/data/test-kde-plurals.po
new file mode 100644
index 0000000..6c85d74
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/test-kde-plurals.po
@@ -0,0 +1,27 @@
+# translation of kdmgreet.po to German
+# Übersetzung von kdmgreet.po ins Deutsche
+# Copyright (C)
+# Thomas Diehl <thd@kde.org>, 2002, 2003, 2004.
+# Stephan Johach <hunsum@gmx.de>, 2005.
+# Thomas Reitelbach <tr@erdfunkstelle.de>, 2005, 2006, 2007.
+msgid ""
+msgstr ""
+"Project-Id-Version: kdmgreet\n"
+"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
+"POT-Creation-Date: 2008-04-28 18:47+0200\n"
+"PO-Revision-Date: 2007-12-06 20:50+0100\n"
+"Last-Translator: Thomas Reitelbach <tr@erdfunkstelle.de>\n"
+"Language-Team: German <kde-i18n-de@kde.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KAider 0.1\n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+"X-Language: de_DE\n"
+
+#: kgverify.cpp:505
+#, kde-format
+msgid "Your account expires tomorrow."
+msgid_plural "Your account expires in %1 days."
+msgstr[0] "Ihre Zugangsberechtigung läuft morgen ab."
+msgstr[1] "Ihre Zugangsberechtigung läuft in %1 Tagen ab."
diff --git a/tests/auto/linguist/lconvert/data/test-slurp.po b/tests/auto/linguist/lconvert/data/test-slurp.po
new file mode 100644
index 0000000..67bc239
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/test-slurp.po
@@ -0,0 +1,19 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: kdmgreet\n"
+"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
+
+msgid "just a line"
+msgstr "indeed"
+
+msgid ""
+"another "
+"line"
+msgstr "certainly"
+
+msgid "a somewhat longer line that will certainly require re-wrapping, and will be re-wrapped if our algorithm is not completely broken.\n"
+"this comes on a new line.\n"
+msgstr "whatever ..."
+
+msgid "bi-""segmented"
+msgstr "aye"
diff --git a/tests/auto/linguist/lconvert/data/test-slurp.po.out b/tests/auto/linguist/lconvert/data/test-slurp.po.out
new file mode 100644
index 0000000..8859a70
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/test-slurp.po.out
@@ -0,0 +1,19 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: kdmgreet\n"
+"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
+
+msgid "just a line"
+msgstr "indeed"
+
+msgid "another line"
+msgstr "certainly"
+
+msgid ""
+"a somewhat longer line that will certainly require re-wrapping, and will be "
+"re-wrapped if our algorithm is not completely broken.\n"
+"this comes on a new line.\n"
+msgstr "whatever ..."
+
+msgid "bi-segmented"
+msgstr "aye"
diff --git a/tests/auto/linguist/lconvert/data/test-translator-comment.po b/tests/auto/linguist/lconvert/data/test-translator-comment.po
new file mode 100644
index 0000000..bc4df5c
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/test-translator-comment.po
@@ -0,0 +1,41 @@
+# translation of kdmgreet.po to zh_CN
+# Simp. Chinese Translation for kdmgreet.
+# Copyright (C) 2001,2003 Free Software Foundation, Inc.
+# Gou Zhuang <gouzhuang@bigfoot.com>, 2001.
+# Xiong Jiang <jxiong@offtopic.org>, 2003.
+# Yan Shuangchun <yahzee@d3eye.com>, 2003.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: kdmgreet\n"
+"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
+"POT-Creation-Date: 2008-04-28 18:47+0200\n"
+"PO-Revision-Date: 2008-04-22 16:56+0800\n"
+"Last-Translator: Lie_Ex <lilith.ex@gmail.com>\n"
+"Language-Team: zh_CN <kde-china@kde.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+
+msgid "no comment"
+msgstr "indeed"
+
+#
+msgid "just empty"
+msgstr "indeed"
+
+#
+# This is some comment.
+#
+# This is another comment.
+#
+msgid "User %u will log in in %t"
+msgstr "用户 %u 将在 %t 秒后登录"
+
+# A fooish bar.
+# Hey-ho, sucker.
+#
+# Babbling gully.
+msgid "Foo"
+msgstr "Bar"
diff --git a/tests/auto/linguist/lconvert/data/test1-cn.po b/tests/auto/linguist/lconvert/data/test1-cn.po
new file mode 100644
index 0000000..529eca3
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/test1-cn.po
@@ -0,0 +1,67 @@
+# translation of kdmgreet.po to zh_CN
+# Simp. Chinese Translation for kdmgreet.
+# Copyright (C) 2001,2003 Free Software Foundation, Inc.
+# Gou Zhuang <gouzhuang@bigfoot.com>, 2001.
+# Xiong Jiang <jxiong@offtopic.org>, 2003.
+# Yan Shuangchun <yahzee@d3eye.com>, 2003.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: kdmgreet\n"
+"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
+"POT-Creation-Date: 2008-04-28 18:47+0200\n"
+"PO-Revision-Date: 2008-04-22 16:56+0800\n"
+"Last-Translator: Lie_Ex <lilith.ex@gmail.com>\n"
+"Language-Team: zh_CN <kde-china@kde.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+"X-Language: zh_CN\n"
+
+#: kdmconfig.cpp:147
+msgid "[fix kdmrc]"
+msgstr "[修复 kdmrc]"
+
+#: krootimage.cpp:39
+msgid "Fancy desktop background for kdm"
+msgstr "kdm 的梦幻桌面背景"
+
+#: kgreeter.cpp:558
+#, kde-format
+msgid ""
+"Your saved session type '%1' is not valid any more.\n"
+"Please select a new one, otherwise 'default' will be used."
+msgstr ""
+"你保存的“%1”会话类型不再有效。\n"
+"请选择一个新的类型,否则将使用“默认”。"
+
+#: kgdialog.cpp:231
+#, kde-format
+msgctxt "session (location)"
+msgid "%1 (%2)"
+msgstr "%1(%2)"
+
+#: kgverify.cpp:505
+#, kde-format
+msgid "Your account expires tomorrow."
+msgid_plural "Your account expires in %1 days."
+msgstr[0] "您的账户将于 %1 天后过期。"
+
+#: kdmshutdown.cpp:510
+#, kde-format
+msgctxt "current option in boot loader"
+msgid "%1 (current)"
+msgstr "%1 (当前)"
+
+#: themer/kdmlabel.cpp:285
+#, no-c-format
+msgctxt "date format"
+msgid "%a %d %B"
+msgstr "%B月%d日,%a"
+
+#~ msgid "_Suspend"
+#~ msgstr "挂起(_S)"
+
+#~ msgid "Confi_gure"
+#~ msgstr "配置(_G)"
diff --git a/tests/auto/linguist/lconvert/data/test1-de.po b/tests/auto/linguist/lconvert/data/test1-de.po
new file mode 100644
index 0000000..256b8e9
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/test1-de.po
@@ -0,0 +1,75 @@
+# translation of kdmgreet.po to German
+# translation of kdmgreet.po to
+# Übersetzung von kdmgreet.po ins Deutsche
+# Copyright (C)
+# Thomas Diehl <thd@kde.org>, 2002, 2003, 2004.
+# Stephan Johach <hunsum@gmx.de>, 2005.
+# Thomas Reitelbach <tr@erdfunkstelle.de>, 2005, 2006, 2007.
+msgid ""
+msgstr ""
+"Project-Id-Version: kdmgreet\n"
+"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
+"POT-Creation-Date: 2008-04-28 18:47+0200\n"
+"PO-Revision-Date: 2007-12-06 20:50+0100\n"
+"Last-Translator: Thomas Reitelbach <tr@erdfunkstelle.de>\n"
+"Language-Team: German <kde-i18n-de@kde.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KAider 0.1\n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+"X-Language: de_DE\n"
+
+#: lib/acl.c:107 lib/acl.c:121 lib/acl.c:138 lib/acl.c:165 lib/acl.c:174
+#: src/copy.c:695 src/copy.c:2017
+#, c-format
+msgid "preserving permissions for %s"
+msgstr "a preservar as permissões de %s"
+
+#: kdmconfig.cpp:147
+msgid "[fix kdmrc]"
+msgstr "[fix kdmrc]"
+
+#: krootimage.cpp:39
+msgid "Fancy desktop background for kdm"
+msgstr "Schicker Arbeitsflächenhintergrund für KDM"
+
+#: kgreeter.cpp:558
+#, kde-format
+msgid ""
+"Your saved session type '%1' is not valid any more.\n"
+"Please select a new one, otherwise 'default' will be used."
+msgstr ""
+"Der gespeicherte Sitzungstyp „%1“ ist nicht mehr gültig.\n"
+"Bitte wählen Sie einen neuen. Sonst wird die Voreinstellung verwendet."
+
+#: kgdialog.cpp:231
+#, kde-format
+msgctxt "session (location)"
+msgid "%1 (%2)"
+msgstr "%1 (%2)"
+
+#: kgverify.cpp:505
+#, kde-format
+msgid "Your account expires tomorrow."
+msgid_plural "Your account expires in %1 days."
+msgstr[0] "Ihre Zugangsberechtigung läuft morgen ab."
+msgstr[1] "Ihre Zugangsberechtigung läuft in %1 Tagen ab."
+
+#: kdmshutdown.cpp:510
+#, kde-format
+msgctxt "current option in boot loader"
+msgid "%1 (current)"
+msgstr "%1 (Aktuelle)"
+
+#: themer/kdmlabel.cpp:285
+#, no-c-format
+msgctxt "date format"
+msgid "%a %d %B"
+msgstr "%a %d %B"
+
+#~ msgid "_Suspend"
+#~ msgstr "_Ruhezustand"
+
+#~ msgid "Confi_gure"
+#~ msgstr "Ein_richten"
diff --git a/tests/auto/linguist/lconvert/data/test11.ts b/tests/auto/linguist/lconvert/data/test11.ts
new file mode 100644
index 0000000..aeb46af
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/test11.ts
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="1.1" language="de_DE">
+<context>
+ <name>FindDialog</name>
+ <message>
+ <location filename="finddialog.cpp" line="57"/>
+ <source>Enter the text you want to find.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="finddialog.cpp" line="107"/>
+ <source>Search reached end of the document</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="finddialog.cpp" line="109"/>
+ <source>Search reached start of the document</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="finddialog.cpp" line="111"/>
+ <source>Text not found</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="finddialog.cpp" line="122"/>
+ <source>Should be obsolete</source>
+ <translation type="unfinished">SHOULD BE OBSOLETE</translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lconvert/data/test20.ts b/tests/auto/linguist/lconvert/data/test20.ts
new file mode 100644
index 0000000..542cdee
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/test20.ts
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0">
+<context>
+ <name>Dialog2</name>
+ <message numerus="yes">
+ <location filename="main.cpp" line="29"/>
+ <source>%n files</source>
+ <comment>plural form</comment>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="30"/>
+ <source>%n cars</source>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="31"/>
+ <source>&amp;Find %n cars</source>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="32"/>
+ <source>Search in %n items?</source>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="33"/>
+ <source>%1. Search in %n items?</source>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="34"/>
+ <source>Age: %1</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="35"/>
+ <source>There are %n house(s)</source>
+ <comment>Plurals and function call</comment>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="53"/>
+ <source>QTranslator</source>
+ <comment>Simple</comment>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="54"/>
+ <source>QTranslator</source>
+ <comment>Simple with comment</comment>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="55"/>
+ <source>QTranslator</source>
+ <comment>Plural without comment</comment>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="57"/>
+ <source>QTranslator</source>
+ <comment>Plural with comment</comment>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="102"/>
+ <source>func3</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>QApplication</name>
+ <message>
+ <location filename="main.cpp" line="13"/>
+ <source>QT_LAYOUT_DIRECTION</source>
+ <comment>Translate this string to the string &apos;LTR&apos; in left-to-right languages or to &apos;RTL&apos; in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout.</comment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>QCoreApplication</name>
+ <message numerus="yes">
+ <location filename="main.cpp" line="40"/>
+ <source>Plurals, QCoreApplication</source>
+ <comment>%n house(s)</comment>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="41"/>
+ <source>Plurals, QCoreApplication</source>
+ <comment>%n car(s)</comment>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.cpp" line="42"/>
+ <source>Plurals, QCoreApplication</source>
+ <comment>%n horse(s)</comment>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+</context>
+<context>
+ <name>TestClass</name>
+ <message>
+ <location filename="main.cpp" line="116"/>
+ <source>inline function</source>
+ <comment>TestClass</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="120"/>
+ <source>inline function 2</source>
+ <comment>TestClass</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="124"/>
+ <source>static inline function</source>
+ <comment>TestClass</comment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lconvert/data/variants.ts b/tests/auto/linguist/lconvert/data/variants.ts
new file mode 100644
index 0000000..52bb2d4
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/variants.ts
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="de">
+<context>
+ <name>Assistant</name>
+ <message>
+ <source>Source</source>
+ <translation variants="yes">
+ <lengthvariant>A really very long translation</lengthvariant>
+ <lengthvariant>Short translation</lengthvariant>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <source>%n document(s) found.</source>
+ <translation>
+ <numerusform>1 Dokument gefunden.</numerusform>
+ <numerusform variants="yes">
+ <lengthvariant>%n Dokumente gefunden.</lengthvariant>
+ <lengthvariant>%n Dok. gefunden.</lengthvariant>
+ </numerusform>
+ </translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lconvert/data/wrapping.po b/tests/auto/linguist/lconvert/data/wrapping.po
new file mode 100644
index 0000000..39b7fbe
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/wrapping.po
@@ -0,0 +1,58 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2008-05-14 14:01+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"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#, no-wrap
+msgid "one two three four five six seven eight nine ten eleven twelve thirteen a 12 foo bar\n"
+msgstr ""
+
+#, no-wrap
+msgid ""
+"one two three four five six seven eight nine ten eleven twelve thirteen a 13 foo bar\n"
+"second line"
+msgstr ""
+
+#: gettxt.c:3
+msgid ""
+"one two three four five six seven eight nine ten eleven twelve thirteen a 14 "
+"foo bar\n"
+msgstr ""
+
+#: gettxt.c:4
+msgid ""
+"one two three four five six seven eight nine ten eleven twelve thirteen a "
+"15\n"
+msgstr ""
+
+#: gettxt.c:5
+msgid ""
+"one two three four five six seven eight nine ten eleven twelve thirteen a "
+"123 foo bar\n"
+msgstr ""
+
+#: gettxt.c:6
+msgid "one two three four five six seven eight nine ten eleven twelve thirteen"
+msgstr ""
+
+#: gettxt.c:7
+msgid ""
+"one two three four five six seven eight nine ten eleven twelve th1rt33n\n"
+msgstr ""
+
+#: gettxt.c:8
+msgid "one two three four five six\n"
+msgstr ""
diff --git a/tests/auto/linguist/lconvert/lconvert.pro b/tests/auto/linguist/lconvert/lconvert.pro
new file mode 100644
index 0000000..517dacd
--- /dev/null
+++ b/tests/auto/linguist/lconvert/lconvert.pro
@@ -0,0 +1,8 @@
+CONFIG += qttest_p4
+
+TARGET = tst_lconvert
+
+#HEADERS += testlupdate.h
+SOURCES += tst_lconvert.cpp
+# testlupdate.cpp
+
diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp
new file mode 100644
index 0000000..40be55a
--- /dev/null
+++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp
@@ -0,0 +1,341 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Linguist of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtCore/QFile>
+
+class tst_lconvert : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_lconvert() : dataDir("data/") {}
+
+private slots:
+ void initTestCase();
+ void readverifies_data();
+ void readverifies();
+ void converts_data();
+ void converts();
+ void roundtrips_data();
+ void roundtrips();
+#if 0
+ void chains_data();
+ void chains();
+#endif
+
+private:
+ void doWait(QProcess *cvt, int stage);
+ void doCompare(QIODevice *actual, const QString &expectedFn);
+ void verifyReadFail(const QString &fn);
+ // args can be empty or have one element less than stations
+ void convertChain(const QString &inFileName, const QString &outFileName,
+ const QStringList &stations, const QList<QStringList> &args);
+ void convertRoundtrip(const QString &fileName, const QStringList &stations,
+ const QList<QStringList> &args);
+
+ QString dataDir;
+};
+
+void tst_lconvert::initTestCase()
+{
+ if (!QFile::exists(QLatin1String("data/plural-1.po")))
+ QProcess::execute(QLatin1String("data/makeplurals.sh"), QStringList() << QLatin1String("data/"));
+ QVERIFY(QFile::exists(QLatin1String("data/plural-1.po")));
+}
+
+void tst_lconvert::doWait(QProcess *cvt, int stage)
+{
+ if (QTest::currentTestFailed()) {
+ cvt->kill();
+ cvt->waitForFinished();
+ } else {
+ QVERIFY2(cvt->waitForFinished(3000),
+ qPrintable(QString("Process %1 hung").arg(stage)));
+ QVERIFY2(cvt->exitStatus() == QProcess::NormalExit,
+ qPrintable(QString("Process %1 crashed").arg(stage)));
+ QVERIFY2(cvt->exitCode() == 0,
+ qPrintable(QString("Process %1 exited with status %2. Errors:\n%3")
+ .arg(stage).arg(cvt->exitCode())
+ .arg(QString::fromUtf8(cvt->readAllStandardError()))));
+ }
+}
+
+void tst_lconvert::doCompare(QIODevice *actualDev, const QString &expectedFn)
+{
+ QList<QByteArray> actual = actualDev->readAll().split('\n');
+
+ QFile file(expectedFn);
+ QVERIFY(file.open(QIODevice::ReadOnly));
+ QList<QByteArray> expected = file.readAll().split('\n');
+
+ int i = 0, ei = expected.size(), gi = actual.size();
+ for (; ; i++) {
+ if (i == gi) {
+ if (i == ei)
+ return;
+ gi = 0;
+ break;
+ } else if (i == ei) {
+ ei = 0;
+ break;
+ } else if (actual.at(i) != expected.at(i)) {
+ while ((ei - 1) >= i && (gi - 1) >= i && actual.at(gi - 1) == expected.at(ei - 1))
+ ei--, gi--;
+ break;
+ }
+ }
+ QByteArray diff;
+ for (int j = qMax(0, i - 3); j < i; j++)
+ diff += expected.at(j) + '\n';
+ diff += "<<<<<<< got\n";
+ for (int j = i; j < gi; j++) {
+ diff += actual.at(j) + '\n';
+ if (j >= i + 5) {
+ diff += "...\n";
+ break;
+ }
+ }
+ diff += "=========\n";
+ for (int j = i; j < ei; j++) {
+ diff += expected.at(j) + '\n';
+ if (j >= i + 5) {
+ diff += "...\n";
+ break;
+ }
+ }
+ diff += ">>>>>>> expected\n";
+ for (int j = ei; j < qMin(ei + 3, expected.size()); j++)
+ diff += expected.at(j) + '\n';
+ QFAIL(qPrintable("Output for " + expectedFn + " does not meet expectations:\n" + diff));
+}
+
+void tst_lconvert::verifyReadFail(const QString &fn)
+{
+ QProcess cvt;
+ cvt.start("lconvert", QStringList() << (dataDir + fn));
+ QVERIFY(cvt.waitForFinished(1000));
+ QVERIFY(cvt.exitStatus() == QProcess::NormalExit);
+ QVERIFY2(cvt.exitCode() == 2, "Accepted invalid input");
+}
+
+void tst_lconvert::convertChain(const QString &_inFileName, const QString &_outFileName,
+ const QStringList &stations, const QList<QStringList> &argList)
+{
+ QList<QProcess *> cvts;
+
+ QString fileName = dataDir + _inFileName;
+ QString outFileName = dataDir + _outFileName;
+
+ for (int i = 0; i < stations.size() - 1; i++) {
+ QProcess *cvt = new QProcess(this);
+ if (cvts.isEmpty())
+ cvt->setStandardInputFile(fileName);
+ else
+ cvts.last()->setStandardOutputProcess(cvt);
+ cvts.append(cvt);
+ }
+ for (int i = 0; i < stations.size() - 1; i++) {
+ QStringList args;
+ if (!argList.isEmpty())
+ args += argList[i];
+ args << "-if" << stations[i] << "-i" << "-" << "-of" << stations[i + 1];
+ cvts.at(i)->start("lconvert", args);
+ }
+ int st = 0;
+ foreach (QProcess *cvt, cvts)
+ doWait(cvt, ++st);
+
+ if (!QTest::currentTestFailed())
+ doCompare(cvts.last(), outFileName);
+
+ qDeleteAll(cvts);
+}
+
+void tst_lconvert::convertRoundtrip(const QString &_fileName, const QStringList &stations,
+ const QList<QStringList> &argList)
+{
+ convertChain(_fileName, _fileName, stations, argList);
+}
+
+void tst_lconvert::readverifies_data()
+{
+ QTest::addColumn<QString>("fileName");
+ QTest::addColumn<QString>("format");
+
+ QTest::newRow("empty comment") << "test-empty-comment.po" << "po";
+ QTest::newRow("translator comment") << "test-translator-comment.po" << "po";
+ QTest::newRow("developer comment") << "test-developer-comment.po" << "po";
+ QTest::newRow("kde context") << "test-kde-ctxt.po" << "po";
+ QTest::newRow("kde fuzzy") << "test-kde-fuzzy.po" << "po";
+ QTest::newRow("kde plurals") << "test-kde-plurals.po" << "po";
+ QTest::newRow("kde multiline") << "test-kde-multiline.po" << "po";
+ QTest::newRow("po linewrapping") << "wrapping.po" << "po";
+ QTest::newRow("relative locations") << "relative.ts" << "ts";
+ QTest::newRow("message ids") << "msgid.ts" << "ts";
+ QTest::newRow("length variants") << "variants.ts" << "ts";
+}
+
+void tst_lconvert::readverifies()
+{
+ QFETCH(QString, fileName);
+ QFETCH(QString, format);
+
+ convertRoundtrip(fileName, QStringList() << format << format, QList<QStringList>());
+}
+
+void tst_lconvert::converts_data()
+{
+ QTest::addColumn<QString>("inFileName");
+ QTest::addColumn<QString>("outFileName");
+ QTest::addColumn<QString>("format");
+
+ QTest::newRow("broken utf8") << "test-broken-utf8.po" << "test-broken-utf8.po.out" << "po";
+ QTest::newRow("line joins") << "test-slurp.po" << "test-slurp.po.out" << "po";
+ QTest::newRow("escapes") << "test-escapes.po" << "test-escapes.po.out" << "po";
+}
+
+void tst_lconvert::converts()
+{
+ QFETCH(QString, inFileName);
+ QFETCH(QString, outFileName);
+ QFETCH(QString, format);
+
+ QString outFileNameFq = dataDir + outFileName;
+
+ QProcess cvt;
+ cvt.start("lconvert", QStringList() << "-i" << (dataDir + inFileName) << "-of" << format);
+ doWait(&cvt, 0);
+ if (QTest::currentTestFailed())
+ return;
+
+ doCompare(&cvt, outFileNameFq);
+}
+
+Q_DECLARE_METATYPE(QList<QStringList>);
+
+#if 0
+void tst_lconvert::chains_data()
+{
+ QTest::addColumn<QString>("inFileName");
+ QTest::addColumn<QString>("outFileName");
+ QTest::addColumn<QStringList>("stations");
+ QTest::addColumn<QList<QStringList> >("args");
+
+}
+
+void tst_lconvert::chains()
+{
+ QFETCH(QString, inFileName);
+ QFETCH(QString, outFileName);
+ QFETCH(QStringList, stations);
+ QFETCH(QList<QStringList>, args);
+
+ convertChain(inFileName, outFileName, stations, args);
+}
+#endif
+
+void tst_lconvert::roundtrips_data()
+{
+ QTest::addColumn<QString>("fileName");
+ QTest::addColumn<QStringList>("stations");
+ QTest::addColumn<QList<QStringList> >("args");
+
+ QStringList poTsPo; poTsPo << "po" << "ts" << "po";
+ QStringList poXlfPo; poXlfPo << "po" << "xlf" << "po";
+ QStringList tsTs11Ts; tsTs11Ts << "ts" << "ts11" << "ts";
+ QStringList tsPoTs; tsPoTs << "ts" << "po" << "ts";
+ QStringList ts11PoTs11; ts11PoTs11 << "ts11" << "po" << "ts11";
+ QStringList tsXlfTs; tsXlfTs << "ts" << "xlf" << "ts";
+ QStringList tsQmTs; tsQmTs << "ts" << "qm" << "ts";
+
+ QList<QStringList> noArgs;
+ QList<QStringList> filterPoArgs; filterPoArgs << QStringList() << (QStringList() << "-drop-tag" << "po:*");
+ QList<QStringList> outDeArgs; outDeArgs << QStringList() << (QStringList() << "-target-language" << "de");
+ QList<QStringList> outCnArgs; outCnArgs << QStringList() << (QStringList() << "-target-language" << "cn");
+
+ QTest::newRow("po-ts-po (translator comment)") << "test-translator-comment.po" << poTsPo << noArgs;
+ QTest::newRow("po-xliff-po (translator comment)") << "test-translator-comment.po" << poXlfPo << noArgs;
+ QTest::newRow("po-ts-po (developer comment)") << "test-developer-comment.po" << poTsPo << noArgs;
+ QTest::newRow("po-xliff-po (developer comment)") << "test-developer-comment.po" << poXlfPo << noArgs;
+
+ QTest::newRow("ts11-po-ts11") << "test11.ts" << ts11PoTs11 << filterPoArgs;
+ QTest::newRow("ts20-po-ts20") << "test20.ts" << tsPoTs << filterPoArgs;
+ QTest::newRow("po-ts-po (de)") << "test1-de.po" << poTsPo << noArgs;
+ QTest::newRow("po-ts-po (cn)") << "test1-cn.po" << poTsPo << noArgs;
+ QTest::newRow("po-xliff-po (de)") << "test1-de.po" << poXlfPo << noArgs;
+ QTest::newRow("po-xliff-po (cn)") << "test1-cn.po" << poXlfPo << noArgs;
+
+ QTest::newRow("po-ts-po (singular)") << "singular.po" << poTsPo << noArgs;
+ QTest::newRow("po-ts-po (plural-1)") << "plural-1.po" << poTsPo << noArgs;
+ QTest::newRow("po-ts-po (plural-2)") << "plural-2.po" << poTsPo << noArgs;
+ QTest::newRow("po-ts-po (plural-3)") << "plural-3.po" << poTsPo << noArgs;
+ QTest::newRow("po-xliff-po (singular)") << "singular.po" << poXlfPo << noArgs;
+ QTest::newRow("po-xliff-po (plural-1)") << "plural-1.po" << poXlfPo << noArgs;
+ QTest::newRow("po-xliff-po (plural-2)") << "plural-2.po" << poXlfPo << noArgs;
+ QTest::newRow("po-xliff-po (plural-3)") << "plural-3.po" << poXlfPo << noArgs;
+
+ QTest::newRow("ts20-ts11-ts20 (utf8)") << "codec-utf8.ts" << tsTs11Ts << noArgs;
+ QTest::newRow("ts20-ts11-ts20 (cp1252)") << "codec-cp1252.ts" << tsTs11Ts << noArgs;
+ QTest::newRow("ts20-ts11-ts20 (dual-encoding)") << "dual-encoding.ts" << tsTs11Ts << noArgs;
+
+ QTest::newRow("ts-qm-ts (dual-encoding)") << "dual-encoding.ts" << tsQmTs << noArgs;
+ QTest::newRow("ts-qm-ts (plurals-de)") << "plurals-de.ts" << tsQmTs << outDeArgs;
+ QTest::newRow("ts-qm-ts (plurals-cn)") << "plurals-cn.ts" << tsQmTs << outCnArgs;
+ QTest::newRow("ts-qm-ts (variants)") << "variants.ts" << tsQmTs << outDeArgs;
+ QTest::newRow("ts-po-ts (msgid)") << "msgid.ts" << tsPoTs << noArgs;
+ QTest::newRow("ts-xliff-ts (msgid)") << "msgid.ts" << tsXlfTs << noArgs;
+
+ QTest::newRow("ts-po-ts (endless loop)") << "endless-po-loop.ts" << tsPoTs << noArgs;
+}
+
+void tst_lconvert::roundtrips()
+{
+ QFETCH(QString, fileName);
+ QFETCH(QStringList, stations);
+ QFETCH(QList<QStringList>, args);
+
+ convertRoundtrip(fileName, stations, args);
+}
+
+QTEST_APPLESS_MAIN(tst_lconvert)
+
+#include "tst_lconvert.moc"