summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-09-18 10:03:50 +0200
committerMatúš Kukan <matus.kukan@collabora.com>2014-09-18 15:34:44 +0200
commit6503be5311716cf520cf534ca1bb0fd595b93d72 (patch)
tree55378a6ec2f7268bb634088d5234d352e09c0d43
parentd7350545ac6c54f07d59c66ccd3b889180e65f4d (diff)
fastparser: Use dummy token handler in unit test instead of an oox one.
Change-Id: I4562156858982857a17e8837106c4c946f175be7
-rw-r--r--sax/CppunitTest_sax_parser.mk2
-rw-r--r--sax/qa/cppunit/parser.cxx39
2 files changed, 37 insertions, 4 deletions
diff --git a/sax/CppunitTest_sax_parser.mk b/sax/CppunitTest_sax_parser.mk
index 330842804acf..d5ede466dc8b 100644
--- a/sax/CppunitTest_sax_parser.mk
+++ b/sax/CppunitTest_sax_parser.mk
@@ -16,6 +16,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sax_parser, \
$(eval $(call gb_CppunitTest_use_libraries,sax_parser, \
comphelper \
cppu \
+ cppuhelper \
sal \
test \
$(gb_UWINAPI) \
@@ -34,7 +35,6 @@ $(eval $(call gb_CppunitTest_use_components,sax_parser,\
configmgr/source/configmgr \
framework/util/fwk \
i18npool/util/i18npool \
- oox/util/oox \
sax/source/expatwrap/expwrap \
sfx2/util/sfx \
ucb/source/core/ucb1 \
diff --git a/sax/qa/cppunit/parser.cxx b/sax/qa/cppunit/parser.cxx
index 293ba5f63b1d..c6a32c56a949 100644
--- a/sax/qa/cppunit/parser.cxx
+++ b/sax/qa/cppunit/parser.cxx
@@ -11,10 +11,11 @@
#include <com/sun/star/io/Pipe.hpp>
#include <com/sun/star/xml/sax/FastParser.hpp>
-#include <com/sun/star/xml/sax/FastTokenHandler.hpp>
+#include <com/sun/star/xml/sax/FastToken.hpp>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
#include <com/sun/star/xml/sax/XFastParser.hpp>
+#include <cppuhelper/implbase1.hxx>
#include <test/bootstrapfixture.hxx>
using namespace css;
@@ -22,11 +23,43 @@ using namespace css::xml::sax;
namespace {
+class DummyTokenHandler : public cppu::WeakImplHelper1< xml::sax::XFastTokenHandler >
+{
+public:
+ DummyTokenHandler() {}
+ virtual ~DummyTokenHandler() {}
+
+ virtual sal_Int32 SAL_CALL getToken( const OUString& )
+ throw (uno::RuntimeException, std::exception) SAL_OVERRIDE
+ {
+ CPPUNIT_ASSERT_MESSAGE( "getToken: unexpected call", false );
+ return FastToken::DONTKNOW;
+ }
+ virtual OUString SAL_CALL getIdentifier( sal_Int32 )
+ throw (uno::RuntimeException, std::exception) SAL_OVERRIDE
+ {
+ CPPUNIT_ASSERT_MESSAGE( "getIdentifier: unexpected call", false );
+ return OUString();
+ }
+ virtual sal_Int32 SAL_CALL getTokenFromUTF8( const uno::Sequence<sal_Int8>& )
+ throw (uno::RuntimeException, std::exception) SAL_OVERRIDE
+ {
+ return FastToken::DONTKNOW;
+ }
+ virtual uno::Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 )
+ throw (uno::RuntimeException, std::exception) SAL_OVERRIDE
+ {
+ CPPUNIT_ASSERT_MESSAGE( "getUTF8Identifier: unexpected call", false );
+ return uno::Sequence<sal_Int8>();
+ }
+};
+
class ParserTest: public test::BootstrapFixture
{
InputSource maInput;
uno::Reference< XFastParser > mxParser;
uno::Reference< XFastDocumentHandler > mxDocumentHandler;
+ uno::Reference< DummyTokenHandler > mxTokenHandler;
public:
virtual void setUp() SAL_OVERRIDE;
@@ -46,8 +79,8 @@ void ParserTest::setUp()
{
test::BootstrapFixture::setUp();
mxParser = css::xml::sax::FastParser::create(m_xContext);
- mxParser->setTokenHandler(
- css::xml::sax::FastTokenHandler::create(m_xContext));
+ mxTokenHandler.set( new DummyTokenHandler() );
+ mxParser->setTokenHandler( mxTokenHandler );
}
void ParserTest::tearDown()