summaryrefslogtreecommitdiff
path: root/sw/qa/extras
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2022-09-21 18:33:43 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2022-09-22 19:42:46 +0200
commit3acd80a030707b3c4795c0f828f953ac0ae24d97 (patch)
tree11cea51f01138c26eea21eb6b4674b6f84dfeccd /sw/qa/extras
parent6005aeca4416eb0d583fd12ab837afa91d9d18ec (diff)
tdf#150616 sw: fix bad 0 height of SwTextFrame in table cell
The bugdoc has a text frame 42 immediately following a section which contains a nested table, both inside a table cell 29. The problem is that with soffice --convert-to pdf, the height of frame 42 ends up as 0, after a single layout action; this does not happen when loading it from UI. When the frame 42 is formatted, it calculates the needed height, and grows, but in SwTextFrame::AdjustFrame() it doesn't fit into its upper cell frame with a negative nRstHeight at this point, and the text frame is reduced to height 0. The odd code in SwContentFrame::MakeAll() exists unchanged since CVS initial import and is poorly motivated. It is highly suspicious that it simply grows the upper frame, without invalidating the size of the current one (which was already shrunk), and/or clearing the m_bUndersized flag. If this code is removed, on formatting the next frame 43, it goes up and formats the cell frame, which grows and at the same time importantly invalidates the text frame 42, so it will be formatted again and full height. At the point when the frame 42 was formatted, its upper cell frame was size-invalid, so it looks like that will be formatted eventually in any case and then invalidate 42. (regression from commit e7874c936dd1ff9b3423eb7477cbee2494535176 but unclear why) Change-Id: I1ac0999a8fda39f7717bc183a10e3b513fbb8911 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140355 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw/qa/extras')
-rw-r--r--sw/qa/extras/layout/data/in_056132_mod.odtbin0 -> 13647 bytes
-rw-r--r--sw/qa/extras/layout/layout.cxx49
2 files changed, 49 insertions, 0 deletions
diff --git a/sw/qa/extras/layout/data/in_056132_mod.odt b/sw/qa/extras/layout/data/in_056132_mod.odt
new file mode 100644
index 000000000000..548401063bdd
--- /dev/null
+++ b/sw/qa/extras/layout/data/in_056132_mod.odt
Binary files differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 438321555e89..0536a54d8b7e 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -3807,6 +3807,55 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122607_regression)
aTempFile.EnableKillingFile();
}
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf150616)
+{
+ discardDumpedLayout();
+ if (mxComponent.is())
+ mxComponent->dispose();
+
+ OUString const pName("in_056132_mod.odt");
+
+ OUString const url(m_directories.getURLFromSrc(DATA_DIRECTORY) + pName);
+
+ // note: must set Hidden property, so that SfxFrameViewWindow_Impl::Resize()
+ // does *not* forward initial VCL Window Resize and thereby triggers a
+ // layout which does not happen on soffice --convert-to pdf.
+ std::vector<beans::PropertyValue> aFilterOptions = {
+ { beans::PropertyValue("Hidden", -1, uno::Any(true), beans::PropertyState_DIRECT_VALUE) },
+ };
+
+ std::cout << pName << ":\n";
+
+ // inline the loading because currently properties can't be passed...
+ mxComponent = loadFromDesktop(url, "com.sun.star.text.TextDocument",
+ comphelper::containerToSequence(aFilterOptions));
+ uno::Sequence<beans::PropertyValue> props(comphelper::InitPropertySequence({
+ { "FilterName", uno::Any(OUString("writer_pdf_Export")) },
+ }));
+ utl::TempFile aTempFile;
+ uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
+ xStorable->storeToURL(aTempFile.GetURL(), props);
+
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ // this one was 0 height
+ assertXPath(pXmlDoc, "/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[2]/LineBreak", "Line",
+ "Important information here!");
+ assertXPath(pXmlDoc, "/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[2]/infos/bounds", "height",
+ "253");
+ assertXPath(pXmlDoc, "/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[2]/infos/bounds", "top",
+ "7925");
+ assertXPath(pXmlDoc, "/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[3]/LineBreak", "Line",
+ "xxx 111 ");
+ assertXPath(pXmlDoc, "/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[3]/infos/bounds", "height",
+ "697");
+ assertXPath(pXmlDoc, "/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[3]/infos/bounds", "top",
+ "8178");
+
+ aTempFile.EnableKillingFile();
+}
+
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testBtlrCell)
{
SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "btlr-cell.odt");