diff --git a/sd/qa/unit/data/pptx/tdf173712-liststyle.pptx b/sd/qa/unit/data/pptx/tdf173712-liststyle.pptx new file mode 100644 index 000000000000..150d2ada5ad4 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf173712-liststyle.pptx differ diff --git a/sd/qa/unit/data/pptx/tdf173712.pptx b/sd/qa/unit/data/pptx/tdf173712.pptx new file mode 100644 index 000000000000..47686f00efd1 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf173712.pptx differ diff --git a/sd/qa/unit/layout-tests.cxx b/sd/qa/unit/layout-tests.cxx index 0aa0cd82a927..9434c9aaaef3 100644 --- a/sd/qa/unit/layout-tests.cxx +++ b/sd/qa/unit/layout-tests.cxx @@ -8,6 +8,7 @@ */ #include "sdmodeltestbase.hxx" +#include #include #include #include @@ -31,6 +32,28 @@ public: CPPUNIT_ASSERT(pDoc); return pDoc; } + + // Item texts ("A1", "B2", ...) of the layout, each with the label drawn before it + OUString getNumberedItems() + { + xmlDocUniquePtr pXmlDoc = parseLayout(); + OUStringBuffer aItems; + OUString aLabel; + const int nCount = countXPathNodes(pXmlDoc, "//textarray"); + for (int i = 1; i <= nCount; ++i) + { + const OUString aText + = getXPathContent(pXmlDoc, "(//textarray)[" + OString::number(i) + "]/text"); + if (aText.endsWith(".")) + aLabel = aText; + else if (aText.getLength() == 2 && rtl::isAsciiDigit(aText[1])) + { + aItems.append(aLabel + aText + " "); + aLabel.clear(); + } + } + return aItems.makeStringAndClear(); + } }; CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf104722) @@ -302,6 +325,47 @@ CPPUNIT_TEST_FIXTURE(SdLayoutTest, numberedList) } } +CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf173712) +{ + // Sixteen text boxes with numbered lists; the expected numbers are those PowerPoint shows + createSdImpressDoc("pptx/tdf173712.pptx"); + + // Without the fix in place, e.g. every item of A (startAt="2" on each) was numbered "2." + CPPUNIT_ASSERT_EQUAL( + u"2.A1 3.A2 4.A3 5.A4 " // startAt="2" on every item + "1.B1 2.B2 5.B3 6.B4 " // no startAt, then startAt="5" + "2.C1 3.C2 4.C3 5.C4 " // startAt="2", then startAt="4" + "1.D1 2.D2 3.D3 4.D4 " // no startAt, then startAt="1" + "2.E1 3.E2 E3 2.E4 3.E5 " // plain paragraph between + "2.F1 3.F2 F3 2.F4 3.F5 " // buNone paragraph between + "1.G1 2.G2 I.G3 II.G4 " // arabicPeriod, then romanUcPeriod + "3.H1 4.H2 a.H3 b.H4 5.H5 a.H6 6.H7 " // nested, outer startAt="3" + "1.I1 2.I2 3.I3 2.I4 2.I5 3.I6 " // nested, inner startAt="2" + "2.J1 3.J2 J3 4.J4 5.J5 " // unnumbered lvl="1" paragraph between + "1.K1 a.K2 b.K3 K4 a.K5 2.K6 " // unnumbered paragraph inside the inner list + "2.L1 2.L2 3.L3 2.L4 3.L5 " // startAt="2" on both levels + "2.M1 3.M2 M3 2.M4 3.M5 " // paragraph without a:pPr between + "2.N1 3.N2 1.N3 2.N4 " // startAt="2", then no startAt + "5.O1 6.O2 2.O3 3.O4 " // startAt="5", then startAt="2" + "1.R1 2.R2 R3 1.R4 2.R5 "_ustr, // paragraph without a:pPr, no startAt + getNumberedItems()); +} + +CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf173712_listStyle) +{ + // a:lstStyle has for level 1, but no startAt in Z + createSdImpressDoc("pptx/tdf173712-liststyle.pptx"); + + // Without the fix in place, every item was numbered "2." + CPPUNIT_ASSERT_EQUAL( + u"2.U1 3.U2 4.U3 5.U4 " // no a:pPr + "2.V1 3.V2 4.V3 5.V4 " // a:pPr without a bullet + "2.W1 3.W2 4.W3 5.W4 " // own buAutoNum with startAt="2" too + "2.Y1 3.Y2 4.Y3 5.Y4 " // from the list style, own, own, from the list style + "1.Z1 2.Z2 Z3 1.Z4 2.Z5 "_ustr, // no startAt, buNone paragraph between + getNumberedItems()); +} + CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf146731) { createSdImpressDoc("pptx/tdf146731.pptx");