summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2016-06-02 13:42:00 +0200
committerAndy Shaw <andy.shaw@qt.io>2018-01-12 14:54:04 +0000
commit22fb9b7613b05a4ced3af9af041869ad5fac5263 (patch)
treea7f9a8909718dcab336ce54ca5297382df4beadb /tests
parent9f3dba2ea3978936565aa5e7893415a8a765268e (diff)
Ensure that Nbsp characters are preserved by escaping them
Characters that are considered spaces, but aren't just ' ' should always be escaped so that the exact type of space that they are is preserved. Since QTextDocument::toPlainText() will convert QChar::Nbsp to ' ', we need to get the plain text from the handler directly and do our own conversion where applicable to stop it from replacing the Nbsp characters. Task-number: QTBUG-35652 Change-Id: I373edca92253ca5f978ba656c8ebbcaf77965e61 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/linguist/lconvert/data/whitespace.ts12
-rw-r--r--tests/auto/linguist/lconvert/tst_lconvert.cpp1
2 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/linguist/lconvert/data/whitespace.ts b/tests/auto/linguist/lconvert/data/whitespace.ts
new file mode 100644
index 000000000..560fe5d03
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/whitespace.ts
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1">
+<context>
+ <name>QObject</name>
+ <message>
+ <source>This is a test</source>
+ <translation>SPACE AA AA,
+NBSP AA&#xa0;AA</translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp
index 2ff8ea508..7f3c60f51 100644
--- a/tests/auto/linguist/lconvert/tst_lconvert.cpp
+++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp
@@ -313,6 +313,7 @@ void tst_lconvert::roundtrips_data()
QTest::newRow("ts-xliff-ts (msgid)") << "msgid.ts" << tsXlfTs << noArgs;
QTest::newRow("ts-po-ts (endless loop)") << "endless-po-loop.ts" << tsPoTs << noArgs;
+ QTest::newRow("ts-qm-ts (whitespace)") << "whitespace.ts" << tsQmTs << noArgs;
}
void tst_lconvert::roundtrips()