summaryrefslogtreecommitdiff
path: root/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa/extras/ooxmlimport/ooxmlimport2.cxx')
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport2.cxx36
1 files changed, 36 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 29a1e4e0dcf0..82a18d353b0c 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -25,6 +25,8 @@
#include <IMark.hxx>
#include <sortedobjs.hxx>
#include <anchoredobject.hxx>
+#include <fmtftn.hxx>
+#include <ftnidx.hxx>
class Test : public SwModelTestBase
{
@@ -541,6 +543,40 @@ DECLARE_OOXMLIMPORT_TEST(testTdf129659, "tdf129659.docx")
// don't crash on footnote with page break
}
+DECLARE_OOXMLIMPORT_TEST(testTdf129912, "tdf129912.docx")
+{
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+ SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+ CPPUNIT_ASSERT(pWrtShell);
+
+ // Goto*FootnoteAnchor iterates the footnotes in a ring, so we need the amount of footnotes to stop the loop
+ sal_Int32 nCount = pWrtShell->GetDoc()->GetFootnoteIdxs().size();
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(5), nCount);
+
+ // the expected footnote labels
+ // TODO: the 5th label is actually wrong (missing the "PR" after the symbol part), but the "b" is there?!
+ const sal_Unicode pLabel5[] = { u'\xF0D1', u'\xF031', u'\xF032', u'\x0062' };
+ const OUString sFootnoteLabels[] = {
+ OUString(u'\xF0A7'), "1", "2", OUString(u'\xF020'), { pLabel5, SAL_N_ELEMENTS(pLabel5) }
+ };
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(SAL_N_ELEMENTS(sFootnoteLabels)), nCount);
+
+ pWrtShell->GotoPrevFootnoteAnchor();
+ nCount--;
+ while (nCount >= 0)
+ {
+ SwFormatFootnote aFootnoteNote;
+ CPPUNIT_ASSERT(pWrtShell->GetCurFootnote(&aFootnoteNote));
+ OUString sNumStr = aFootnoteNote.GetNumStr();
+ if (sNumStr.isEmpty())
+ sNumStr = OUString::number(aFootnoteNote.GetNumber());
+ CPPUNIT_ASSERT_EQUAL(sFootnoteLabels[nCount], sNumStr);
+ pWrtShell->GotoPrevFootnoteAnchor();
+ nCount--;
+ }
+}
+
// tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT
CPPUNIT_PLUGIN_IMPLEMENT();