From 10e02dfdffb5ef3a02a40b52c6cda176f7f4447c Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 13 Aug 2012 10:59:26 +0200 Subject: fdo#53210 testcase Change-Id: I23606a7601b71890acf7e260951e1bacc0fc2df9 --- sw/qa/extras/odfimport/data/fdo53210.odt | Bin 0 -> 11355 bytes sw/qa/extras/odfimport/data/hello.odt | Bin 8159 -> 0 bytes sw/qa/extras/odfimport/odfimport.cxx | 23 +++++++++++++++-------- 3 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 sw/qa/extras/odfimport/data/fdo53210.odt delete mode 100644 sw/qa/extras/odfimport/data/hello.odt diff --git a/sw/qa/extras/odfimport/data/fdo53210.odt b/sw/qa/extras/odfimport/data/fdo53210.odt new file mode 100644 index 000000000000..cfa504409391 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 23ce6a4db9af..000000000000 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 d4738932d8e2..ef51e318ceba 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 xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xMasters = xTextFieldsSupplier->getTextFieldMasters(); + // Set _CS_Allgemein to 0 + uno::Reference 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(xTextFieldsSupplier->getTextFields(), uno::UNO_QUERY)->refresh(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); -- cgit v1.2.3