summaryrefslogtreecommitdiffstats
path: root/tests/auto/qxmlformatter
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2009-03-23 09:18:55 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-03-23 09:18:55 (GMT)
commite5fcad302d86d316390c6b0f62759a067313e8a9 (patch)
treec2afbf6f1066b6ce261f14341cf6d310e5595bc1 /tests/auto/qxmlformatter
downloadQt-e5fcad302d86d316390c6b0f62759a067313e8a9.zip
Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.gz
Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.bz2
Long live Qt 4.5!
Diffstat (limited to 'tests/auto/qxmlformatter')
-rw-r--r--tests/auto/qxmlformatter/.gitignore1
-rw-r--r--tests/auto/qxmlformatter/baselines/.gitattributes1
-rw-r--r--tests/auto/qxmlformatter/baselines/K2-DirectConElemContent-46.xml1
-rw-r--r--tests/auto/qxmlformatter/baselines/adjacentNodes.xml16
-rw-r--r--tests/auto/qxmlformatter/baselines/classExample.xml5
-rw-r--r--tests/auto/qxmlformatter/baselines/documentElementWithWS.xml1
-rw-r--r--tests/auto/qxmlformatter/baselines/documentNodes.xml3
-rw-r--r--tests/auto/qxmlformatter/baselines/elementsWithWS.xml8
-rw-r--r--tests/auto/qxmlformatter/baselines/emptySequence.xml1
-rw-r--r--tests/auto/qxmlformatter/baselines/indentedAdjacentNodes.xml16
-rw-r--r--tests/auto/qxmlformatter/baselines/indentedMixedContent.xml20
-rw-r--r--tests/auto/qxmlformatter/baselines/mixedContent.xml17
-rw-r--r--tests/auto/qxmlformatter/baselines/mixedTopLevelContent.xml1
-rw-r--r--tests/auto/qxmlformatter/baselines/nodesAndWhitespaceAtomics.xml4
-rw-r--r--tests/auto/qxmlformatter/baselines/onlyDocumentNode.xml1
-rw-r--r--tests/auto/qxmlformatter/baselines/prolog.xml17
-rw-r--r--tests/auto/qxmlformatter/baselines/simpleDocument.xml3
-rw-r--r--tests/auto/qxmlformatter/baselines/singleElement.xml1
-rw-r--r--tests/auto/qxmlformatter/baselines/singleTextNode.xml1
-rw-r--r--tests/auto/qxmlformatter/baselines/textNodeAtomicValue.xml1
-rw-r--r--tests/auto/qxmlformatter/baselines/threeAtomics.xml1
-rw-r--r--tests/auto/qxmlformatter/input/K2-DirectConElemContent-46.xq1
-rw-r--r--tests/auto/qxmlformatter/input/adjacentNodes.xml16
-rw-r--r--tests/auto/qxmlformatter/input/adjacentNodes.xq1
-rw-r--r--tests/auto/qxmlformatter/input/classExample.xml1
-rw-r--r--tests/auto/qxmlformatter/input/classExample.xq1
-rw-r--r--tests/auto/qxmlformatter/input/documentElementWithWS.xml2
-rw-r--r--tests/auto/qxmlformatter/input/documentElementWithWS.xq1
-rw-r--r--tests/auto/qxmlformatter/input/documentNodes.xq7
-rw-r--r--tests/auto/qxmlformatter/input/elementsWithWS.xml12
-rw-r--r--tests/auto/qxmlformatter/input/elementsWithWS.xq1
-rw-r--r--tests/auto/qxmlformatter/input/emptySequence.xq2
-rw-r--r--tests/auto/qxmlformatter/input/indentedAdjacentNodes.xml16
-rw-r--r--tests/auto/qxmlformatter/input/indentedAdjacentNodes.xq1
-rw-r--r--tests/auto/qxmlformatter/input/indentedMixedContent.xml16
-rw-r--r--tests/auto/qxmlformatter/input/indentedMixedContent.xq1
-rw-r--r--tests/auto/qxmlformatter/input/mixedContent.xml1
-rw-r--r--tests/auto/qxmlformatter/input/mixedContent.xq1
-rw-r--r--tests/auto/qxmlformatter/input/mixedTopLevelContent.xq16
-rw-r--r--tests/auto/qxmlformatter/input/nodesAndWhitespaceAtomics.xq13
-rw-r--r--tests/auto/qxmlformatter/input/onlyDocumentNode.xq1
-rw-r--r--tests/auto/qxmlformatter/input/prolog.xml17
-rw-r--r--tests/auto/qxmlformatter/input/prolog.xq1
-rw-r--r--tests/auto/qxmlformatter/input/simpleDocument.xml4
-rw-r--r--tests/auto/qxmlformatter/input/simpleDocument.xq1
-rw-r--r--tests/auto/qxmlformatter/input/singleElement.xml1
-rw-r--r--tests/auto/qxmlformatter/input/singleElement.xq1
-rw-r--r--tests/auto/qxmlformatter/input/singleTextNode.xq1
-rw-r--r--tests/auto/qxmlformatter/input/textNodeAtomicValue.xq1
-rw-r--r--tests/auto/qxmlformatter/input/threeAtomics.xq1
-rw-r--r--tests/auto/qxmlformatter/qxmlformatter.pro10
-rw-r--r--tests/auto/qxmlformatter/tst_qxmlformatter.cpp205
52 files changed, 474 insertions, 0 deletions
diff --git a/tests/auto/qxmlformatter/.gitignore b/tests/auto/qxmlformatter/.gitignore
new file mode 100644
index 0000000..d868a74
--- /dev/null
+++ b/tests/auto/qxmlformatter/.gitignore
@@ -0,0 +1 @@
+tst_qxmlformatter
diff --git a/tests/auto/qxmlformatter/baselines/.gitattributes b/tests/auto/qxmlformatter/baselines/.gitattributes
new file mode 100644
index 0000000..de08d51
--- /dev/null
+++ b/tests/auto/qxmlformatter/baselines/.gitattributes
@@ -0,0 +1 @@
+*.xml -crlf Unset
diff --git a/tests/auto/qxmlformatter/baselines/K2-DirectConElemContent-46.xml b/tests/auto/qxmlformatter/baselines/K2-DirectConElemContent-46.xml
new file mode 100644
index 0000000..742cfdb
--- /dev/null
+++ b/tests/auto/qxmlformatter/baselines/K2-DirectConElemContent-46.xml
@@ -0,0 +1 @@
+<e>12</e>
diff --git a/tests/auto/qxmlformatter/baselines/adjacentNodes.xml b/tests/auto/qxmlformatter/baselines/adjacentNodes.xml
new file mode 100644
index 0000000..a263c75
--- /dev/null
+++ b/tests/auto/qxmlformatter/baselines/adjacentNodes.xml
@@ -0,0 +1,16 @@
+<e>
+ <?pi1 data1?>
+ <?pi2 data2?>
+ <!-- comment1 -->
+ <!-- comment2 -->
+ <?pi3 data3?>
+ <!-- comment3 -->
+ <?pi4 data4?>
+ <e2>
+ <!-- comment1 -->
+ <!-- comment2 -->
+ <?pi3 data3?>
+ <!-- comment3 -->
+ <?pi4 data4?>
+ </e2>
+</e>
diff --git a/tests/auto/qxmlformatter/baselines/classExample.xml b/tests/auto/qxmlformatter/baselines/classExample.xml
new file mode 100644
index 0000000..5c833c6
--- /dev/null
+++ b/tests/auto/qxmlformatter/baselines/classExample.xml
@@ -0,0 +1,5 @@
+<a>
+ <b/>
+ <c/>
+ <p>Some Text</p>
+</a>
diff --git a/tests/auto/qxmlformatter/baselines/documentElementWithWS.xml b/tests/auto/qxmlformatter/baselines/documentElementWithWS.xml
new file mode 100644
index 0000000..69d62f2
--- /dev/null
+++ b/tests/auto/qxmlformatter/baselines/documentElementWithWS.xml
@@ -0,0 +1 @@
+<doc/>
diff --git a/tests/auto/qxmlformatter/baselines/documentNodes.xml b/tests/auto/qxmlformatter/baselines/documentNodes.xml
new file mode 100644
index 0000000..11dc672
--- /dev/null
+++ b/tests/auto/qxmlformatter/baselines/documentNodes.xml
@@ -0,0 +1,3 @@
+<e/>
+<!-- a comment -->
+<?aPi ?>
diff --git a/tests/auto/qxmlformatter/baselines/elementsWithWS.xml b/tests/auto/qxmlformatter/baselines/elementsWithWS.xml
new file mode 100644
index 0000000..1c5af5b
--- /dev/null
+++ b/tests/auto/qxmlformatter/baselines/elementsWithWS.xml
@@ -0,0 +1,8 @@
+<doc>
+ someText
+ <ws1/>
+ somee text
+ <ws2/>
+ <!-- comment -->
+ <ws3/>
+</doc>
diff --git a/tests/auto/qxmlformatter/baselines/emptySequence.xml b/tests/auto/qxmlformatter/baselines/emptySequence.xml
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/auto/qxmlformatter/baselines/emptySequence.xml
@@ -0,0 +1 @@
+
diff --git a/tests/auto/qxmlformatter/baselines/indentedAdjacentNodes.xml b/tests/auto/qxmlformatter/baselines/indentedAdjacentNodes.xml
new file mode 100644
index 0000000..a263c75
--- /dev/null
+++ b/tests/auto/qxmlformatter/baselines/indentedAdjacentNodes.xml
@@ -0,0 +1,16 @@
+<e>
+ <?pi1 data1?>
+ <?pi2 data2?>
+ <!-- comment1 -->
+ <!-- comment2 -->
+ <?pi3 data3?>
+ <!-- comment3 -->
+ <?pi4 data4?>
+ <e2>
+ <!-- comment1 -->
+ <!-- comment2 -->
+ <?pi3 data3?>
+ <!-- comment3 -->
+ <?pi4 data4?>
+ </e2>
+</e>
diff --git a/tests/auto/qxmlformatter/baselines/indentedMixedContent.xml b/tests/auto/qxmlformatter/baselines/indentedMixedContent.xml
new file mode 100644
index 0000000..9a9729b
--- /dev/null
+++ b/tests/auto/qxmlformatter/baselines/indentedMixedContent.xml
@@ -0,0 +1,20 @@
+<!-- Already indented, and should stay so.. -->
+<mixedContent>
+ <p>char1<span/>
+ </p>
+ <p>
+ <span/>char2</p>
+ <p>char3<span/>char3</p>
+ <p>
+ <e1>
+ char 4
+ </e1>
+ <e2>
+ <p>char1<span/>
+ </p>
+ <p>
+ <span/>char2</p>
+ <p>char3<span/>char3</p>
+ </e2>
+ </p>
+</mixedContent>
diff --git a/tests/auto/qxmlformatter/baselines/mixedContent.xml b/tests/auto/qxmlformatter/baselines/mixedContent.xml
new file mode 100644
index 0000000..915cd92
--- /dev/null
+++ b/tests/auto/qxmlformatter/baselines/mixedContent.xml
@@ -0,0 +1,17 @@
+<mixedContent>
+ <p>char1<span/>
+ </p>
+ <p>
+ <span/>char2</p>
+ <p>char3<span/>char3</p>
+ <p>
+ <e1>char4</e1>
+ <e2>
+ <p>char1<span/>
+ </p>
+ <p>
+ <span/>char2</p>
+ <p>char3<span/>char3</p>
+ </e2>
+ </p>
+</mixedContent>
diff --git a/tests/auto/qxmlformatter/baselines/mixedTopLevelContent.xml b/tests/auto/qxmlformatter/baselines/mixedTopLevelContent.xml
new file mode 100644
index 0000000..ff072e5
--- /dev/null
+++ b/tests/auto/qxmlformatter/baselines/mixedTopLevelContent.xml
@@ -0,0 +1 @@
+1 2 3<e1/>4<e2/>5<e3>6</e3>7
diff --git a/tests/auto/qxmlformatter/baselines/nodesAndWhitespaceAtomics.xml b/tests/auto/qxmlformatter/baselines/nodesAndWhitespaceAtomics.xml
new file mode 100644
index 0000000..2c660d5
--- /dev/null
+++ b/tests/auto/qxmlformatter/baselines/nodesAndWhitespaceAtomics.xml
@@ -0,0 +1,4 @@
+<e1>
+ <e2/>
+</e1>
+<e3/>
diff --git a/tests/auto/qxmlformatter/baselines/onlyDocumentNode.xml b/tests/auto/qxmlformatter/baselines/onlyDocumentNode.xml
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/auto/qxmlformatter/baselines/onlyDocumentNode.xml
@@ -0,0 +1 @@
+
diff --git a/tests/auto/qxmlformatter/baselines/prolog.xml b/tests/auto/qxmlformatter/baselines/prolog.xml
new file mode 100644
index 0000000..1b48c58
--- /dev/null
+++ b/tests/auto/qxmlformatter/baselines/prolog.xml
@@ -0,0 +1,17 @@
+<!-- comment1 -->
+<!-- comment2 -->
+<!-- comment3 -->
+<?pi1 data?>
+<!-- comment4 -->
+<?pi2 data?>
+<!-- comment5 -->
+<?pi3 data?>
+<e/>
+<!-- comment1 -->
+<!-- comment2 -->
+<!-- comment3 -->
+<?pi1 data?>
+<!-- comment4 -->
+<?pi2 data?>
+<!-- comment5 -->
+<?pi3 data?>
diff --git a/tests/auto/qxmlformatter/baselines/simpleDocument.xml b/tests/auto/qxmlformatter/baselines/simpleDocument.xml
new file mode 100644
index 0000000..5e64f7b
--- /dev/null
+++ b/tests/auto/qxmlformatter/baselines/simpleDocument.xml
@@ -0,0 +1,3 @@
+<!-- A comment -->
+<e>We try to simulate 189611</e>
+<!-- A second comment at the end. -->
diff --git a/tests/auto/qxmlformatter/baselines/singleElement.xml b/tests/auto/qxmlformatter/baselines/singleElement.xml
new file mode 100644
index 0000000..c859d31
--- /dev/null
+++ b/tests/auto/qxmlformatter/baselines/singleElement.xml
@@ -0,0 +1 @@
+<anElement/>
diff --git a/tests/auto/qxmlformatter/baselines/singleTextNode.xml b/tests/auto/qxmlformatter/baselines/singleTextNode.xml
new file mode 100644
index 0000000..47a943b
--- /dev/null
+++ b/tests/auto/qxmlformatter/baselines/singleTextNode.xml
@@ -0,0 +1 @@
+a text node
diff --git a/tests/auto/qxmlformatter/baselines/textNodeAtomicValue.xml b/tests/auto/qxmlformatter/baselines/textNodeAtomicValue.xml
new file mode 100644
index 0000000..1563439
--- /dev/null
+++ b/tests/auto/qxmlformatter/baselines/textNodeAtomicValue.xml
@@ -0,0 +1 @@
+<e>a3</e>
diff --git a/tests/auto/qxmlformatter/baselines/threeAtomics.xml b/tests/auto/qxmlformatter/baselines/threeAtomics.xml
new file mode 100644
index 0000000..dcee688
--- /dev/null
+++ b/tests/auto/qxmlformatter/baselines/threeAtomics.xml
@@ -0,0 +1 @@
+1 2 Bam 3000 10 4
diff --git a/tests/auto/qxmlformatter/input/K2-DirectConElemContent-46.xq b/tests/auto/qxmlformatter/input/K2-DirectConElemContent-46.xq
new file mode 100644
index 0000000..b4ffb53
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/K2-DirectConElemContent-46.xq
@@ -0,0 +1 @@
+<e>{1}{text{()}}{2}</e>
diff --git a/tests/auto/qxmlformatter/input/adjacentNodes.xml b/tests/auto/qxmlformatter/input/adjacentNodes.xml
new file mode 100644
index 0000000..a263c75
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/adjacentNodes.xml
@@ -0,0 +1,16 @@
+<e>
+ <?pi1 data1?>
+ <?pi2 data2?>
+ <!-- comment1 -->
+ <!-- comment2 -->
+ <?pi3 data3?>
+ <!-- comment3 -->
+ <?pi4 data4?>
+ <e2>
+ <!-- comment1 -->
+ <!-- comment2 -->
+ <?pi3 data3?>
+ <!-- comment3 -->
+ <?pi4 data4?>
+ </e2>
+</e>
diff --git a/tests/auto/qxmlformatter/input/adjacentNodes.xq b/tests/auto/qxmlformatter/input/adjacentNodes.xq
new file mode 100644
index 0000000..44605fb
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/adjacentNodes.xq
@@ -0,0 +1 @@
+doc("adjacentNodes.xml")
diff --git a/tests/auto/qxmlformatter/input/classExample.xml b/tests/auto/qxmlformatter/input/classExample.xml
new file mode 100644
index 0000000..b3321f2
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/classExample.xml
@@ -0,0 +1 @@
+<a><b/><c/><p>Some Text</p></a>
diff --git a/tests/auto/qxmlformatter/input/classExample.xq b/tests/auto/qxmlformatter/input/classExample.xq
new file mode 100644
index 0000000..bb10fc0
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/classExample.xq
@@ -0,0 +1 @@
+doc("classExample.xml")
diff --git a/tests/auto/qxmlformatter/input/documentElementWithWS.xml b/tests/auto/qxmlformatter/input/documentElementWithWS.xml
new file mode 100644
index 0000000..636923c
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/documentElementWithWS.xml
@@ -0,0 +1,2 @@
+<doc>
+</doc>
diff --git a/tests/auto/qxmlformatter/input/documentElementWithWS.xq b/tests/auto/qxmlformatter/input/documentElementWithWS.xq
new file mode 100644
index 0000000..cfa5fd6
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/documentElementWithWS.xq
@@ -0,0 +1 @@
+doc('documentElementWithWS.xml')
diff --git a/tests/auto/qxmlformatter/input/documentNodes.xq b/tests/auto/qxmlformatter/input/documentNodes.xq
new file mode 100644
index 0000000..fd8211b
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/documentNodes.xq
@@ -0,0 +1,7 @@
+document{()},
+document{()},
+document{()},
+document{<e/>},
+document{<!-- a comment -->},
+document{<?aPi?>},
+document{()}
diff --git a/tests/auto/qxmlformatter/input/elementsWithWS.xml b/tests/auto/qxmlformatter/input/elementsWithWS.xml
new file mode 100644
index 0000000..7b3e9a3
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/elementsWithWS.xml
@@ -0,0 +1,12 @@
+<doc>
+ someText
+ <ws1> </ws1>
+ somee text
+ <ws2>
+
+ </ws2>
+ <!-- comment -->
+ <ws3>
+ </ws3>
+
+</doc>
diff --git a/tests/auto/qxmlformatter/input/elementsWithWS.xq b/tests/auto/qxmlformatter/input/elementsWithWS.xq
new file mode 100644
index 0000000..6b3bffb
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/elementsWithWS.xq
@@ -0,0 +1 @@
+doc('elementsWithWS.xml')
diff --git a/tests/auto/qxmlformatter/input/emptySequence.xq b/tests/auto/qxmlformatter/input/emptySequence.xq
new file mode 100644
index 0000000..1418a72
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/emptySequence.xq
@@ -0,0 +1,2 @@
+(: This query simply evaluate to an empty sequence. :)
+()
diff --git a/tests/auto/qxmlformatter/input/indentedAdjacentNodes.xml b/tests/auto/qxmlformatter/input/indentedAdjacentNodes.xml
new file mode 100644
index 0000000..a263c75
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/indentedAdjacentNodes.xml
@@ -0,0 +1,16 @@
+<e>
+ <?pi1 data1?>
+ <?pi2 data2?>
+ <!-- comment1 -->
+ <!-- comment2 -->
+ <?pi3 data3?>
+ <!-- comment3 -->
+ <?pi4 data4?>
+ <e2>
+ <!-- comment1 -->
+ <!-- comment2 -->
+ <?pi3 data3?>
+ <!-- comment3 -->
+ <?pi4 data4?>
+ </e2>
+</e>
diff --git a/tests/auto/qxmlformatter/input/indentedAdjacentNodes.xq b/tests/auto/qxmlformatter/input/indentedAdjacentNodes.xq
new file mode 100644
index 0000000..201af14
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/indentedAdjacentNodes.xq
@@ -0,0 +1 @@
+doc("indentedAdjacentNodes.xml")
diff --git a/tests/auto/qxmlformatter/input/indentedMixedContent.xml b/tests/auto/qxmlformatter/input/indentedMixedContent.xml
new file mode 100644
index 0000000..a0340e6
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/indentedMixedContent.xml
@@ -0,0 +1,16 @@
+<!-- Already indented, and should stay so.. -->
+<mixedContent>
+ <p>char1<span/></p>
+ <p><span/>char2</p>
+ <p>char3<span/>char3</p>
+ <p>
+ <e1>
+ char 4
+ </e1>
+ <e2>
+ <p>char1<span/></p>
+ <p><span/>char2</p>
+ <p>char3<span/>char3</p>
+ </e2>
+ </p>
+</mixedContent>
diff --git a/tests/auto/qxmlformatter/input/indentedMixedContent.xq b/tests/auto/qxmlformatter/input/indentedMixedContent.xq
new file mode 100644
index 0000000..6845093
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/indentedMixedContent.xq
@@ -0,0 +1 @@
+doc("indentedMixedContent.xml")
diff --git a/tests/auto/qxmlformatter/input/mixedContent.xml b/tests/auto/qxmlformatter/input/mixedContent.xml
new file mode 100644
index 0000000..2987c44
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/mixedContent.xml
@@ -0,0 +1 @@
+<mixedContent><p>char1<span/></p><p><span/>char2</p><p>char3<span/>char3</p><p><e1>char4</e1><e2><p>char1<span/></p><p><span/>char2</p><p>char3<span/>char3</p></e2></p></mixedContent>
diff --git a/tests/auto/qxmlformatter/input/mixedContent.xq b/tests/auto/qxmlformatter/input/mixedContent.xq
new file mode 100644
index 0000000..ea56c7b
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/mixedContent.xq
@@ -0,0 +1 @@
+doc("mixedContent.xml")
diff --git a/tests/auto/qxmlformatter/input/mixedTopLevelContent.xq b/tests/auto/qxmlformatter/input/mixedTopLevelContent.xq
new file mode 100644
index 0000000..d862ec1
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/mixedTopLevelContent.xq
@@ -0,0 +1,16 @@
+(: Top level atomic values, mixed with elements. :)
+1,
+2,
+3,
+<e1/>,
+4,
+<e2/>,
+5,
+<e3>
+ {
+ (: This is a bit tricky. The receiver is sent the start of an element and then an atomic value. Must not
+ be indented. :)
+ 6
+ }
+</e3>,
+7
diff --git a/tests/auto/qxmlformatter/input/nodesAndWhitespaceAtomics.xq b/tests/auto/qxmlformatter/input/nodesAndWhitespaceAtomics.xq
new file mode 100644
index 0000000..a4b5674
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/nodesAndWhitespaceAtomics.xq
@@ -0,0 +1,13 @@
+xs:string(" "),
+xs:string(" "),
+<e1>
+{
+ xs:string(" "),
+ <e2/>,
+ xs:string(" ")
+}
+</e1>,
+xs:string(" "),
+xs:string(" "),
+<e3/>,
+xs:string(" ")
diff --git a/tests/auto/qxmlformatter/input/onlyDocumentNode.xq b/tests/auto/qxmlformatter/input/onlyDocumentNode.xq
new file mode 100644
index 0000000..c0c40ee
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/onlyDocumentNode.xq
@@ -0,0 +1 @@
+document{ () }
diff --git a/tests/auto/qxmlformatter/input/prolog.xml b/tests/auto/qxmlformatter/input/prolog.xml
new file mode 100644
index 0000000..1b48c58
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/prolog.xml
@@ -0,0 +1,17 @@
+<!-- comment1 -->
+<!-- comment2 -->
+<!-- comment3 -->
+<?pi1 data?>
+<!-- comment4 -->
+<?pi2 data?>
+<!-- comment5 -->
+<?pi3 data?>
+<e/>
+<!-- comment1 -->
+<!-- comment2 -->
+<!-- comment3 -->
+<?pi1 data?>
+<!-- comment4 -->
+<?pi2 data?>
+<!-- comment5 -->
+<?pi3 data?>
diff --git a/tests/auto/qxmlformatter/input/prolog.xq b/tests/auto/qxmlformatter/input/prolog.xq
new file mode 100644
index 0000000..6f4a72b
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/prolog.xq
@@ -0,0 +1 @@
+doc("prolog.xml")
diff --git a/tests/auto/qxmlformatter/input/simpleDocument.xml b/tests/auto/qxmlformatter/input/simpleDocument.xml
new file mode 100644
index 0000000..4bea9bd
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/simpleDocument.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- A comment -->
+<e>We try to simulate 189611</e>
+<!-- A second comment at the end. -->
diff --git a/tests/auto/qxmlformatter/input/simpleDocument.xq b/tests/auto/qxmlformatter/input/simpleDocument.xq
new file mode 100644
index 0000000..73702dd
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/simpleDocument.xq
@@ -0,0 +1 @@
+doc("simpleDocument.xml")
diff --git a/tests/auto/qxmlformatter/input/singleElement.xml b/tests/auto/qxmlformatter/input/singleElement.xml
new file mode 100644
index 0000000..c859d31
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/singleElement.xml
@@ -0,0 +1 @@
+<anElement/>
diff --git a/tests/auto/qxmlformatter/input/singleElement.xq b/tests/auto/qxmlformatter/input/singleElement.xq
new file mode 100644
index 0000000..a37691e
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/singleElement.xq
@@ -0,0 +1 @@
+doc("singleElement.xml")
diff --git a/tests/auto/qxmlformatter/input/singleTextNode.xq b/tests/auto/qxmlformatter/input/singleTextNode.xq
new file mode 100644
index 0000000..5d1e4ff
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/singleTextNode.xq
@@ -0,0 +1 @@
+text{"a text node"}
diff --git a/tests/auto/qxmlformatter/input/textNodeAtomicValue.xq b/tests/auto/qxmlformatter/input/textNodeAtomicValue.xq
new file mode 100644
index 0000000..b3cc124
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/textNodeAtomicValue.xq
@@ -0,0 +1 @@
+<e>a{3}</e>
diff --git a/tests/auto/qxmlformatter/input/threeAtomics.xq b/tests/auto/qxmlformatter/input/threeAtomics.xq
new file mode 100644
index 0000000..e95c3fe
--- /dev/null
+++ b/tests/auto/qxmlformatter/input/threeAtomics.xq
@@ -0,0 +1 @@
+1, 2, "Bam", 3e3, 5 + 5, data(<e>4</e>)
diff --git a/tests/auto/qxmlformatter/qxmlformatter.pro b/tests/auto/qxmlformatter/qxmlformatter.pro
new file mode 100644
index 0000000..e3d16f6
--- /dev/null
+++ b/tests/auto/qxmlformatter/qxmlformatter.pro
@@ -0,0 +1,10 @@
+load(qttest_p4)
+SOURCES += tst_qxmlformatter.cpp
+
+include (../xmlpatterns.pri)
+
+wince*:{
+ addFiles.sources = baselines input
+ addFiles.path = .
+ DEPLOYMENT += addFiles
+}
diff --git a/tests/auto/qxmlformatter/tst_qxmlformatter.cpp b/tests/auto/qxmlformatter/tst_qxmlformatter.cpp
new file mode 100644
index 0000000..db730ad
--- /dev/null
+++ b/tests/auto/qxmlformatter/tst_qxmlformatter.cpp
@@ -0,0 +1,205 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite 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 qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+
+#ifdef QTEST_XMLPATTERNS
+#include <QtXmlPatterns/QXmlFormatter>
+#include <QtXmlPatterns/QXmlQuery>
+
+/*!
+ \class tst_QXmlFormatter
+ \internal
+ \since 4.4
+ \brief Tests class QXmlFormatter.
+
+ This test is not intended for testing the engine, but the functionality specific
+ to the QXmlFormatter class.
+
+ In other words, if you have an engine bug; don't add it here because it won't be
+ tested properly. Instead add it to the test suite.
+
+ */
+class tst_QXmlFormatter : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QXmlFormatter();
+
+private Q_SLOTS:
+ void indentationDepth() const;
+ void setIndentationDepth() const;
+ void constCorrectness() const;
+ void objectSize() const;
+ void format();
+ void format_data() const;
+ void cleanupTestCase() const;
+private:
+ enum
+ {
+ ExpectedTestCount = 19
+ };
+
+ int m_generatedBaselines;
+};
+
+tst_QXmlFormatter::tst_QXmlFormatter() : m_generatedBaselines(0)
+{
+}
+
+void tst_QXmlFormatter::indentationDepth() const
+{
+ /* Check default value. */
+ {
+ QXmlQuery query;
+ QByteArray out;
+ QBuffer buffer(&out);
+ QVERIFY(buffer.open(QIODevice::WriteOnly));
+
+ QXmlFormatter formatter(query, &buffer);
+ QCOMPARE(formatter.indentationDepth(), 4);
+ }
+}
+
+void tst_QXmlFormatter::setIndentationDepth() const
+{
+ QXmlQuery query;
+ QByteArray out;
+ QBuffer buffer(&out);
+ QVERIFY(buffer.open(QIODevice::WriteOnly));
+
+ QXmlFormatter formatter(query, &buffer);
+
+ formatter.setIndentationDepth(1);
+ QCOMPARE(formatter.indentationDepth(), 1);
+
+ formatter.setIndentationDepth(654987);
+ QCOMPARE(formatter.indentationDepth(), 654987);
+}
+
+void tst_QXmlFormatter::constCorrectness() const
+{
+ QXmlQuery query;
+ QByteArray out;
+ QBuffer buffer(&out);
+ QVERIFY(buffer.open(QIODevice::WriteOnly));
+
+ const QXmlFormatter formatter(query, &buffer);
+
+ /* These functions should be const. */
+ formatter.indentationDepth();
+}
+
+void tst_QXmlFormatter::objectSize() const
+{
+ /* We shouldn't add something. */
+ QCOMPARE(sizeof(QXmlFormatter), sizeof(QXmlSerializer));
+}
+
+void tst_QXmlFormatter::format()
+{
+ QFETCH(QString, testName);
+
+ const QString location(QLatin1String("input/") + testName);
+ QFile queryFile(location);
+ QVERIFY(queryFile.open(QIODevice::ReadOnly));
+
+ QXmlQuery query;
+ query.setQuery(&queryFile, QUrl::fromLocalFile(location));
+
+ QByteArray formatted;
+ QBuffer bridge(&formatted);
+ QVERIFY(bridge.open(QIODevice::WriteOnly));
+
+ QXmlFormatter formatter(query, &bridge);
+
+ QVERIFY(query.evaluateTo(&formatter));
+
+ QFile expectedFile(QLatin1String("baselines/") + testName.left(testName.length() - 2) + QString::fromLatin1("xml"));
+
+ if(expectedFile.exists())
+ {
+ QVERIFY(expectedFile.open(QIODevice::ReadOnly));
+ const QByteArray expectedOutput(expectedFile.readAll());
+ QCOMPARE(formatted, expectedOutput);
+ }
+ else
+ {
+ ++m_generatedBaselines;
+ expectedFile.close();
+ QVERIFY(expectedFile.open(QIODevice::WriteOnly));
+ QCOMPARE(expectedFile.write(formatted), qint64(formatted.size()));
+ }
+}
+
+void tst_QXmlFormatter::format_data() const
+{
+ // TODO test with pis and document nodes commencing indentaiton.
+ // TODO atomic values doesn't trigger characters, it seems.
+ QTest::addColumn<QString>("testName");
+
+ QDir dir;
+ dir.cd(QLatin1String("input"));
+
+ const QStringList entries(dir.entryList(QStringList(QLatin1String("*.xq"))));
+ for(int i = 0; i < entries.count(); ++i)
+ {
+ const QString &at = entries.at(i);
+ QTest::newRow(at.toUtf8().constData()) << at;
+ }
+
+ QCOMPARE(int(ExpectedTestCount), entries.count());
+}
+
+void tst_QXmlFormatter::cleanupTestCase() const
+{
+ QCOMPARE(m_generatedBaselines, 0);
+}
+
+QTEST_MAIN(tst_QXmlFormatter)
+
+#include "tst_qxmlformatter.moc"
+#else
+QTEST_NOOP_MAIN
+#endif
+// vim: et:ts=4:sw=4:sts=4