diff options
author | Jakub Wieczorek <faw217@gmail.com> | 2010-05-26 09:50:57 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-05-26 10:00:47 (GMT) |
commit | e0dc3b88abc9c4bcd6c3710c458c4948e5b8a912 (patch) | |
tree | 0bb9c59a9629decd81bf69652c9bd4497ba50e51 /tests | |
parent | 058fa44c7aba859c3383f912da4f976c896f921d (diff) | |
download | Qt-e0dc3b88abc9c4bcd6c3710c458c4948e5b8a912.zip Qt-e0dc3b88abc9c4bcd6c3710c458c4948e5b8a912.tar.gz Qt-e0dc3b88abc9c4bcd6c3710c458c4948e5b8a912.tar.bz2 |
QXmlStreamWriter: Auto-formatting does not behave properly with processing instructions.
When writing a processing instruction with auto-formatting enabled, it should
put it in a new line for readability and apply the indentation properly.
Merge-request: 620
Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qxmlstream/tst_qxmlstream.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/qxmlstream/tst_qxmlstream.cpp b/tests/auto/qxmlstream/tst_qxmlstream.cpp index 3c5358c..f93d4fc 100644 --- a/tests/auto/qxmlstream/tst_qxmlstream.cpp +++ b/tests/auto/qxmlstream/tst_qxmlstream.cpp @@ -546,6 +546,7 @@ private slots: void writerHangs() const; void writerAutoFormattingWithComments() const; void writerAutoFormattingWithTabs() const; + void writerAutoFormattingWithProcessingInstructions() const; void writerAutoEmptyTags() const; void writeAttributesWithSpace() const; void addExtraNamespaceDeclarations(); @@ -1030,6 +1031,22 @@ void tst_QXmlStream::writerAutoFormattingWithTabs() const QCOMPARE(buffer.buffer().data(), str); } +void tst_QXmlStream::writerAutoFormattingWithProcessingInstructions() const +{ + QBuffer buffer; + buffer.open(QIODevice::WriteOnly); + + QXmlStreamWriter writer(&buffer); + writer.setAutoFormatting(true); + writer.writeStartDocument(); + writer.writeProcessingInstruction("B", "C"); + writer.writeStartElement("A"); + writer.writeEndElement(); + writer.writeEndDocument(); + const char *str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?B C?>\n<A/>\n"; + QCOMPARE(buffer.buffer().data(), str); +} + /*! Task 204822 */ |