summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-04-19 10:31:39 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2024-04-29 10:02:52 +0500
commitddd6d8bd2ed2b37492d7660df1769618cea17105 (patch)
treee02948e2148fb7dbb031dd53eec0efaad6d3d99c
parentb2509d82c0b63d001f0f7a946e0d4c926158f6e2 (diff)
Add a unit test for commit 3f0220f18a66630e06e3c128980f21a5722f49ca
(Handle empty range properly, 2024-04-18) Change-Id: Ifea60ace8ff864ef092e6a62177d5926ceb60de3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166278 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--sw/qa/extras/ww8export/data/empty_group.docxbin0 -> 1414 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export4.cxx24
2 files changed, 24 insertions, 0 deletions
diff --git a/sw/qa/extras/ww8export/data/empty_group.docx b/sw/qa/extras/ww8export/data/empty_group.docx
new file mode 100644
index 000000000000..a3454746c5e0
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/empty_group.docx
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export4.cxx b/sw/qa/extras/ww8export/ww8export4.cxx
index efb198ebae00..b4116ff2bbac 100644
--- a/sw/qa/extras/ww8export/ww8export4.cxx
+++ b/sw/qa/extras/ww8export/ww8export4.cxx
@@ -19,8 +19,11 @@
#include <comphelper/sequenceashashmap.hxx>
#include <o3tl/string_view.hxx>
+#include <svx/svdpage.hxx>
#include <docsh.hxx>
+#include <drawdoc.hxx>
+#include <IDocumentDrawModelAccess.hxx>
#include <IDocumentSettingAccess.hxx>
#include <unotxdoc.hxx>
@@ -78,6 +81,27 @@ DECLARE_WW8EXPORT_TEST(testTdf104704_mangledFooter, "tdf104704_mangledFooter.odt
CPPUNIT_ASSERT_EQUAL(2, getPages());
}
+CPPUNIT_TEST_FIXTURE(Test, testEmptyGroup)
+{
+ // Given a document with an empty group
+ createSwDoc("empty_group.docx");
+
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
+ CPPUNIT_ASSERT_EQUAL(1, getShapes());
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+ SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+ SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
+ SdrObject* pObject = pPage->GetObj(0);
+
+ CPPUNIT_ASSERT_EQUAL(OUString("Empty group"), pObject->GetName());
+ CPPUNIT_ASSERT(pObject->IsGroupObject());
+ CPPUNIT_ASSERT_EQUAL(size_t(0), pObject->GetSubList()->GetObjCount());
+
+ // it must not assert/crash on save
+ saveAndReload(OUString::createFromAscii(mpFilter));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */