summaryrefslogtreecommitdiffstats
path: root/sw/qa/extras/odfexport/odfexport2.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa/extras/odfexport/odfexport2.cxx')
-rw-r--r--sw/qa/extras/odfexport/odfexport2.cxx119
1 files changed, 119 insertions, 0 deletions
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx
index 6db396c40d..37e744e9c8 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -102,6 +102,26 @@ DECLARE_ODFEXPORT_TEST(testTdf77961, "tdf77961.odt")
CPPUNIT_ASSERT_EQUAL( false , getProperty<bool>(xStyle, "GridPrint"));
}
+CPPUNIT_TEST_FIXTURE(Test, testTdf106733)
+{
+ loadAndReload("tdf106733.fodt");
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
+ xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
+
+ // keep fo:hyphenate="false" in direct formatting
+ assertXPath(
+ pXmlDoc,
+ "//style:style[@style:name='T3']/style:text-properties"_ostr,
+ "hyphenate"_ostr, "false");
+
+ // keep fo:hyphenate="false" in character style
+ xmlDocUniquePtr pXmlDoc2 = parseExport("styles.xml");
+ assertXPath(
+ pXmlDoc2,
+ "//style:style[@style:name='Strong_20_Emphasis']/style:text-properties"_ostr,
+ "hyphenate"_ostr, "false");
+}
+
DECLARE_ODFEXPORT_TEST(testReferenceLanguage, "referencelanguage.odt")
{
CPPUNIT_ASSERT_EQUAL(2, getPages());
@@ -1128,6 +1148,105 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf150408_IsLegal)
"is-legal"_ostr, "true");
}
+CPPUNIT_TEST_FIXTURE(Test, testTdf159382)
+{
+ // Testing NoGapAfterNoteNumber compat option
+
+ createSwDoc("footnote_spacing_hanging_para.docx");
+ // 1. Make sure that DOCX import sets NoGapAfterNoteNumber option, and creates
+ // correct layout
+ {
+ uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xSettings(
+ xFactory->createInstance(u"com.sun.star.document.Settings"_ustr), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_EQUAL(uno::Any(true), xSettings->getPropertyValue(
+ u"NoGapAfterNoteNumber"_ustr));
+
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+ sal_Int32 width
+ = getXPath(pXmlDoc,
+ "/root/page/ftncont/ftn/txt/SwParaPortion/SwLineLayout/SwFieldPortion"_ostr,
+ "width"_ostr)
+ .toInt32();
+ CPPUNIT_ASSERT(width);
+ CPPUNIT_ASSERT_LESS(sal_Int32(100), width); // It was 720, i.e. 0.5 inch
+ }
+
+ saveAndReload(mpFilter);
+ // 2. Make sure that exported document has NoGapAfterNoteNumber option set,
+ // and has correct layout
+ {
+ xmlDocUniquePtr pXmlDoc = parseExport("settings.xml");
+ assertXPathContent(
+ pXmlDoc,
+ "//config:config-item[@config:name='NoGapAfterNoteNumber']"_ostr,
+ "true");
+
+ uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xSettings(
+ xFactory->createInstance(u"com.sun.star.document.Settings"_ustr), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_EQUAL(uno::Any(true), xSettings->getPropertyValue(
+ u"NoGapAfterNoteNumber"_ustr));
+
+ pXmlDoc = parseLayoutDump();
+ sal_Int32 width = getXPath(
+ pXmlDoc, "/root/page/ftncont/ftn/txt/SwParaPortion/SwLineLayout/SwFieldPortion"_ostr,
+ "width"_ostr).toInt32();
+ CPPUNIT_ASSERT(width);
+ CPPUNIT_ASSERT_LESS(sal_Int32(100), width);
+ }
+
+ createSwDoc("footnote_spacing_hanging_para.doc");
+ // 3. Make sure that DOC import sets NoGapAfterNoteNumber option, and creates
+ // correct layout
+ {
+ uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xSettings(
+ xFactory->createInstance(u"com.sun.star.document.Settings"_ustr), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_EQUAL(uno::Any(true), xSettings->getPropertyValue(
+ u"NoGapAfterNoteNumber"_ustr));
+
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+ sal_Int32 width
+ = getXPath(pXmlDoc,
+ "/root/page/ftncont/ftn/txt/SwParaPortion/SwLineLayout/SwFieldPortion"_ostr,
+ "width"_ostr)
+ .toInt32();
+ CPPUNIT_ASSERT(width);
+ CPPUNIT_ASSERT_LESS(sal_Int32(100), width);
+ }
+
+ createSwDoc("footnote_spacing_hanging_para.rtf");
+ // 4. Make sure that RTF import sets NoGapAfterNoteNumber option, and creates
+ // correct layout
+ {
+ uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xSettings(
+ xFactory->createInstance(u"com.sun.star.document.Settings"_ustr), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_EQUAL(uno::Any(true), xSettings->getPropertyValue(
+ u"NoGapAfterNoteNumber"_ustr));
+
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+ sal_Int32 width
+ = getXPath(pXmlDoc,
+ "/root/page/ftncont/ftn/txt/SwParaPortion/SwLineLayout/SwFieldPortion"_ostr,
+ "width"_ostr)
+ .toInt32();
+ CPPUNIT_ASSERT(width);
+ CPPUNIT_ASSERT_LESS(sal_Int32(100), width);
+ }
+
+ createSwDoc();
+ // 5. Make sure that a new Writer document has this setting set to false
+ {
+ uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xSettings(
+ xFactory->createInstance(u"com.sun.star.document.Settings"_ustr), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_EQUAL(uno::Any(false), xSettings->getPropertyValue(
+ u"NoGapAfterNoteNumber"_ustr));
+ }
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */