aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMaximilian Goldstein <max.goldstein@qt.io>2020-06-12 13:52:38 +0200
committerMaximilian Goldstein <max.goldstein@qt.io>2020-07-01 12:35:59 +0200
commit05daefeb27e301a29990e8a97a8c8dec70b4a44c (patch)
tree0a2a806f699ff81b3f01f36856d062ccd1f80d92 /tests
parentf6d849c2d807f268af1c25da1b8ce385e0368418 (diff)
qmlformat: Copy string literals verbatim
Copy string literals verbatim instead of reformatting them. Fixes: QTBUG-84599 Change-Id: I36307eb30faa586f50cf0ce2660fb4e2686a3e4a (cherry picked from commit 237a0e86c700116bfa55a1e1ee6fdabcc1ca5c9c) Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qmlformat/data/verbatimString.formatted.qml4
-rw-r--r--tests/auto/qml/qmlformat/data/verbatimString.qml4
-rw-r--r--tests/auto/qml/qmlformat/tst_qmlformat.cpp7
3 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlformat/data/verbatimString.formatted.qml b/tests/auto/qml/qmlformat/data/verbatimString.formatted.qml
new file mode 100644
index 0000000000..fa7fbbe32b
--- /dev/null
+++ b/tests/auto/qml/qmlformat/data/verbatimString.formatted.qml
@@ -0,0 +1,4 @@
+Item {
+ property string verbatim1: 'A "verbatim" string!'
+ property string verbatim2: "A 'verbatim' string\u2757"
+}
diff --git a/tests/auto/qml/qmlformat/data/verbatimString.qml b/tests/auto/qml/qmlformat/data/verbatimString.qml
new file mode 100644
index 0000000000..15b080a87b
--- /dev/null
+++ b/tests/auto/qml/qmlformat/data/verbatimString.qml
@@ -0,0 +1,4 @@
+Item {
+property string verbatim1: 'A "verbatim" string!'
+property string verbatim2: "A 'verbatim' string\u2757"
+} \ No newline at end of file
diff --git a/tests/auto/qml/qmlformat/tst_qmlformat.cpp b/tests/auto/qml/qmlformat/tst_qmlformat.cpp
index 5a8974b907..ba34f0f923 100644
--- a/tests/auto/qml/qmlformat/tst_qmlformat.cpp
+++ b/tests/auto/qml/qmlformat/tst_qmlformat.cpp
@@ -51,6 +51,7 @@ private Q_SLOTS:
void testIfBlocks();
void testReadOnlyProps();
+ void testVerbatimStrings();
#if !defined(QTEST_CROSS_COMPILED) // sources not available when cross compiled
void testExample();
@@ -217,6 +218,12 @@ void TestQmlformat::testReadOnlyProps()
QCOMPARE(runQmlformat(testFile("readOnlyProps.qml"), false, true), readTestFile("readOnlyProps.formatted.qml"));
}
+void TestQmlformat::testVerbatimStrings()
+{
+ QCOMPARE(runQmlformat(testFile("verbatimString.qml"), false, true),
+ readTestFile("verbatimString.formatted.qml"));
+}
+
void TestQmlformat::testLineEndings()
{
// macos