aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMaximilian Goldstein <max.goldstein@qt.io>2020-06-24 13:05:55 +0200
committerMaximilian Goldstein <max.goldstein@qt.io>2020-07-02 13:30:20 +0200
commit9ac953aefdec4481d53cea61b494d6657a61d03e (patch)
treef9da0128ad4b6d9d8e1d5cce2d4652a17e02287f /tests
parente9d03ec78fd95d10e9d9653c1f3d6dc5433de433 (diff)
qmlformat: Fix inline components
Fixes: QTBUG-85189 Change-Id: I2b30595b44d14b89406b126d3d148f51f8bfbca4 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 88b3d1fd26b6b566ef00ae728051bff29455eea5)
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qmlformat/data/inlineComponents.formatted.qml10
-rw-r--r--tests/auto/qml/qmlformat/data/inlineComponents.qml6
-rw-r--r--tests/auto/qml/qmlformat/tst_qmlformat.cpp7
3 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlformat/data/inlineComponents.formatted.qml b/tests/auto/qml/qmlformat/data/inlineComponents.formatted.qml
new file mode 100644
index 0000000000..5349280f2b
--- /dev/null
+++ b/tests/auto/qml/qmlformat/data/inlineComponents.formatted.qml
@@ -0,0 +1,10 @@
+Item {
+ component CustomText: Text {
+ Text {
+ color: "red"
+ text: "Test Text"
+ }
+
+ }
+
+}
diff --git a/tests/auto/qml/qmlformat/data/inlineComponents.qml b/tests/auto/qml/qmlformat/data/inlineComponents.qml
new file mode 100644
index 0000000000..6eeb3dd965
--- /dev/null
+++ b/tests/auto/qml/qmlformat/data/inlineComponents.qml
@@ -0,0 +1,6 @@
+Item {
+component CustomText: Text {
+color: "red"
+text: "Test Text"
+}
+}
diff --git a/tests/auto/qml/qmlformat/tst_qmlformat.cpp b/tests/auto/qml/qmlformat/tst_qmlformat.cpp
index 0e0bc53857..7690f78e9d 100644
--- a/tests/auto/qml/qmlformat/tst_qmlformat.cpp
+++ b/tests/auto/qml/qmlformat/tst_qmlformat.cpp
@@ -53,6 +53,7 @@ private Q_SLOTS:
void testReadOnlyProps();
void testVerbatimStrings();
void testLargeBindings();
+ void testInlineComponents();
#if !defined(QTEST_CROSS_COMPILED) // sources not available when cross compiled
void testExample();
@@ -225,6 +226,12 @@ void TestQmlformat::testVerbatimStrings()
readTestFile("verbatimString.formatted.qml"));
}
+void TestQmlformat::testInlineComponents()
+{
+ QCOMPARE(runQmlformat(testFile("inlineComponents.qml"), false, true),
+ readTestFile("inlineComponents.formatted.qml"));
+}
+
void TestQmlformat::testLargeBindings()
{
QCOMPARE(runQmlformat(testFile("largeBindings.qml"), false, true),