[Libreoffice-commits] core.git: 3 commits - sax/CppunitTest_sax_parser.mk sax/qa sax/source sw/source
Matúš Kukan
matus.kukan at collabora.com
Thu Sep 18 06:36:23 PDT 2014
sax/CppunitTest_sax_parser.mk | 2 -
sax/qa/cppunit/parser.cxx | 39 ++++++++++++++++++++++++++++++++---
sax/source/fastparser/fastparser.cxx | 3 ++
sw/source/core/graphic/ndgrf.cxx | 9 --------
4 files changed, 41 insertions(+), 12 deletions(-)
New commits:
commit 6503be5311716cf520cf534ca1bb0fd595b93d72
Author: Matúš Kukan <matus.kukan at collabora.com>
Date: Thu Sep 18 10:03:50 2014 +0200
fastparser: Use dummy token handler in unit test instead of an oox one.
Change-Id: I4562156858982857a17e8837106c4c946f175be7
diff --git a/sax/CppunitTest_sax_parser.mk b/sax/CppunitTest_sax_parser.mk
index 3308428..d5ede46 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 293ba5f..c6a32c5 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()
commit d7350545ac6c54f07d59c66ccd3b889180e65f4d
Author: Matúš Kukan <matus.kukan at collabora.com>
Date: Thu Sep 18 08:38:14 2014 +0200
Better to throw than crash, if token handler is not set.
Change-Id: If6b2d39b487b5f673d5b6b2945a6e7d08777594e
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 37b5133..fcbb58d 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -781,6 +781,9 @@ void FastSaxParserImpl::parseStream(const InputSource& maStructSource)
Entity entity( maData );
entity.maStructSource = maStructSource;
+ if( !entity.mxTokenHandler.is() )
+ throw SAXException("No token handler, use setTokenHandler()", Reference< XInterface >(), Any() );
+
if( !entity.maStructSource.aInputStream.is() )
throw SAXException("No input source", Reference< XInterface >(), Any() );
commit 1ef778072763a539809c74804ef074c556efe501
Author: Matúš Kukan <matus.kukan at collabora.com>
Date: Wed Sep 17 20:29:20 2014 +0200
Remove special case which is handled differently now
Since 3914a711060341345f15b83656457f90095f32d6 rGrfName is empty.
It was added in 363f1c1462963f6f032de07649dc9c4d02b4e446
Change-Id: I4ec3b432399708db4acb6af1af69df4c0aaa181c
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 539027c..280c6d4 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -77,14 +77,7 @@ SwGrfNode::SwGrfNode(
bFrameInPaint = bScaleImageMap = false;
bGraphicArrived = true;
-
- // fdo#50763 inline image has already been read into memory
- if (rGrfName.startsWith("data:")) {
- maGrfObj.SetGraphic( *pGraphic, rGrfName );
- }
- else {
- ReRead(rGrfName,rFltName, pGraphic, 0, false);
- }
+ ReRead(rGrfName, rFltName, pGraphic, 0, false);
}
SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
More information about the Libreoffice-commits
mailing list