sw/qa/extras/layout/data/min-wtf.rtf |   42 +++++++++++++++++++++++++++++++++
 sw/qa/extras/layout/layout3.cxx      |   44 +++++++++++++++++++++++++++++++++++
 2 files changed, 86 insertions(+)

New commits:
commit 116facc2909708ef32f90c61a4481d71b9138b6d
Author:     Michael Stahl <[email protected]>
AuthorDate: Fri Oct 24 20:01:13 2025 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Mon Oct 27 12:00:50 2025 +0100

    sw: text formatting: add test for per-line paragraph properties like Word
    
    Test for commit 0849ddd0b1b3c384c5f3de8fe0bbb9df558fa786
    
    Change-Id: Ia26286593b3e7f21799a86b1762ab30421941fad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192957
    Reviewed-by: Michael Stahl <[email protected]>
    Tested-by: Jenkins

diff --git a/sw/qa/extras/layout/data/min-wtf.rtf 
b/sw/qa/extras/layout/data/min-wtf.rtf
new file mode 100644
index 000000000000..1a38c504c369
--- /dev/null
+++ b/sw/qa/extras/layout/data/min-wtf.rtf
@@ -0,0 +1,42 @@
+{ 
tf1deflang1025nsinsicpg1252\uc1deff0\deff0\stshfdbch0\stshfloch31506\stshfhich31506\stshfbi31506\deflang2057\deflangfe1028
       hemelang3079    hemelangfe0     hemelangcs0{onttbl{0bidi roman
charset0prq2{\*\panose 02020603050405020304}Times New Roman{\*alt Arial};}
+{1bidi swisscharset0prq2{\*\panose 020b0604020202020204}Arial{\*alt 
Arial};}
+{dbminor31505bidi nilcharset136prq2{\*\panose 
02010601000101010101}PMingLiU{\*alt Arial Unicode MS};}
+{himinor31506bidi swisscharset0prq2{\*\panose 
020f0502020204030204}Calibri;}
+}
+{\*\defchp 31506s22\lang3079\langfe1033\langnp3079\langfenp1033 }{\*\defpap 
\ql \li0 i0\sa200\sl276\slmult1
+\widctlpar\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0 }
oqfpromote {\stylesheet{\ql \li0 
i0\sa200\sl276\slmult1\widctlpar\wrapdefaultspalphaspnumaautodjustright 
in0\lin0\itap0  tlchcs1 f0fs22lang1025 \ltrchcs0 
+1s23\lang3079\langfe1033+\s15\ql \li0 i0\widctlpar   qc      x4536   qr      
x9072\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0  tlchcs1 
f0fs22lang1025 \ltrchcs0 1s23\lang3079\langfe1033+\sbasedon0 \snext15 
\slink17 \sunhideused 
header;}{\*+\paperw11906\paperh16838\margl1417\margr1417\margt1417\margb1134\gutter0\ltrsect
 
+\deftab708\widowctrltnbjenddoc\hyphhotz425   rackmoves0      
rackformatting1\donotembedsysfont1 elyonvml0\donotembedlingdata0\grfdocevents0
alidatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0
+\showxmlerrors1
oxlattoyenxpshrtn
oultrlspc\dntblnsbdb
ospaceforul
ormshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1417\dgvorigin1417\dghshow1\dgvshow1
+\jexpandiewkind1iewscale100\pgbrdrhead\pgbrdrfoot\splytwnine
tnlytwnine\htmautsp
olnhtadjtbl\useltbalnlntblind\lytcalctblwd\lyttblrtgr\lnbrkrule
obrkwrptbl\snaptogridincellllowfieldendsel\wrppunct
+sianbrkrule sidroot6514785
ewtblstyruls
ogrowautofit\usenormstyforlist
oindnmbrtselnbrelev
ocxsptable\indrlsweleven
oafcnsttblfelev\utinl\hwelev\spltpgpar
otcvasp
otbrkcnstfrctbl
otvatxbx\krnprsnet+{\*\wgrffmtfilter 2450}
ofeaturethrottle1\ilfomacatclnup0
+\ltrpar \sectd \ltrsect\pgnrestart\linex0\headery708ootery708+        qc      
x4536   qr      x9072\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0 
 tlchcs1 f0fs22lang1025 \ltrchcs0 1s23\lang3079\langfe1033+\par 
}}{\headerr \ltrpar \pard\plain \ltrpar\s15\qc \li0 i0\widctlpar qc      x4536  
 qr      x9072\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0  tlch
cs1 f0fs22lang1025 \ltrchcs0 
+1s23\lang3079\langfe1033+\par \line \line \line \line \line \line \line 
+\par }\pard\plain \ltrpar\ql \li0 i0\widctlpar\wrapdefaultaautodjustright 
in0\lin0\itap0  tlchcs1 f0fs22lang1025 \ltrchcs0 1
s23\lang3079\langfe1033+s16 \line \line \line \line \line }{ tlchcs1 
bf0fs12 \ltrchcs0 s16 \line }{ tlchcs1 f0fs16 \ltrchcs0 s16 \line 
+\par \line 
+\par }{ tlchcs1 f1 \ltrchcs0 1s16 
+\par }\pard \ltrpar\qr \li1418 i0\sa1600\sl480\slmult1\widctlpar\wrapdefault
aautodjustright in0\lin1418\itap0 { tlchcs1 f1 \ltrchcs0 1
s16\lang2057\langfe1033\langnp2057 a\line n\line v        ab \line d
+}{ tlchcs1 f1 \ltrchcs0 1s16\lang2057\langfe1033\langnp2057 
+\par }\pard \ltrpar\ql \li0 i0\sa200\sl276\slmult1\keepn\widctlpar     
x2835\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0 { tlchcs1 f1 
\ltrchcs0 1s16\lang2057\langfe1033\langnp2057 a
+       ab c\line x     ab y
+\par }\pard \ltrpar\ql \li0 
i0\sa200\sl276\slmult1\keepn\widctlpar\wrapdefaultspalphaspnum
aautodjustright in0\lin0\itap0 { tlchcs1 f1 \ltrchcs0 1
s16\lang2057\langfe1033\langnp2057 
+\par }\pard \ltrpar\ql \li0 i0\widctlpar\wrapdefaultaautodjustright 
in0\lin0\itap0 { tlchcs1 f1 \ltrchcs0 1s16\lang2057\langfe1033\langnp2057 
+\par }\pard \ltrpar\ql \li0 
i0\sa200\sl276\slmult1\widctlpar\wrapdefaultspalphaspnumaautodjustright 
in0\lin0\itap0 { tlchcs1 bf0fs12 \ltrchcs0 
s16\lang2057\langfe1033\langnp2057 
+\par }\pard\plain \ltrpar\s15\qc \li0 i0\widctlpar     qc      x4536   qr      
x9072\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0  tlchcs1 
f0fs22lang1025 \ltrchcs0 1s23\lang3079\langfe1033+ tlchcs1 f0fs16 
\ltrchcs0 s16\lang2057\langfe1033\langnp2057 
+\par }\pard\plain \ltrpar\qc \li0 i0\widctlpar\wrapdefaultspalphaspnum
aautodjustright in0\lin0\itap0  tlchcs1 f0fs22lang1025 \ltrchcs0 1
s23\lang3079\langfe1033+\ltrchcs0 [text] }{ tlchcs1 f0 \ltrchcs0 
\lang2057\langfe1033\langnp2057 
+\par }}
+\pard\plain \ltrpar\ql \li0 i0\widctlpar\wrapdefaultaautodjustright 
in0\lin0\itap0 
+ tlchcs1 f0fs22lang1025 \ltrchcs0 1
s23\lang3079\langfe1033+\hichf0\dbchf31505\loch0 Xxxxxxxxxxxxxxxx xxx xxxx}{ 
tlchcs1 f0fs24 \ltrchcs0 
s24\lang2057\langfe1028\lochf0\hichf0\dbchf31505\langnp2057\langfenp1028 
+\par }
+}
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index 9ad3c18412fd..a53ed0ada4ee 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -496,6 +496,50 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf162725)
     assertXPath(pXmlDoc, 
"/root/page/body/txt[1]/SwParaPortion/SwLineLayout[1]/SwGluePortion");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testHiddenParagraphMarkPerLineProperties)
+{
+    createSwDoc("min-wtf.rtf");
+
+    // ensure paragraphs are merged by hidden formatting
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+    SwViewOption aViewOptions(*pWrtShell->GetViewOptions());
+    aViewOptions.SetViewMetaChars(false);
+    pWrtShell->ApplyViewOptions(aViewOptions);
+
+    xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+    assertXPath(pXmlDoc, "/root/page[1]/header/txt", 3);
+    assertXPath(pXmlDoc, 
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout[1]", "height",
+                u"184");
+    assertXPath(pXmlDoc, 
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout[2]", "height",
+                u"184");
+    assertXPath(pXmlDoc, 
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout[3]", "height",
+                u"184");
+    assertXPath(pXmlDoc, 
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout[4]", "height",
+                u"184");
+    assertXPath(pXmlDoc, 
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout[5]", "height",
+                u"184");
+    assertXPath(pXmlDoc, 
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout", 5);
+    // the problem was that this was 1656 due to using wrong line spacing for 
last line
+    assertXPath(pXmlDoc, "/root/page[1]/header/txt[1]/infos/bounds", "height", 
u"1499");
+    assertXPath(pXmlDoc, 
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout[4]/SwFixPortion",
+                "type", u"PortionType::TabLeft");
+    assertXPath(pXmlDoc, 
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout[4]/SwFixPortion",
+                "width", u"532");
+    assertXPath(pXmlDoc, 
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout[5]/SwFixPortion",
+                "type", u"PortionType::TabLeft");
+    // the problem was that this was 626 (same tab position as previous line)
+    assertXPath(pXmlDoc, 
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout[5]/SwFixPortion",
+                "width", u"2755");
+    assertXPath(pXmlDoc, 
"/root/page[1]/header/txt[2]/SwParaPortion/SwLineLayout", 0);
+    // this one was also wrong (1968) due to wrong spacing-below
+    assertXPath(pXmlDoc, "/root/page[1]/header/txt[2]/infos/bounds", "height", 
u"411");
+    assertXPath(pXmlDoc, 
"/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout[1]", "height",
+                u"265");
+    assertXPath(pXmlDoc, 
"/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout", 1);
+    assertXPath(pXmlDoc, "/root/page[1]/header/txt[3]/infos/bounds", "height", 
u"492");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf161810)
 {
     createSwDoc("tdf161810.fodt");

Reply via email to