[Libreoffice-commits] .: 2 commits - sw/qa writerfilter/source
Miklos Vajna
vmiklos at kemper.freedesktop.org
Mon Aug 13 02:04:31 PDT 2012
dev/null |binary
sw/qa/extras/odfimport/data/fdo53210.odt |binary
sw/qa/extras/odfimport/odfimport.cxx | 23 +++++++++++++++--------
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 5 -----
writerfilter/source/rtftok/rtfdocumentimpl.hxx | 3 +--
writerfilter/source/rtftok/rtftokenizer.cxx | 4 ++--
6 files changed, 18 insertions(+), 17 deletions(-)
New commits:
commit 10e02dfdffb5ef3a02a40b52c6cda176f7f4447c
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Mon Aug 13 10:59:26 2012 +0200
fdo#53210 testcase
Change-Id: I23606a7601b71890acf7e260951e1bacc0fc2df9
diff --git a/sw/qa/extras/odfimport/data/fdo53210.odt b/sw/qa/extras/odfimport/data/fdo53210.odt
new file mode 100644
index 0000000..cfa5044
Binary files /dev/null and b/sw/qa/extras/odfimport/data/fdo53210.odt differ
diff --git a/sw/qa/extras/odfimport/data/hello.odt b/sw/qa/extras/odfimport/data/hello.odt
deleted file mode 100644
index 23ce6a4..0000000
Binary files a/sw/qa/extras/odfimport/data/hello.odt and /dev/null differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index d473893..ef51e31 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -32,13 +32,13 @@ using rtl::OUString;
class Test : public SwModelTestBase
{
public:
- void testHello();
void testEmptySvgFamilyName();
+ void testHideAllSections();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
- CPPUNIT_TEST(testHello);
CPPUNIT_TEST(testEmptySvgFamilyName);
+ CPPUNIT_TEST(testHideAllSections);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -52,18 +52,25 @@ void Test::load(const OUString& rFilename)
mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/odfimport/data/") + rFilename);
}
-void Test::testHello()
-{
- load("hello.odt");
- CPPUNIT_ASSERT_EQUAL(12, getLength());
-}
-
void Test::testEmptySvgFamilyName()
{
// .odt import did crash on the empty font list (which I think is valid according SVG spec)
load( "empty-svg-family-name.odt" );
}
+void Test::testHideAllSections()
+{
+ // This document has a section that is conditionally hidden, but has no empty paragraph after it.
+ load("fdo53210.odt");
+ uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xMasters = xTextFieldsSupplier->getTextFieldMasters();
+ // Set _CS_Allgemein to 0
+ uno::Reference<beans::XPropertySet> xMaster(xMasters->getByName("com.sun.star.text.fieldmaster.User._CS_Allgemein"), uno::UNO_QUERY);
+ xMaster->setPropertyValue("Content", uno::makeAny(OUString("0")));
+ // This used to crash
+ uno::Reference<util::XRefreshable>(xTextFieldsSupplier->getTextFields(), uno::UNO_QUERY)->refresh();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
commit 7b87ccf916547b4d59d0e892519600a2bf53b867
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Mon Aug 13 10:45:42 2012 +0200
drop unnecessary RTFDocumentImpl::isEmpty
Change-Id: I657266697c30be0760971528adb1abf07f03ea23
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index adfb18c..2d66ed3 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3902,11 +3902,6 @@ int RTFDocumentImpl::getGroup() const
return m_nGroup;
}
-bool RTFDocumentImpl::isEmpty() const
-{
- return m_aStates.empty();
-}
-
void RTFDocumentImpl::setDestinationText(OUString& rString)
{
m_aStates.top().aDestinationText.setLength(0);
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index c05a0f5..0759a4c 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -424,8 +424,7 @@ namespace writerfilter {
void seek(sal_uInt32 nPos);
uno::Reference<lang::XMultiServiceFactory> getModelFactory();
RTFParserState& getState();
- /// If the stack of states is empty.
- bool isEmpty() const;
+ /// Number of states on the stack.
int getGroup() const;
void setDestinationText(rtl::OUString& rString);
/// Resolve a picture: If not inline, then anchored.
diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx b/writerfilter/source/rtftok/rtftokenizer.cxx
index e596aae..abe8cff 100644
--- a/writerfilter/source/rtftok/rtftokenizer.cxx
+++ b/writerfilter/source/rtftok/rtftokenizer.cxx
@@ -95,7 +95,7 @@ int RTFTokenizer::resolveParse()
if (m_rImport.getGroup() < 0)
return ERROR_GROUP_UNDER;
- if (!m_rImport.isEmpty() && m_rImport.getState().nInternalState == INTERNAL_BIN)
+ if (m_rImport.getGroup() > 0 && m_rImport.getState().nInternalState == INTERNAL_BIN)
{
ret = m_rImport.resolveChars(ch);
if (ret)
@@ -130,7 +130,7 @@ int RTFTokenizer::resolveParse()
case 0x0a:
break; // ignore these
default:
- if (m_rImport.isEmpty())
+ if (m_rImport.getGroup() == 0)
return ERROR_CHAR_OVER;
if (m_rImport.getState().nInternalState == INTERNAL_NORMAL)
{
More information about the Libreoffice-commits
mailing list