summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestjunitstreamer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/testlib/qtestjunitstreamer.cpp')
-rw-r--r--src/testlib/qtestjunitstreamer.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/testlib/qtestjunitstreamer.cpp b/src/testlib/qtestjunitstreamer.cpp
index 9c3a9c9ca5..844f80f90c 100644
--- a/src/testlib/qtestjunitstreamer.cpp
+++ b/src/testlib/qtestjunitstreamer.cpp
@@ -176,13 +176,12 @@ void QTestJUnitStreamer::outputElements(QTestElement *element, bool) const
{
QTestCharBuffer buf;
bool hasChildren;
- /*
- Elements are in reverse order of occurrence, so start from the end and work
- our way backwards.
- */
- while (element && element->nextElement()) {
+
+ // Elements are in reverse order of occurrence, so
+ // start from the end and work our way backwards.
+ while (element && element->nextElement())
element = element->nextElement();
- }
+
while (element) {
hasChildren = element->childElements();
@@ -208,10 +207,16 @@ void QTestJUnitStreamer::outputElements(QTestElement *element, bool) const
void QTestJUnitStreamer::outputElementAttributes(const QTestElement* element, QTestElementAttribute *attribute) const
{
QTestCharBuffer buf;
+
+ // Attributes are in reverse order of occurrence, so
+ // start from the end and work our way backwards.
+ while (attribute && attribute->nextElement())
+ attribute = attribute->nextElement();
+
while (attribute) {
formatAttributes(element, attribute, &buf);
outputString(buf.data());
- attribute = attribute->nextElement();
+ attribute = attribute->previousElement();
}
}