summaryrefslogtreecommitdiffstats
path: root/tests/auto/xml
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-12-30 15:51:05 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-03 02:57:12 +0100
commitfda36df6babf20bcfd04a54a1336a9c26e72a8ef (patch)
tree0c09018e6db15ea40e156b38854e224e62e9130f /tests/auto/xml
parent39f3ee8a5dd499cf86f95e7fc9200eb3226b16be (diff)
Use true and false in preference to TRUE and FALSE in tests.
Use the C++ boolean constants true and false instead of the C macros TRUE and FALSE (which are actually integers), and use QVERIFY instead of QCOMPARE for verifying simple boolean expressions. Change-Id: Ie76dfcab6722df6b93b3fa62b0f3437901482932 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/xml')
-rw-r--r--tests/auto/xml/dom/qdom/tst_qdom.cpp64
-rw-r--r--tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp52
2 files changed, 58 insertions, 58 deletions
diff --git a/tests/auto/xml/dom/qdom/tst_qdom.cpp b/tests/auto/xml/dom/qdom/tst_qdom.cpp
index 734d7b473b..a206271a13 100644
--- a/tests/auto/xml/dom/qdom/tst_qdom.cpp
+++ b/tests/auto/xml/dom/qdom/tst_qdom.cpp
@@ -261,11 +261,11 @@ void tst_QDom::setContent()
QStringList::Iterator it;
for ( it = featuresTrue.begin(); it != featuresTrue.end(); ++it ) {
QVERIFY( reader.hasFeature( *it ) );
- reader.setFeature( *it, TRUE );
+ reader.setFeature( *it, true );
}
for ( it = featuresFalse.begin(); it != featuresFalse.end(); ++it ) {
QVERIFY( reader.hasFeature( *it ) );
- reader.setFeature( *it, FALSE );
+ reader.setFeature( *it, false );
}
QDomDocument domDoc;
@@ -386,7 +386,7 @@ void tst_QDom::hasAttributes_data()
}
/*
- This function tests that QDomNode::hasAttributes() returns TRUE if and only
+ This function tests that QDomNode::hasAttributes() returns true if and only
if the node has attributes (i.e. QDomNode::attributes() returns a list with
attributes in it).
*/
@@ -588,13 +588,13 @@ void tst_QDom::cloneNode_data()
QTest::addColumn<QList<QVariant> >("pathToNode");
QTest::addColumn<bool>("deep");
- QTest::newRow( "noDeep_01" ) << doc01 << nodeB1 << (bool)FALSE;
- QTest::newRow( "noDeep_02" ) << doc01 << nodeC1 << (bool)FALSE;
- QTest::newRow( "noDeep_03" ) << doc01 << nodeC2 << (bool)FALSE;
+ QTest::newRow( "noDeep_01" ) << doc01 << nodeB1 << false;
+ QTest::newRow( "noDeep_02" ) << doc01 << nodeC1 << false;
+ QTest::newRow( "noDeep_03" ) << doc01 << nodeC2 << false;
- QTest::newRow( "deep_01" ) << doc01 << nodeB1 << (bool)TRUE;
- QTest::newRow( "deep_02" ) << doc01 << nodeC1 << (bool)TRUE;
- QTest::newRow( "deep_03" ) << doc01 << nodeC2 << (bool)TRUE;
+ QTest::newRow( "deep_01" ) << doc01 << nodeB1 << true;
+ QTest::newRow( "deep_02" ) << doc01 << nodeC1 << true;
+ QTest::newRow( "deep_03" ) << doc01 << nodeC2 << true;
}
void tst_QDom::cloneNode()
@@ -732,14 +732,14 @@ void tst_QDom::ownerDocumentTask27424_data()
QTest::addColumn<bool>("insertLevel2AfterCstr");
QTest::addColumn<bool>("insertLevel3AfterCstr");
- QTest::newRow( "000" ) << (bool)FALSE << (bool)FALSE << (bool)FALSE;
- QTest::newRow( "001" ) << (bool)FALSE << (bool)FALSE << (bool)TRUE;
- QTest::newRow( "010" ) << (bool)FALSE << (bool)TRUE << (bool)FALSE;
- QTest::newRow( "011" ) << (bool)FALSE << (bool)TRUE << (bool)TRUE;
- QTest::newRow( "100" ) << (bool)TRUE << (bool)FALSE << (bool)FALSE;
- QTest::newRow( "101" ) << (bool)TRUE << (bool)FALSE << (bool)TRUE;
- QTest::newRow( "110" ) << (bool)TRUE << (bool)TRUE << (bool)FALSE;
- QTest::newRow( "111" ) << (bool)TRUE << (bool)TRUE << (bool)TRUE;
+ QTest::newRow( "000" ) << false << false << false;
+ QTest::newRow( "001" ) << false << false << true;
+ QTest::newRow( "010" ) << false << true << false;
+ QTest::newRow( "011" ) << false << true << true;
+ QTest::newRow( "100" ) << true << false << false;
+ QTest::newRow( "101" ) << true << false << true;
+ QTest::newRow( "110" ) << true << true << false;
+ QTest::newRow( "111" ) << true << true << true;
}
void tst_QDom::ownerDocumentTask27424()
@@ -858,14 +858,14 @@ void tst_QDom::documentCreationTask27424_data()
QTest::addColumn<bool>("insertLevel2AfterCstr");
QTest::addColumn<bool>("insertLevel3AfterCstr");
- QTest::newRow( "000" ) << (bool)FALSE << (bool)FALSE << (bool)FALSE;
- QTest::newRow( "001" ) << (bool)FALSE << (bool)FALSE << (bool)TRUE;
- QTest::newRow( "010" ) << (bool)FALSE << (bool)TRUE << (bool)FALSE;
- QTest::newRow( "011" ) << (bool)FALSE << (bool)TRUE << (bool)TRUE;
- QTest::newRow( "100" ) << (bool)TRUE << (bool)FALSE << (bool)FALSE;
- QTest::newRow( "101" ) << (bool)TRUE << (bool)FALSE << (bool)TRUE;
- QTest::newRow( "110" ) << (bool)TRUE << (bool)TRUE << (bool)FALSE;
- QTest::newRow( "111" ) << (bool)TRUE << (bool)TRUE << (bool)TRUE;
+ QTest::newRow( "000" ) << false << false << false;
+ QTest::newRow( "001" ) << false << false << true;
+ QTest::newRow( "010" ) << false << true << false;
+ QTest::newRow( "011" ) << false << true << true;
+ QTest::newRow( "100" ) << true << false << false;
+ QTest::newRow( "101" ) << true << false << true;
+ QTest::newRow( "110" ) << true << true << false;
+ QTest::newRow( "111" ) << true << true << true;
}
void tst_QDom::documentCreationTask27424()
@@ -961,9 +961,9 @@ bool tst_QDom::isDeepEqual(const QDomNode &n1, const QDomNode &n2)
}
/*
- Returns TRUE if \a doc1 and \a doc2 represent the same XML document, i.e.
+ Returns true if \a doc1 and \a doc2 represent the same XML document, i.e.
they have the same informational content. Otherwise, this function returns
- FALSE.
+ false.
*/
bool tst_QDom::compareDocuments( const QDomDocument &doc1, const QDomDocument &doc2 )
{
@@ -971,12 +971,12 @@ bool tst_QDom::compareDocuments( const QDomDocument &doc1, const QDomDocument &d
}
/*
- Returns TRUE if \a node1 and \a node2 represent the same XML node, i.e.
+ Returns true if \a node1 and \a node2 represent the same XML node, i.e.
they have the same informational content. Otherwise, this function returns
- FALSE.
+ false.
- If \a deep is TRUE, children of the nodes are also tested. If \a deep is
- FALSE, only \a node1 and \a node 2 are compared.
+ If \a deep is true, children of the nodes are also tested. If \a deep is
+ false, only \a node1 and \a node 2 are compared.
*/
bool tst_QDom::compareNodes( const QDomNode &node1, const QDomNode &node2, bool deep )
{
@@ -995,7 +995,7 @@ bool tst_QDom::compareNodes( const QDomNode &node1, const QDomNode &node2, bool
}
if ( node1.isNull() && node2.isNull() )
- return TRUE;
+ return true;
// ### I am not sure if this test is complete
bool equal = node1.nodeName() == node2.nodeName();
equal = equal && node1.nodeType() == node2.nodeType();
diff --git a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp
index d1f1c3cfda..99a833231e 100644
--- a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp
+++ b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp
@@ -124,7 +124,7 @@ bool ContentHandler::startDocument()
m_result += nestPrefix();
m_result += "startDocument()\n";
++m_nest;
- return TRUE;
+ return true;
}
bool ContentHandler::endDocument()
@@ -132,7 +132,7 @@ bool ContentHandler::endDocument()
--m_nest;
m_result += nestPrefix();
m_result += "endDocument()\n";
- return TRUE;
+ return true;
}
bool ContentHandler::startElement(const QString &namespaceURI,
@@ -146,7 +146,7 @@ bool ContentHandler::startElement(const QString &namespaceURI,
+ "\", qName=\"" + escapeStr(qName)
+ "\", atts=[" + formatAttributes(atts) + "])\n";
++m_nest;
- return TRUE;
+ return true;
}
QString ContentHandler::escapeStr(const QString &s)
@@ -183,14 +183,14 @@ bool ContentHandler::endElement(const QString &namespaceURI,
m_result += "endElement(namespaceURI=\"" + escapeStr(namespaceURI)
+ "\", localName=\"" + escapeStr(localName)
+ "\", qName=\"" + escapeStr(qName) + "\")\n";
- return TRUE;
+ return true;
}
bool ContentHandler::characters(const QString &ch)
{
m_result += nestPrefix();
m_result += "characters(ch=\"" + escapeStr(ch) + "\")\n";
- return TRUE;
+ return true;
}
void ContentHandler::setDocumentLocator(QXmlLocator *locator)
@@ -208,7 +208,7 @@ bool ContentHandler::startPrefixMapping (const QString &prefix, const QString &
m_result += "startPrefixMapping(prefix=\"" + escapeStr(prefix)
+ "\", uri=\"" + escapeStr(uri) + "\")\n";
++m_nest;
- return TRUE;
+ return true;
}
bool ContentHandler::endPrefixMapping(const QString &prefix)
@@ -216,14 +216,14 @@ bool ContentHandler::endPrefixMapping(const QString &prefix)
--m_nest;
m_result += nestPrefix();
m_result += "endPrefixMapping(prefix=\"" + escapeStr(prefix) + "\")\n";
- return TRUE;
+ return true;
}
bool ContentHandler::ignorableWhitespace(const QString & ch)
{
m_result += nestPrefix();
m_result += "ignorableWhitespace(ch=\"" + escapeStr(ch) + "\")\n";
- return TRUE;
+ return true;
}
bool ContentHandler::processingInstruction(const QString &target, const QString &data)
@@ -231,14 +231,14 @@ bool ContentHandler::processingInstruction(const QString &target, const QString
m_result += nestPrefix();
m_result += "processingInstruction(target=\"" + escapeStr(target)
+ "\", data=\"" + escapeStr(data) + "\")\n";
- return TRUE;
+ return true;
}
bool ContentHandler::skippedEntity (const QString & name)
{
m_result += nestPrefix();
m_result += "skippedEntity(name=\"" + escapeStr(name) + "\")\n";
- return TRUE;
+ return true;
}
bool ContentHandler::warning(const QXmlParseException & exception)
@@ -256,7 +256,7 @@ bool ContentHandler::warning(const QXmlParseException & exception)
+ "\", systemId=\"" + escapeStr(exception.systemId())
+ "\", message=\"" + escapeStr(exception.message())
+ "\"})\n";
- return TRUE;
+ return true;
}
bool ContentHandler::error(const QXmlParseException & exception)
@@ -274,7 +274,7 @@ bool ContentHandler::error(const QXmlParseException & exception)
+ "\", systemId=\"" + escapeStr(exception.systemId())
+ "\", message=\"" + escapeStr(exception.message())
+ "\"})\n";
- return TRUE;
+ return true;
}
bool ContentHandler::fatalError(const QXmlParseException & exception)
@@ -292,7 +292,7 @@ bool ContentHandler::fatalError(const QXmlParseException & exception)
+ "\", systemId=\"" + escapeStr(exception.systemId())
+ "\", message=\"" + escapeStr(exception.message())
+ "\"})\n";
- return TRUE;
+ return true;
}
bool ContentHandler::notationDecl ( const QString & name,
@@ -303,7 +303,7 @@ bool ContentHandler::notationDecl ( const QString & name,
m_result += "notationDecl(name=\"" + escapeStr(name) + "\", publicId=\""
+ escapeStr(publicId) + "\", systemId=\""
+ escapeStr(systemId) + "\")\n";
- return TRUE;
+ return true;
}
bool ContentHandler::unparsedEntityDecl ( const QString & name,
@@ -317,7 +317,7 @@ bool ContentHandler::unparsedEntityDecl ( const QString & name,
+ "\", systemId=\"" + escapeStr(systemId)
+ "\", notationName=\"" + escapeStr(notationName)
+ "\")\n";
- return TRUE;
+ return true;
}
bool ContentHandler::resolveEntity(const QString & publicId,
@@ -328,7 +328,7 @@ bool ContentHandler::resolveEntity(const QString & publicId,
m_result += "resolveEntity(publicId=\"" + escapeStr(publicId)
+ "\", systemId=\"" + escapeStr(systemId)
+ "\", ret={})\n";
- return TRUE;
+ return true;
}
bool ContentHandler::startDTD ( const QString & name, const QString & publicId, const QString & systemId )
@@ -338,7 +338,7 @@ bool ContentHandler::startDTD ( const QString & name, const QString & publicId,
+ "\", publicId=\"" + escapeStr(publicId)
+ "\", systemId=\"" + escapeStr(systemId) + "\")\n";
++m_nest;
- return TRUE;
+ return true;
}
bool ContentHandler::endDTD ()
@@ -346,7 +346,7 @@ bool ContentHandler::endDTD ()
--m_nest;
m_result += nestPrefix();
m_result += "endDTD()\n";
- return TRUE;
+ return true;
}
bool ContentHandler::startEntity ( const QString & name )
@@ -354,7 +354,7 @@ bool ContentHandler::startEntity ( const QString & name )
m_result += nestPrefix();
m_result += "startEntity(name=\"" + escapeStr(name) + "\")\n";
++m_nest;
- return TRUE;
+ return true;
}
bool ContentHandler::endEntity ( const QString & name )
@@ -362,7 +362,7 @@ bool ContentHandler::endEntity ( const QString & name )
--m_nest;
m_result += nestPrefix();
m_result += "endEntity(name=\"" + escapeStr(name) + "\")\n";
- return TRUE;
+ return true;
}
bool ContentHandler::startCDATA ()
@@ -370,7 +370,7 @@ bool ContentHandler::startCDATA ()
m_result += nestPrefix();
m_result += "startCDATA()\n";
++m_nest;
- return TRUE;
+ return true;
}
bool ContentHandler::endCDATA ()
@@ -378,14 +378,14 @@ bool ContentHandler::endCDATA ()
--m_nest;
m_result += nestPrefix();
m_result += "endCDATA()\n";
- return TRUE;
+ return true;
}
bool ContentHandler::comment ( const QString & ch )
{
m_result += nestPrefix();
m_result += "comment(ch=\"" + escapeStr(ch) + "\")\n";
- return TRUE;
+ return true;
}
bool ContentHandler::attributeDecl ( const QString & eName,
@@ -399,7 +399,7 @@ bool ContentHandler::attributeDecl ( const QString & eName,
+ escapeStr(aName) + "\", type=\"" + escapeStr(type)
+ "\", valueDefault=\"" + escapeStr(valueDefault)
+ "\", value=\"" + escapeStr(value) + "\")\n";
- return TRUE;
+ return true;
}
bool ContentHandler::internalEntityDecl ( const QString & name,
@@ -408,7 +408,7 @@ bool ContentHandler::internalEntityDecl ( const QString & name,
m_result += nestPrefix();
m_result += "internatlEntityDecl(name=\"" + escapeStr(name)
+ "\", value=\"" + escapeStr(value) + "\")\n";
- return TRUE;
+ return true;
}
bool ContentHandler::externalEntityDecl ( const QString & name,
@@ -419,7 +419,7 @@ bool ContentHandler::externalEntityDecl ( const QString & name,
m_result += "externalEntityDecl(name=\"" + escapeStr(name)
+ "\", publicId=\"" + escapeStr(publicId)
+ "\", systemId=\"" + escapeStr(systemId) + "\")\n";
- return TRUE;
+ return true;
}
Parser::Parser()