diff options
Diffstat (limited to 'lib/kofficecore/tests/kodomtest.cpp')
-rw-r--r-- | lib/kofficecore/tests/kodomtest.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/lib/kofficecore/tests/kodomtest.cpp b/lib/kofficecore/tests/kodomtest.cpp index c8e3c539..14cae56e 100644 --- a/lib/kofficecore/tests/kodomtest.cpp +++ b/lib/kofficecore/tests/kodomtest.cpp @@ -20,17 +20,17 @@ #include "KoDom.h" #include "KoXmlNS.h" -#include <qapplication.h> +#include <tqapplication.h> #include <assert.h> -//static void debugElemNS( const QDomElement& elem ) +//static void debugElemNS( const TQDomElement& elem ) //{ // qDebug( "nodeName=%s tagName=%s localName=%s prefix=%s namespaceURI=%s", elem.nodeName().latin1(), elem.tagName().latin1(), elem.localName().latin1(), elem.prefix().latin1(), elem.namespaceURI().latin1() ); //} -void testQDom( const QDomDocument& doc ) +void testTQDom( const TQDomDocument& doc ) { - QDomElement docElem = doc.documentElement(); + TQDomElement docElem = doc.documentElement(); //debugElemNS( docElem ); assert( docElem.nodeName() == "o:document-content" ); assert( docElem.tagName() == "document-content" ); @@ -39,21 +39,21 @@ void testQDom( const QDomDocument& doc ) assert( docElem.namespaceURI() == KoXmlNS::office ); // WARNING, elementsByTagNameNS is recursive!!! - QDomNodeList docElemChildren = docElem.elementsByTagNameNS( KoXmlNS::office, "body" ); + TQDomNodeList docElemChildren = docElem.elementsByTagNameNS( KoXmlNS::office, "body" ); assert( docElemChildren.length() == 1 ); - QDomElement elem = docElemChildren.item( 0 ).toElement(); + TQDomElement elem = docElemChildren.item( 0 ).toElement(); //debugElemNS( elem ); assert( elem.tagName() == "body" ); assert( elem.localName() == "body" ); assert( elem.prefix() == "o" ); assert( elem.namespaceURI() == KoXmlNS::office ); - QDomNode n = elem.firstChild(); + TQDomNode n = elem.firstChild(); for ( ; !n.isNull() ; n = n.nextSibling() ) { if ( !n.isElement() ) continue; - QDomElement e = n.toElement(); + TQDomElement e = n.toElement(); //debugElemNS( e ); assert( e.tagName() == "p" ); assert( e.localName() == "p" ); @@ -61,35 +61,35 @@ void testQDom( const QDomDocument& doc ) assert( e.namespaceURI() == KoXmlNS::text ); } - qDebug("testQDom... ok"); + qDebug("testTQDom... ok"); } -void testKoDom( const QDomDocument& doc ) +void testKoDom( const TQDomDocument& doc ) { - QDomElement docElem = KoDom::namedItemNS( doc, KoXmlNS::office, "document-content" ); + TQDomElement docElem = KoDom::namedItemNS( doc, KoXmlNS::office, "document-content" ); assert( !docElem.isNull() ); assert( docElem.localName() == "document-content" ); assert( docElem.namespaceURI() == KoXmlNS::office ); - QDomElement body = KoDom::namedItemNS( docElem, KoXmlNS::office, "body" ); + TQDomElement body = KoDom::namedItemNS( docElem, KoXmlNS::office, "body" ); assert( !body.isNull() ); assert( body.localName() == "body" ); assert( body.namespaceURI() == KoXmlNS::office ); - QDomElement p = KoDom::namedItemNS( body, KoXmlNS::text, "p" ); + TQDomElement p = KoDom::namedItemNS( body, KoXmlNS::text, "p" ); assert( !p.isNull() ); assert( p.localName() == "p" ); assert( p.namespaceURI() == KoXmlNS::text ); - const QDomElement officeStyle = KoDom::namedItemNS( docElem, KoXmlNS::office, "styles" ); + const TQDomElement officeStyle = KoDom::namedItemNS( docElem, KoXmlNS::office, "styles" ); assert( !officeStyle.isNull() ); // Look for a non-existing element - QDomElement notexist = KoDom::namedItemNS( body, KoXmlNS::text, "notexist" ); + TQDomElement notexist = KoDom::namedItemNS( body, KoXmlNS::text, "notexist" ); assert( notexist.isNull() ); int count = 0; - QDomElement elem; + TQDomElement elem; forEachElement( elem, body ) { assert( elem.localName() == "p" ); assert( elem.namespaceURI() == KoXmlNS::text ); @@ -98,8 +98,8 @@ void testKoDom( const QDomDocument& doc ) assert( count == 2 ); // Attributes - // ### Qt bug: it doesn't work if using style-name instead of text:style-name in the XML - const QString styleName = p.attributeNS( KoXmlNS::text, "style-name", QString::null ); + // ### TQt bug: it doesn't work if using style-name instead of text:style-name in the XML + const TQString styleName = p.attributeNS( KoXmlNS::text, "style-name", TQString() ); qDebug( "%s", styleName.latin1() ); assert( styleName == "L1" ); @@ -107,9 +107,9 @@ void testKoDom( const QDomDocument& doc ) } int main( int argc, char** argv ) { - QApplication app( argc, argv, QApplication::Tty ); + TQApplication app( argc, argv, TQApplication::Tty ); - const QCString xml = QCString( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + const TQCString xml = TQCString( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<o:document-content xmlns:o=\"" ) + KoXmlNS::office + "\" xmlns=\"" + KoXmlNS::text @@ -117,13 +117,13 @@ int main( int argc, char** argv ) { + "\">\n" "<o:body><p text:style-name=\"L1\">foobar</p><p>2nd</p></o:body><o:styles></o:styles>\n" "</o:document-content>\n"; - QDomDocument doc; - //QXmlSimpleReader reader; + TQDomDocument doc; + //TQXmlSimpleReader reader; //reader.setFeature( "http://xml.org/sax/features/namespaces", TRUE ); //reader.setFeature( "http://xml.org/sax/features/namespace-prefixes", FALSE ); bool ok = doc.setContent( xml, true /* namespace processing */ ); assert( ok ); - testQDom(doc); + testTQDom(doc); testKoDom(doc); } |