summaryrefslogtreecommitdiffstats
path: root/sw/qa/extras/rtfexport/rtfexport8.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa/extras/rtfexport/rtfexport8.cxx')
-rw-r--r--sw/qa/extras/rtfexport/rtfexport8.cxx84
1 files changed, 81 insertions, 3 deletions
diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx b/sw/qa/extras/rtfexport/rtfexport8.cxx
index 08ca8452f9..ab787919df 100644
--- a/sw/qa/extras/rtfexport/rtfexport8.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport8.cxx
@@ -9,9 +9,12 @@
#include <swmodeltestbase.hxx>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/Gradient2.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/text/GraphicCrop.hpp>
#include <com/sun/star/text/XFootnote.hpp>
#include <com/sun/star/text/XFootnotesSupplier.hpp>
-#include <com/sun/star/awt/FontWeight.hpp>
#include <com/sun/star/text/XEndnotesSupplier.hpp>
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
#include <com/sun/star/text/XTextTablesSupplier.hpp>
@@ -20,7 +23,9 @@
#include <com/sun/star/style/ParagraphAdjust.hpp>
#include <com/sun/star/style/TabStop.hpp>
+#include <basegfx/utils/gradienttools.hxx>
#include <comphelper/sequenceashashmap.hxx>
+#include <docmodel/uno/UnoGradientTools.hxx>
#include <tools/UnitConversion.hxx>
#include <comphelper/propertyvalue.hxx>
@@ -48,6 +53,28 @@ public:
}
};
+DECLARE_RTFEXPORT_TEST(testTdf155663, "piccrop.rtf")
+{
+ auto const xShape(getShape(1));
+ if (!isExported())
+ {
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2004), xShape->getSize().Height);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2004), xShape->getSize().Width);
+ }
+ else // bit of rounding loss?
+ {
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2013), xShape->getSize().Height);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2013), xShape->getSize().Width);
+ }
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(123), getProperty<text::GraphicCrop>(xShape, "GraphicCrop").Top);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(123),
+ getProperty<text::GraphicCrop>(xShape, "GraphicCrop").Bottom);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(123),
+ getProperty<text::GraphicCrop>(xShape, "GraphicCrop").Left);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(123),
+ getProperty<text::GraphicCrop>(xShape, "GraphicCrop").Right);
+}
+
DECLARE_RTFEXPORT_TEST(testTdf158586_0, "tdf158586_pageBreak0.rtf")
{
// The specified page break must be lost because it is in a text frame
@@ -109,6 +136,27 @@ DECLARE_RTFEXPORT_TEST(testTdf158586_lostFrame, "tdf158586_lostFrame.rtf")
CPPUNIT_ASSERT_EQUAL(2, getPages());
}
+DECLARE_RTFEXPORT_TEST(testTdf158983, "fdo55504-1-min.rtf")
+{
+ // the problem was that the page break was missing and the shapes were
+ // all anchored to the same node
+
+ const auto& pLayout = parseLayoutDump();
+ assertXPath(pLayout, "/root/page[1]/body/section/txt"_ostr, 1);
+ assertXPath(pLayout, "/root/page[1]/body/section/txt/anchored/fly"_ostr, 1);
+ // Word shows these shapes anchored in the fly, not body, but at least they are not lost
+ assertXPath(pLayout, "/root/page[1]/body/section/txt/anchored/SwAnchoredDrawObject"_ostr, 2);
+ // page break, paragraph break, section break.
+ assertXPath(pLayout, "/root/page[2]/body/section[1]/txt"_ostr, 1);
+ assertXPath(pLayout, "/root/page[2]/body/section[1]/txt/anchored"_ostr, 0);
+ assertXPath(pLayout, "/root/page[2]/body/section[2]/txt"_ostr, 1);
+ assertXPath(pLayout, "/root/page[2]/body/section[2]/txt/anchored/fly"_ostr, 1);
+ // Word shows these shapes anchored in the fly, not body, but at least they are not lost
+ assertXPath(pLayout, "/root/page[2]/body/section[2]/txt/anchored/SwAnchoredDrawObject"_ostr, 2);
+
+ CPPUNIT_ASSERT_EQUAL(2, getPages());
+}
+
DECLARE_RTFEXPORT_TEST(testAnnotationPar, "tdf136445-1-min.rtf")
{
// the problem was that the paragraph break following annotation was missing
@@ -130,8 +178,38 @@ DECLARE_RTFEXPORT_TEST(testTdf158826_extraCR, "tdf158826_extraCR.rtf")
// The page break defined before the document content should not cause a page break
CPPUNIT_ASSERT_EQUAL(1, getPages());
- // There is a two-column floating table [that SHOULD be getParagraphOrTable(1)]
- uno::Reference<text::XTextTable> xTable(getParagraphOrTable(2), uno::UNO_QUERY_THROW);
+ // There is a two-column floating table
+ uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY_THROW);
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf159824_axialGradient)
+{
+ // given a frame with an axial gradient (white - green - white)
+ loadAndReload("tdf159824_axialGradient.odt");
+
+ uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(),
+ uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT,
+ getProperty<drawing::FillStyle>(xFrame, "FillStyle"));
+ awt::Gradient2 aGradient = getProperty<awt::Gradient2>(xFrame, "FillGradient");
+
+ //const Color aColA(0x127622); // green
+ //const Color aColB(0xffffff); // white
+
+ // MCGR: Use the completely imported transparency gradient to check for correctness
+ basegfx::BColorStops aColorStops = model::gradient::getColorStopsFromUno(aGradient.ColorStops);
+
+ // expected: a 3-color linear gradient (or better yet a 2-color AXIAL gradient)
+ CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops.size());
+ CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_LINEAR, aGradient.Style);
+ CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0));
+ //CPPUNIT_ASSERT_EQUAL(aColB, Color(aColorStops[0].getStopColor()));
+ // CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 0.5));
+ // CPPUNIT_ASSERT_EQUAL(aColA, Color(aColorStops[1].getStopColor()));
+ // CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[2].getStopOffset(), 1.0));
+ // CPPUNIT_ASSERT_EQUAL(aColB, Color(aColorStops[2].getStopColor()));
}
DECLARE_RTFEXPORT_TEST(testTdf158830, "tdf158830.rtf")