From df73f4115cfe4d07e4159adf087571687eb173ec Mon Sep 17 00:00:00 2001 From: Matúš Kukan Date: Thu, 25 Sep 2014 23:26:28 +0200 Subject: Remove unused files and move test to qa/ Change-Id: Ia8c022c958f5547d710f9cb196672b89292bbb49 --- unoxml/CppunitTest_unoxml_domtest.mk | 2 +- unoxml/qa/unit/domtest.cxx | 334 ++++++++++++++++++++++++++++++++++ unoxml/test/domtest.cxx | 336 ----------------------------------- unoxml/test/export.map | 25 --- unoxml/test/makefile.mk | 95 ---------- 5 files changed, 335 insertions(+), 457 deletions(-) create mode 100644 unoxml/qa/unit/domtest.cxx delete mode 100644 unoxml/test/domtest.cxx delete mode 100644 unoxml/test/export.map delete mode 100644 unoxml/test/makefile.mk (limited to 'unoxml') diff --git a/unoxml/CppunitTest_unoxml_domtest.mk b/unoxml/CppunitTest_unoxml_domtest.mk index 692d51c5498a..127a76776ef4 100644 --- a/unoxml/CppunitTest_unoxml_domtest.mk +++ b/unoxml/CppunitTest_unoxml_domtest.mk @@ -10,7 +10,7 @@ $(eval $(call gb_CppunitTest_CppunitTest,unoxml_domtest)) $(eval $(call gb_CppunitTest_add_exception_objects,unoxml_domtest, \ - unoxml/test/domtest \ + unoxml/qa/unit/domtest \ )) $(eval $(call gb_CppunitTest_use_api,unoxml_domtest,\ diff --git a/unoxml/qa/unit/domtest.cxx b/unoxml/qa/unit/domtest.cxx new file mode 100644 index 000000000000..49eefe0997eb --- /dev/null +++ b/unoxml/qa/unit/domtest.cxx @@ -0,0 +1,334 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +using namespace ::comphelper; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using css::xml::dom::XDocumentBuilder; +using css::xml::dom::DocumentBuilder; + +namespace +{ +// valid xml +static const char validTestFile[] = +" \ + \ + \ + \ + \ + \ + some text \303\266\303\244\303\274 \ + \ +"; + +// generates a warning: unsupported xml version, unknown xml:space +// value +static const char warningTestFile[] = +" \ + \ + \ + \ + \ +"; + +// \ + \ + \ + \ + \ +"; + +// plain empty +static const char fatalTestFile[] = ""; + +struct ErrorHandler + : public ::cppu::WeakImplHelper1< xml::sax::XErrorHandler > +{ + sal_uInt32 mnErrCount; + sal_uInt32 mnFatalCount; + sal_uInt32 mnWarnCount; + + bool noErrors() const { return !mnErrCount && !mnFatalCount && !mnWarnCount; } + + ErrorHandler() : mnErrCount(0), mnFatalCount(0), mnWarnCount(0) + {} + + virtual void SAL_CALL error( const uno::Any& ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE + { + ++mnErrCount; + } + + virtual void SAL_CALL fatalError( const uno::Any& ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE + { + ++mnFatalCount; + } + + virtual void SAL_CALL warning( const uno::Any& ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE + { + ++mnWarnCount; + } +}; + +struct DocumentHandler + : public ::cppu::WeakImplHelper1< xml::sax::XFastDocumentHandler > +{ + // XFastContextHandler + virtual void SAL_CALL startFastElement( ::sal_Int32 Element, const uno::Reference< xml::sax::XFastAttributeList >& ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE + { + OSL_TRACE("Seen element: %c with namespace 0x%x", + Element & 0xFFFF, Element & 0xFFFF0000); + } + + virtual void SAL_CALL startUnknownElement( const OUString& , const OUString& , const uno::Reference< xml::sax::XFastAttributeList >& ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE + { + } + + virtual void SAL_CALL endFastElement( ::sal_Int32 ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE + { + } + + virtual void SAL_CALL endUnknownElement( const OUString&, const OUString& ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE + { + } + + virtual uno::Reference< xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 , const uno::Reference< xml::sax::XFastAttributeList >& ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE + { + return this; + } + + virtual uno::Reference< xml::sax::XFastContextHandler > SAL_CALL createUnknownChildContext( const OUString& , const OUString& , const uno::Reference< xml::sax::XFastAttributeList >& ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE + { + return this; + } + + virtual void SAL_CALL characters( const OUString& ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE + { + } + + // XFastDocumentHandler + virtual void SAL_CALL startDocument( ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE + { + } + + virtual void SAL_CALL endDocument( ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE + { + } + + virtual void SAL_CALL setDocumentLocator( const uno::Reference< xml::sax::XLocator >& ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE + { + } +}; + +struct TokenHandler + : public ::cppu::WeakImplHelper1< xml::sax::XFastTokenHandler > +{ + virtual ::sal_Int32 SAL_CALL getTokenFromUTF8( const uno::Sequence< ::sal_Int8 >& Identifier ) throw (uno::RuntimeException) SAL_OVERRIDE + { + OSL_TRACE("getTokenFromUTF8() %s", (const char*)Identifier.getConstArray()); + return Identifier.getLength() ? Identifier[0] : 0; + } + + virtual uno::Sequence< ::sal_Int8 > SAL_CALL getUTF8Identifier( ::sal_Int32 ) throw (uno::RuntimeException) SAL_OVERRIDE + { + CPPUNIT_ASSERT_MESSAGE( "TokenHandler::getUTF8Identifier() unexpected call", + false ); + return uno::Sequence(); + } +}; + +struct BasicTest : public test::BootstrapFixture +{ + uno::Reference mxDomBuilder; + rtl::Reference mxErrHandler; + rtl::Reference mxValidInStream; + rtl::Reference mxWarningInStream; + rtl::Reference mxErrorInStream; + rtl::Reference mxFatalInStream; + + virtual void setUp() SAL_OVERRIDE + { + test::BootstrapFixture::setUp(); + + mxErrHandler.set( new ErrorHandler() ); + uno::Reference xDB( getMultiServiceFactory()->createInstance(OUString("com.sun.star.xml.dom.DocumentBuilder")), uno::UNO_QUERY_THROW ); + mxDomBuilder.set( xDB ); + mxValidInStream.set( new SequenceInputStream(css::uno::Sequence((sal_Int8*)validTestFile, SAL_N_ELEMENTS(validTestFile))) ); + mxWarningInStream.set( new SequenceInputStream(css::uno::Sequence((sal_Int8*)warningTestFile, SAL_N_ELEMENTS(warningTestFile))) ); + mxErrorInStream.set( new SequenceInputStream(css::uno::Sequence((sal_Int8*)errorTestFile, SAL_N_ELEMENTS(errorTestFile))) ); + mxFatalInStream.set( new SequenceInputStream(css::uno::Sequence((sal_Int8*)fatalTestFile, SAL_N_ELEMENTS(fatalTestFile))) ); + mxDomBuilder->setErrorHandler(mxErrHandler.get()); + } + + void validInputTest() + { + CPPUNIT_ASSERT_MESSAGE( "Valid input file did not result in XDocument #1", + mxDomBuilder->parse( + uno::Reference( + mxValidInStream.get())).is() ); + CPPUNIT_ASSERT_MESSAGE( "Valid input file resulted in parse errors", + mxErrHandler->noErrors() ); + } +/* + void warningInputTest() + { + CPPUNIT_ASSERT_MESSAGE( "Valid input file did not result in XDocument #2", + mxDomBuilder->parse( + uno::Reference( + mxWarningInStream.get())).is() ); + CPPUNIT_ASSERT_MESSAGE( "No parse warnings in unclean input file", + mxErrHandler->mnWarnCount && !mxErrHandler->mnErrCount && !mxErrHandler->mnFatalCount ); + } + + void errorInputTest() + { + CPPUNIT_ASSERT_MESSAGE( "Valid input file did not result in XDocument #3", + mxDomBuilder->parse( + uno::Reference( + mxErrorInStream.get())).is() ); + CPPUNIT_ASSERT_MESSAGE( "No parse errors in unclean input file", + !mxErrHandler->mnWarnCount && mxErrHandler->mnErrCount && !mxErrHandler->mnFatalCount ); + } + + void fatalInputTest() + { + CPPUNIT_ASSERT_MESSAGE( "Broken input file resulted in XDocument", + !mxDomBuilder->parse( + uno::Reference( + mxFatalInStream.get())).is() ); + CPPUNIT_ASSERT_MESSAGE( "No fatal parse errors in unclean input file", + !mxErrHandler->mnWarnCount && !mxErrHandler->mnErrCount && mxErrHandler->mnFatalCount ); + }; +*/ + // Change the following lines only, if you add, remove or rename + // member functions of the current class, + // because these macros are need by auto register mechanism. + CPPUNIT_TEST_SUITE(BasicTest); + CPPUNIT_TEST(validInputTest); + //CPPUNIT_TEST(warningInputTest); + //CPPUNIT_TEST(errorInputTest); + //CPPUNIT_TEST(fatalInputTest); + CPPUNIT_TEST_SUITE_END(); +}; + +struct SerializerTest : public test::BootstrapFixture +{ + uno::Reference mxDomBuilder; + rtl::Reference mxErrHandler; + rtl::Reference mxInStream; + rtl::Reference mxHandler; + rtl::Reference mxTokHandler; + uno::Sequence< beans::Pair< OUString, sal_Int32 > > maRegisteredNamespaces; + + void setUp() SAL_OVERRIDE + { + test::BootstrapFixture::setUp(); + + mxErrHandler.set( new ErrorHandler() ); + uno::Reference xDB( getMultiServiceFactory()->createInstance(OUString("com.sun.star.xml.dom.DocumentBuilder")), uno::UNO_QUERY_THROW ); + mxDomBuilder.set( xDB ); + mxInStream.set( new SequenceInputStream(css::uno::Sequence((sal_Int8*)validTestFile, SAL_N_ELEMENTS(validTestFile))) ); + mxDomBuilder->setErrorHandler(mxErrHandler.get()); + mxHandler.set( new DocumentHandler() ); + mxTokHandler.set( new TokenHandler() ); + + maRegisteredNamespaces.realloc(2); + maRegisteredNamespaces[0] = beans::make_Pair( + OUString( "urn:oasis:names:tc:opendocument:xmlns:office:1.0" ), + xml::sax::FastToken::NAMESPACE); + maRegisteredNamespaces[1] = beans::make_Pair( + OUString( "http://www.w3.org/1999/xlink" ), + 2*xml::sax::FastToken::NAMESPACE); + } + + void serializerTest () + { + uno::Reference< xml::dom::XDocument > xDoc= + mxDomBuilder->parse( + uno::Reference( + mxInStream.get())); + CPPUNIT_ASSERT_MESSAGE( "Valid input file did not result in XDocument", + xDoc.is() ); + CPPUNIT_ASSERT_MESSAGE( "Valid input file resulted in parse errors", + mxErrHandler->noErrors() ); + + uno::Reference< xml::sax::XSAXSerializable > xSaxSerializer( + xDoc, uno::UNO_QUERY); + CPPUNIT_ASSERT_MESSAGE( "XSAXSerializable not supported", + xSaxSerializer.is() ); + + uno::Reference< xml::sax::XFastSAXSerializable > xFastSaxSerializer( + xDoc, uno::UNO_QUERY); + CPPUNIT_ASSERT_MESSAGE( "XFastSAXSerializable not supported", + xSaxSerializer.is() ); + + xFastSaxSerializer->fastSerialize( mxHandler.get(), + mxTokHandler.get(), + uno::Sequence< beans::StringPair >(), + maRegisteredNamespaces ); + } + + // Change the following lines only, if you add, remove or rename + // member functions of the current class, + // because these macros are need by auto register mechanism. + + CPPUNIT_TEST_SUITE(SerializerTest); + CPPUNIT_TEST(serializerTest); + CPPUNIT_TEST_SUITE_END(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(BasicTest); +CPPUNIT_TEST_SUITE_REGISTRATION(SerializerTest); +} + +// this macro creates an empty function, which will called by the RegisterAllFunctions() +// to let the user the possibility to also register some functions by hand. +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/test/domtest.cxx b/unoxml/test/domtest.cxx deleted file mode 100644 index 07d173807c12..000000000000 --- a/unoxml/test/domtest.cxx +++ /dev/null @@ -1,336 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include "../source/dom/documentbuilder.hxx" - -using namespace ::DOM; -using namespace ::comphelper; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using css::xml::dom::XDocumentBuilder; -using css::xml::dom::DocumentBuilder; - -namespace -{ -// valid xml -static const char validTestFile[] = -" \ - \ - \ - \ - \ - \ - some text \303\266\303\244\303\274 \ - \ -"; - -// generates a warning: unsupported xml version, unknown xml:space -// value -static const char warningTestFile[] = -" \ - \ - \ - \ - \ -"; - -// \ - \ - \ - \ - \ -"; - -// plain empty -static const char fatalTestFile[] = ""; - -struct ErrorHandler - : public ::cppu::WeakImplHelper1< xml::sax::XErrorHandler > -{ - sal_uInt32 mnErrCount; - sal_uInt32 mnFatalCount; - sal_uInt32 mnWarnCount; - - bool noErrors() const { return !mnErrCount && !mnFatalCount && !mnWarnCount; } - - ErrorHandler() : mnErrCount(0), mnFatalCount(0), mnWarnCount(0) - {} - - virtual void SAL_CALL error( const uno::Any& ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE - { - ++mnErrCount; - } - - virtual void SAL_CALL fatalError( const uno::Any& ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE - { - ++mnFatalCount; - } - - virtual void SAL_CALL warning( const uno::Any& ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE - { - ++mnWarnCount; - } -}; - -struct DocumentHandler - : public ::cppu::WeakImplHelper1< xml::sax::XFastDocumentHandler > -{ - // XFastContextHandler - virtual void SAL_CALL startFastElement( ::sal_Int32 Element, const uno::Reference< xml::sax::XFastAttributeList >& ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE - { - OSL_TRACE("Seen element: %c with namespace 0x%x", - Element & 0xFFFF, Element & 0xFFFF0000); - } - - virtual void SAL_CALL startUnknownElement( const OUString& , const OUString& , const uno::Reference< xml::sax::XFastAttributeList >& ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE - { - } - - virtual void SAL_CALL endFastElement( ::sal_Int32 ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE - { - } - - virtual void SAL_CALL endUnknownElement( const OUString&, const OUString& ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE - { - } - - virtual uno::Reference< xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 , const uno::Reference< xml::sax::XFastAttributeList >& ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE - { - return this; - } - - virtual uno::Reference< xml::sax::XFastContextHandler > SAL_CALL createUnknownChildContext( const OUString& , const OUString& , const uno::Reference< xml::sax::XFastAttributeList >& ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE - { - return this; - } - - virtual void SAL_CALL characters( const OUString& ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE - { - } - - // XFastDocumentHandler - virtual void SAL_CALL startDocument( ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE - { - } - - virtual void SAL_CALL endDocument( ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE - { - } - - virtual void SAL_CALL setDocumentLocator( const uno::Reference< xml::sax::XLocator >& ) throw (xml::sax::SAXException, uno::RuntimeException) SAL_OVERRIDE - { - } -}; - -struct TokenHandler - : public ::cppu::WeakImplHelper1< xml::sax::XFastTokenHandler > -{ - virtual ::sal_Int32 SAL_CALL getTokenFromUTF8( const uno::Sequence< ::sal_Int8 >& Identifier ) throw (uno::RuntimeException) SAL_OVERRIDE - { - OSL_TRACE("getTokenFromUTF8() %s", (const char*)Identifier.getConstArray()); - return Identifier.getLength() ? Identifier[0] : 0; - } - - virtual uno::Sequence< ::sal_Int8 > SAL_CALL getUTF8Identifier( ::sal_Int32 ) throw (uno::RuntimeException) SAL_OVERRIDE - { - CPPUNIT_ASSERT_MESSAGE( "TokenHandler::getUTF8Identifier() unexpected call", - false ); - return uno::Sequence(); - } -}; - -struct BasicTest : public test::BootstrapFixture -{ - uno::Reference mxDomBuilder; - rtl::Reference mxErrHandler; - rtl::Reference mxValidInStream; - rtl::Reference mxWarningInStream; - rtl::Reference mxErrorInStream; - rtl::Reference mxFatalInStream; - - virtual void setUp() SAL_OVERRIDE - { - test::BootstrapFixture::setUp(); - - mxErrHandler.set( new ErrorHandler() ); - uno::Reference xDB( getMultiServiceFactory()->createInstance(OUString("com.sun.star.xml.dom.DocumentBuilder")), uno::UNO_QUERY_THROW ); - mxDomBuilder.set( xDB ); - mxValidInStream.set( new SequenceInputStream(css::uno::Sequence((sal_Int8*)validTestFile, SAL_N_ELEMENTS(validTestFile))) ); - mxWarningInStream.set( new SequenceInputStream(css::uno::Sequence((sal_Int8*)warningTestFile, SAL_N_ELEMENTS(warningTestFile))) ); - mxErrorInStream.set( new SequenceInputStream(css::uno::Sequence((sal_Int8*)errorTestFile, SAL_N_ELEMENTS(errorTestFile))) ); - mxFatalInStream.set( new SequenceInputStream(css::uno::Sequence((sal_Int8*)fatalTestFile, SAL_N_ELEMENTS(fatalTestFile))) ); - mxDomBuilder->setErrorHandler(mxErrHandler.get()); - } - - void validInputTest() - { - CPPUNIT_ASSERT_MESSAGE( "Valid input file did not result in XDocument #1", - mxDomBuilder->parse( - uno::Reference( - mxValidInStream.get())).is() ); - CPPUNIT_ASSERT_MESSAGE( "Valid input file resulted in parse errors", - mxErrHandler->noErrors() ); - } -/* - void warningInputTest() - { - CPPUNIT_ASSERT_MESSAGE( "Valid input file did not result in XDocument #2", - mxDomBuilder->parse( - uno::Reference( - mxWarningInStream.get())).is() ); - CPPUNIT_ASSERT_MESSAGE( "No parse warnings in unclean input file", - mxErrHandler->mnWarnCount && !mxErrHandler->mnErrCount && !mxErrHandler->mnFatalCount ); - } - - void errorInputTest() - { - CPPUNIT_ASSERT_MESSAGE( "Valid input file did not result in XDocument #3", - mxDomBuilder->parse( - uno::Reference( - mxErrorInStream.get())).is() ); - CPPUNIT_ASSERT_MESSAGE( "No parse errors in unclean input file", - !mxErrHandler->mnWarnCount && mxErrHandler->mnErrCount && !mxErrHandler->mnFatalCount ); - } - - void fatalInputTest() - { - CPPUNIT_ASSERT_MESSAGE( "Broken input file resulted in XDocument", - !mxDomBuilder->parse( - uno::Reference( - mxFatalInStream.get())).is() ); - CPPUNIT_ASSERT_MESSAGE( "No fatal parse errors in unclean input file", - !mxErrHandler->mnWarnCount && !mxErrHandler->mnErrCount && mxErrHandler->mnFatalCount ); - }; -*/ - // Change the following lines only, if you add, remove or rename - // member functions of the current class, - // because these macros are need by auto register mechanism. - CPPUNIT_TEST_SUITE(BasicTest); - CPPUNIT_TEST(validInputTest); - //CPPUNIT_TEST(warningInputTest); - //CPPUNIT_TEST(errorInputTest); - //CPPUNIT_TEST(fatalInputTest); - CPPUNIT_TEST_SUITE_END(); -}; - -struct SerializerTest : public test::BootstrapFixture -{ - uno::Reference mxDomBuilder; - rtl::Reference mxErrHandler; - rtl::Reference mxInStream; - rtl::Reference mxHandler; - rtl::Reference mxTokHandler; - uno::Sequence< beans::Pair< OUString, sal_Int32 > > maRegisteredNamespaces; - - void setUp() SAL_OVERRIDE - { - test::BootstrapFixture::setUp(); - - mxErrHandler.set( new ErrorHandler() ); - uno::Reference xDB( getMultiServiceFactory()->createInstance(OUString("com.sun.star.xml.dom.DocumentBuilder")), uno::UNO_QUERY_THROW ); - mxDomBuilder.set( xDB ); - mxInStream.set( new SequenceInputStream(css::uno::Sequence((sal_Int8*)validTestFile, SAL_N_ELEMENTS(validTestFile))) ); - mxDomBuilder->setErrorHandler(mxErrHandler.get()); - mxHandler.set( new DocumentHandler() ); - mxTokHandler.set( new TokenHandler() ); - - maRegisteredNamespaces.realloc(2); - maRegisteredNamespaces[0] = beans::make_Pair( - OUString( "urn:oasis:names:tc:opendocument:xmlns:office:1.0" ), - xml::sax::FastToken::NAMESPACE); - maRegisteredNamespaces[1] = beans::make_Pair( - OUString( "http://www.w3.org/1999/xlink" ), - 2*xml::sax::FastToken::NAMESPACE); - } - - void serializerTest () - { - uno::Reference< xml::dom::XDocument > xDoc= - mxDomBuilder->parse( - uno::Reference( - mxInStream.get())); - CPPUNIT_ASSERT_MESSAGE( "Valid input file did not result in XDocument", - xDoc.is() ); - CPPUNIT_ASSERT_MESSAGE( "Valid input file resulted in parse errors", - mxErrHandler->noErrors() ); - - uno::Reference< xml::sax::XSAXSerializable > xSaxSerializer( - xDoc, uno::UNO_QUERY); - CPPUNIT_ASSERT_MESSAGE( "XSAXSerializable not supported", - xSaxSerializer.is() ); - - uno::Reference< xml::sax::XFastSAXSerializable > xFastSaxSerializer( - xDoc, uno::UNO_QUERY); - CPPUNIT_ASSERT_MESSAGE( "XFastSAXSerializable not supported", - xSaxSerializer.is() ); - - xFastSaxSerializer->fastSerialize( mxHandler.get(), - mxTokHandler.get(), - uno::Sequence< beans::StringPair >(), - maRegisteredNamespaces ); - } - - // Change the following lines only, if you add, remove or rename - // member functions of the current class, - // because these macros are need by auto register mechanism. - - CPPUNIT_TEST_SUITE(SerializerTest); - CPPUNIT_TEST(serializerTest); - CPPUNIT_TEST_SUITE_END(); -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(BasicTest); -CPPUNIT_TEST_SUITE_REGISTRATION(SerializerTest); -} - -// this macro creates an empty function, which will called by the RegisterAllFunctions() -// to let the user the possibility to also register some functions by hand. -CPPUNIT_PLUGIN_IMPLEMENT(); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/test/export.map b/unoxml/test/export.map deleted file mode 100644 index 06b6a4a9286b..000000000000 --- a/unoxml/test/export.map +++ /dev/null @@ -1,25 +0,0 @@ -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.apache.org/licenses/LICENSE-2.0 . -# - -UDK_3_0_0 { - global: - registerAllTestFunction; - - local: - *; -}; diff --git a/unoxml/test/makefile.mk b/unoxml/test/makefile.mk deleted file mode 100644 index 682cedb2a624..000000000000 --- a/unoxml/test/makefile.mk +++ /dev/null @@ -1,95 +0,0 @@ -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.apache.org/licenses/LICENSE-2.0 . -# - -PRJ=.. - -PRJNAME=unoxml -TARGET=tests -TARGETTYPE=GUI - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -CFLAGSCXX += $(CPPUNIT_CFLAGS) - -# --- Common ---------------------------------------------------------- - -# BEGIN ---------------------------------------------------------------- -# auto generated Target:tests by codegen.pl -SHL1OBJS= \ - $(SLO)$/domtest.obj - -# the following three libs are a bit of a hack: cannot link against -# unoxml here, because not yet delivered (and does not export -# ~anything). Need the functionality to test, so we're linking it in -# statically. Need to keep this in sync with -# source/services/makefile.mk -SHL1LIBS= \ - $(SLB)$/domimpl.lib \ - $(SLB)$/xpathimpl.lib \ - $(SLB)$/eventsimpl.lib - -SHL1TARGET= tests -SHL1STDLIBS= \ - $(UCBHELPERLIB) \ - $(LIBXML2LIB) \ - $(TOOLSLIB) \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPUNITLIB) \ - $(CPPULIB) \ - $(SAXLIB) \ - $(SALLIB)\ - $(EXPATASCII3RDLIB) - -SHL1IMPLIB= i$(SHL1TARGET) - -DEF1NAME =$(SHL1TARGET) -SHL1VERSIONMAP = export.map - -# END ------------------------------------------------------------------ - -#------------------------------- All object files ------------------------------- -# do this here, so we get right dependencies -SLOFILES=$(SHL1OBJS) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk -.INCLUDE : _cppunit.mk - -# --- Fake uno bootstrap ------------------------ - -$(BIN)$/unoxml_unittest_test.ini : makefile.mk - rm -f $@ - @echo UNO_SERVICES= > $@ - @echo UNO_TYPES=$(UNOUCRRDB:s/\/\\/) >> $@ - -# --- Enable testshl2 execution in normal build ------------------------ - -$(MISC)$/unoxml_unittest_succeeded : $(SHL1TARGETN) $(BIN)$/unoxml_unittest_test.ini - @echo ---------------------------------------------------------- - @echo - start unit test on library $(SHL1TARGETN) - @echo ---------------------------------------------------------- - $(TESTSHL2) -forward $(BIN)$/ -sf $(mktmp ) $(SHL1TARGETN) - $(TOUCH) $@ - -ALLTAR : $(MISC)$/unoxml_unittest_succeeded -- cgit v1.2.3