diff options
author | Kai Köhne <kai.koehne@qt.io> | 2021-03-05 10:35:04 +0100 |
---|---|---|
committer | Kai Koehne <kai.koehne@qt.io> | 2021-03-10 16:00:18 +0000 |
commit | b9a9f7b502f0631144176be343779a698e54161e (patch) | |
tree | 21d43b0a59fea40f5efac37023322cb24b9506d9 /tests/auto/linguist | |
parent | 628adb1b23bfd5a0ffd1606bbde1edf9fd1171cc (diff) | |
download | qttools-b9a9f7b502f0631144176be343779a698e54161e.tar.gz |
Fix regression in lconvert handling empty translations
Fixes a regression introduced by commit b96fe95da00aca6b, which enabled
a sanity check that now failed to account for empty string.
The serialized format of a QString is such that '-1' indicates a null
string, otherwise it's <length><QChar>+. Since QChar is 2 bytes,
length should therefore always be an even number ... except for -1.
While at it, also preserve the difference between an empty string and
a null string.
Fixes: QTBUG-91558
Pick-to: 6.1
Change-Id: Iffbc6ee2c94b8363d2c1d91440022a77dbef4772
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests/auto/linguist')
-rw-r--r-- | tests/auto/linguist/lconvert/data/untranslated.qm | bin | 0 -> 222 bytes | |||
-rw-r--r-- | tests/auto/linguist/lconvert/tst_lconvert.cpp | 2 |
2 files changed, 2 insertions, 0 deletions
diff --git a/tests/auto/linguist/lconvert/data/untranslated.qm b/tests/auto/linguist/lconvert/data/untranslated.qm Binary files differnew file mode 100644 index 000000000..e31d2553a --- /dev/null +++ b/tests/auto/linguist/lconvert/data/untranslated.qm diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp index 14f97a97a..2d3a1f5d2 100644 --- a/tests/auto/linguist/lconvert/tst_lconvert.cpp +++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp @@ -282,6 +282,7 @@ void tst_lconvert::roundtrips_data() QStringList tsPoTs; tsPoTs << "ts" << "po" << "ts"; QStringList tsXlfTs; tsXlfTs << "ts" << "xlf" << "ts"; QStringList tsQmTs; tsQmTs << "ts" << "qm" << "ts"; + QStringList qmTsQm; qmTsQm << "qm" << "ts" << "qm"; QList<QStringList> noArgs; QList<QStringList> filterPoArgs; filterPoArgs << QStringList() << (QStringList() << "-drop-tag" << "po:*"); @@ -318,6 +319,7 @@ void tst_lconvert::roundtrips_data() QTest::newRow("ts-po-ts (endless loop)") << "endless-po-loop.ts" << tsPoTs << noArgs; QTest::newRow("ts-qm-ts (whitespace)") << "whitespace.ts" << tsQmTs << noArgs; + QTest::newRow("qm-ts-qm (untranslated)") << "untranslated.qm" << qmTsQm << noArgs; } void tst_lconvert::roundtrips() |