diff options
author | Justin Luth <justin.luth@collabora.com> | 2019-12-21 16:10:03 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-01-03 12:13:12 +0100 |
commit | 4ca73073a0d7c62b12a7354f76f8f80adc5d98c1 (patch) | |
tree | 61c08cb6ffead3de807882b2c963b7b2d94adc4e /sw/qa | |
parent | e5f4352d52044957c10f6530f76e97e0ca5cc4b3 (diff) |
tdf#129522 SvxShadowItem/writerfilter: allow shadow_NONE overrides
Both editeng and writerfilter were ignoring the case where NONE
should override an inherited shadow location. Of course,
this situation is very rare. Nearly all unit tests ran when
asserting that eLocation is already NONE.
The same is true for DOC, except that it is not affected by
SvxShadowItem's PutValue problem (and neither is ODT).
RTF is not even removing the borderlines themselves,
so no point in worrying about the shadow for RTF.
Change-Id: I7c1ae67270dde81915daee2f0282aa2074d2ec8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85658
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf129522_removeShadowStyle.odt | bin | 0 -> 14253 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 23 | ||||
-rw-r--r-- | sw/qa/extras/ww8export/data/tdf129522_removeShadowStyle.odt | bin | 0 -> 14253 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export3.cxx | 23 |
4 files changed, 46 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf129522_removeShadowStyle.odt b/sw/qa/extras/ooxmlexport/data/tdf129522_removeShadowStyle.odt Binary files differnew file mode 100644 index 000000000000..7ced9fc647c4 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf129522_removeShadowStyle.odt diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index fb93572bf725..216cdec15c3c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -15,6 +15,7 @@ #include <editsh.hxx> #include <frmatr.hxx> #include <tools/lineend.hxx> +#include <com/sun/star/table/ShadowFormat.hpp> #include <com/sun/star/text/TableColumnSeparator.hpp> #include <com/sun/star/text/XDocumentIndex.hpp> #include <com/sun/star/text/RelOrientation.hpp> @@ -79,6 +80,28 @@ DECLARE_OOXMLEXPORT_TEST(testTdf108350_noFontdefaults, "tdf108350_noFontdefaults //CPPUNIT_ASSERT_EQUAL_MESSAGE("Font size", 10.f, getProperty<float>(xStyleProps, "CharHeight")); } +DECLARE_OOXMLEXPORT_TEST(testTdf129522_removeShadowStyle, "tdf129522_removeShadowStyle.odt") +{ + uno::Reference< container::XNameAccess > paragraphStyles = getStyles("ParagraphStyles"); + uno::Reference< beans::XPropertySet > xStyleProps(paragraphStyles->getByName("Shadow"), uno::UNO_QUERY_THROW); + table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(xStyleProps, "ParaShadowFormat"); + CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location); + + // Shadows were inherited regardless of whether the style disabled them. + xStyleProps.set(paragraphStyles->getByName("Shadow-removed"), uno::UNO_QUERY_THROW); + aShadow = getProperty<table::ShadowFormat>(xStyleProps, "ParaShadowFormat"); + CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_NONE, aShadow.Location); + + uno::Reference< container::XNameAccess > characterStyles = getStyles("CharacterStyles"); + xStyleProps.set(characterStyles->getByName("CharShadow"), uno::UNO_QUERY_THROW); + aShadow = getProperty<table::ShadowFormat>(xStyleProps, "CharShadowFormat"); + CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location); + + xStyleProps.set(characterStyles->getByName("CharShadow-removed"), uno::UNO_QUERY_THROW); + aShadow = getProperty<table::ShadowFormat>(xStyleProps, "CharShadowFormat"); + //CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_NONE, aShadow.Location); +} + DECLARE_OOXMLIMPORT_TEST(testTdf125038, "tdf125038.docx") { OUString aActual = getParagraph(1)->getString(); diff --git a/sw/qa/extras/ww8export/data/tdf129522_removeShadowStyle.odt b/sw/qa/extras/ww8export/data/tdf129522_removeShadowStyle.odt Binary files differnew file mode 100644 index 000000000000..7ced9fc647c4 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf129522_removeShadowStyle.odt diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index cb04cc83bc20..231aaabe58ad 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -15,6 +15,7 @@ #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/LineDash.hpp> #include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/table/ShadowFormat.hpp> #include <com/sun/star/text/XFormField.hpp> #include <com/sun/star/text/XTextTable.hpp> #include <com/sun/star/text/XTextTablesSupplier.hpp> @@ -285,6 +286,28 @@ DECLARE_WW8EXPORT_TEST(testTdf120711_joinedParagraphWithChangeTracking, "tdf1207 CPPUNIT_ASSERT(style::NumberingType::CHAR_SPECIAL != numFormat); } +DECLARE_WW8EXPORT_TEST(testTdf129522_removeShadowStyle, "tdf129522_removeShadowStyle.odt") +{ + uno::Reference< container::XNameAccess > paragraphStyles = getStyles("ParagraphStyles"); + uno::Reference< beans::XPropertySet > xStyleProps(paragraphStyles->getByName("Shadow"), uno::UNO_QUERY_THROW); + table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(xStyleProps, "ParaShadowFormat"); + CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location); + + // Shadows were inherited regardless of whether the style disabled them. + xStyleProps.set(paragraphStyles->getByName("Shadow-removed"), uno::UNO_QUERY_THROW); + aShadow = getProperty<table::ShadowFormat>(xStyleProps, "ParaShadowFormat"); + CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_NONE, aShadow.Location); + + uno::Reference< container::XNameAccess > characterStyles = getStyles("CharacterStyles"); + xStyleProps.set(characterStyles->getByName("CharShadow"), uno::UNO_QUERY_THROW); + aShadow = getProperty<table::ShadowFormat>(xStyleProps, "CharShadowFormat"); + CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location); + + xStyleProps.set(characterStyles->getByName("CharShadow-removed"), uno::UNO_QUERY_THROW); + aShadow = getProperty<table::ShadowFormat>(xStyleProps, "CharShadowFormat"); + //CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_NONE, aShadow.Location); +} + DECLARE_WW8EXPORT_TEST(testBtlrCell, "btlr-cell.doc") { // Without the accompanying fix in place, this test would have failed, as |