summaryrefslogtreecommitdiff
path: root/sw/qa/extras/ooxmlimport
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-06-27 17:42:49 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-06-28 04:41:23 +0200
commitdbfa56424f3d41bb58b7c9137f25f4ccb76dc92d (patch)
treeef97d7c6fe7f7169c8f640971a677f0abb938fec /sw/qa/extras/ooxmlimport
parentae5cb9b75984d9a63b392d8bfc5b3d224f00c741 (diff)
tdf#156078: also consider TabOverflow for tabs outside of line bounds
Before commit 29bd00f7628e7a54e69cabcc7e2a1792c24aa55c, TabOverMargin compat option was set for DOCX with any compat mode. After that commit, the unset option disallowed output of content after a tab stop outside of the paragraph indents, even within page margins. SwTabPortion::PreFormat consults TabOverflow when checking if position is outside the frame; so let's consult it also when painting. Change-Id: I05ada0da6cd765c70b7bad1287ccc8c11d9b60ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153672 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/qa/extras/ooxmlimport')
-rw-r--r--sw/qa/extras/ooxmlimport/data/tdf156078_rightTabOutsideParaRightIndent.docxbin0 -> 2272 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport2.cxx34
2 files changed, 34 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf156078_rightTabOutsideParaRightIndent.docx b/sw/qa/extras/ooxmlimport/data/tdf156078_rightTabOutsideParaRightIndent.docx
new file mode 100644
index 000000000000..cc2715cf6acd
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tdf156078_rightTabOutsideParaRightIndent.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index c3e834823c02..20b190d59af6 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -23,6 +23,9 @@
#include <com/sun/star/text/XTextDocument.hpp>
#include <com/sun/star/text/XTextTable.hpp>
+#include <comphelper/propertysequence.hxx>
+#include <vcl/BitmapReadAccess.hxx>
+#include <vcl/graphicfilter.hxx>
#include <xmloff/odffields.hxx>
#include <wrtsh.hxx>
@@ -1143,6 +1146,37 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf154695)
}
}
+CPPUNIT_TEST_FIXTURE(Test, testTdf156078)
+{
+ // Given a DOCX with compat level 15, and a tab stop outside of paragraph right indent
+ createSwDoc("tdf156078_rightTabOutsideParaRightIndent.docx");
+
+ // Export it to a PNG (96 ppi)
+ uno::Sequence<beans::PropertyValue> aFilterData(
+ comphelper::InitPropertySequence({ { "PixelWidth", uno::Any(sal_Int32(816)) },
+ { "PixelHeight", uno::Any(sal_Int32(1056)) } }));
+ uno::Sequence<beans::PropertyValue> aDescriptor(comphelper::InitPropertySequence(
+ { { "FilterName", uno::Any(OUString("writer_png_Export")) },
+ { "FilterData", uno::Any(aFilterData) } }));
+ uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
+ xStorable->storeToURL(maTempFile.GetURL(), aDescriptor);
+ CPPUNIT_ASSERT(maTempFile.IsValid());
+
+ Graphic exported;
+ GraphicFilter::LoadGraphic(maTempFile.GetURL(), {}, exported);
+ Bitmap bmp = exported.GetBitmapEx().GetBitmap();
+ Bitmap::ScopedReadAccess pAccess(bmp);
+
+ // "1" must export to the top right corner; check its pixels
+ bool numberPixelsFound = false;
+ for (tools::Long y = 90; y < 130; ++y)
+ for (tools::Long x = 680; x < 720; ++x)
+ if (Color(pAccess->GetPixel(y, x)).IsDark())
+ numberPixelsFound = true;
+
+ CPPUNIT_ASSERT(numberPixelsFound);
+}
+
// tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT
CPPUNIT_PLUGIN_IMPLEMENT();