summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-03-03 20:13:48 +0100
committerMiklos Vajna <vmiklos@collabora.com>2022-03-04 08:08:02 +0100
commit556689c485c2df35abd6a0cdff76329178af17bf (patch)
treea647380b3747b55e4f9b35b4d205ad03435824e6 /sw/qa
parentfbe4d77d961975bafe8ea3e419651df4d418f92b (diff)
sw layout xml dump: improve handling of number portions at the start
It's quite tricky to visit each portion exactly once. The "table" of portions is an SwParaPortion, a row is an SwLineLayout, which contains SwLinePortion instances. But SwLineLayout inherits from SwTextPortion (which is a LinePortion), so depending on if e.g. the paragraph starts with a numbering portion (not a text portion) or with plain text (is a text portion), the first portion in a line is the line layout itself or not. The old behavior was to explicitly dump the first portion of the line as an SwLinePortion, but this way e.g. the expand string of leading number portions were not visible. Change this to moving all the loops to SwFrame::dumpAsXml(), and then not recursing in para portions / line layouts, this allows reaching e.g. SwFieldPortion::dumpAsXml() for leading number portions. Change-Id: I813fdece0e4d6b7116112e15ec866046862beeeb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130941 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/core/text/text.cxx18
1 files changed, 10 insertions, 8 deletions
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index caeb70e4a89d..5741fe656a81 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -186,15 +186,17 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testChineseAutoFirstLineIndent)
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
// Get the line width of the first line for the 1st paragraph.
- sal_Int32 nFirstLineWidth
- = getXPath(pXmlDoc, "//body/txt[1]/SwParaPortion[1]/SwLineLayout[1]/SwLinePortion[1]",
- "width")
- .toInt32();
+ sal_Int32 nFirstLineWidth = getXPath(pXmlDoc,
+ "//body/txt[1]/SwParaPortion/SwLineLayout[1]/"
+ "SwParaPortion/SwLineLayout/SwLinePortion",
+ "width")
+ .toInt32();
// Get the line width of the first line for the 2nd paragraph.
- sal_Int32 nSecondLineWidth
- = getXPath(pXmlDoc, "//body/txt[2]/SwParaPortion[1]/SwLineLayout[1]/SwLinePortion[1]",
- "width")
- .toInt32();
+ sal_Int32 nSecondLineWidth = getXPath(pXmlDoc,
+ "//body/txt[2]/SwParaPortion/SwLineLayout[1]/"
+ "SwParaPortion/SwLineLayout/SwLinePortion",
+ "width")
+ .toInt32();
// Tdf#129448: the changing of line-height should not affect the auto first line indent.
// As a result, the first line width of the two paragraphs should be the same.