summaryrefslogtreecommitdiff
path: root/sax/qa
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 /sax/qa
parentd7350545ac6c54f07d59c66ccd3b889180e65f4d (diff)
fastparser: Use dummy token handler in unit test instead of an oox one.
Change-Id: I4562156858982857a17e8837106c4c946f175be7
Diffstat (limited to 'sax/qa')
-rw-r--r--sax/qa/cppunit/parser.cxx39
1 files changed, 36 insertions, 3 deletions
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()