summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2023-11-16 23:48:03 +0100
committerLászló Németh <nemeth@numbertext.org>2023-11-17 09:33:06 +0100
commitc1803de8a093739d189be54b2d9bd5634e9e79ee (patch)
treeaadb075d859e7fac558cc5df087a5bbbc4e0edaa /sw
parent191babee4f0ec643b80e96b0cd98c2d04ff96e4e (diff)
tdf#119908 sw smart justify: add unit test
Follow-up to commit 17eaebee279772b6062ae3448012133897fc71bb "tdf#119908 sw smart justify: fix justification by shrinking". Change-Id: I88cc7876c06729f81b9d61fed7456be801dc6373 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159525 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/layout/data/tdf130088.docxbin0 -> 16961 bytes
-rw-r--r--sw/qa/extras/layout/layout3.cxx21
2 files changed, 21 insertions, 0 deletions
diff --git a/sw/qa/extras/layout/data/tdf130088.docx b/sw/qa/extras/layout/data/tdf130088.docx
new file mode 100644
index 000000000000..8d5a7a604b5e
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf130088.docx
Binary files differ
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index b390e6e38b9c..11a9c0191d24 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -172,6 +172,27 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf128966)
xmlXPathFreeObject(pXmlObj);
}
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf119908)
+{
+ createSwDoc("tdf130088.docx");
+ // Ensure that all text portions are calculated before testing.
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+ SwViewShell* pViewShell
+ = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+ CPPUNIT_ASSERT(pViewShell);
+ pViewShell->Reformat();
+
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+ // Keep real width of the exceeding line portions to calculate shrinking
+ sal_Int32 nPortionWidth
+ = getXPath(pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout[2]/SwLinePortion[2]",
+ "width")
+ .toInt32();
+ // This was 5806 (not real portion width, but stripped to the line width)
+ CPPUNIT_ASSERT_GREATER(sal_Int32(5840), nPortionWidth);
+}
+
CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf106234)
{
createSwDoc("tdf106234.fodt");