sw/qa/core/objectpositioning/data/tdf154863-img-move-crash.docx |binary
 sw/qa/core/objectpositioning/objectpositioning.cxx              |   14 
++++++++++
 2 files changed, 14 insertions(+)

New commits:
commit 16d46e25e03cd506576ac3dcb6be56270b47b4a6
Author:     Matt K <matt...@gmail.com>
AuthorDate: Wed Jan 31 15:39:53 2024 -0600
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Feb 1 08:33:05 2024 +0100

    tdf#154863 Add unit test to cover crash on image move
    
    This change adds a CppUnit test that changes the position
    of an image in an example document which causes a crash
    if the bug exists.
    
    Change-Id: I0f507ccf63c2c7f49f6ed71cd8df174b2b3136f1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162857
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/qa/core/objectpositioning/data/tdf154863-img-move-crash.docx 
b/sw/qa/core/objectpositioning/data/tdf154863-img-move-crash.docx
new file mode 100644
index 000000000000..ca402edef74d
Binary files /dev/null and 
b/sw/qa/core/objectpositioning/data/tdf154863-img-move-crash.docx differ
diff --git a/sw/qa/core/objectpositioning/objectpositioning.cxx 
b/sw/qa/core/objectpositioning/objectpositioning.cxx
index bf560cbdaf90..717d63ded052 100644
--- a/sw/qa/core/objectpositioning/objectpositioning.cxx
+++ b/sw/qa/core/objectpositioning/objectpositioning.cxx
@@ -25,6 +25,8 @@
 #include <flyfrm.hxx>
 #include <frmatr.hxx>
 
+#include <vcl/scheduler.hxx>
+
 namespace
 {
 /// Covers sw/source/core/objectpositioning/ fixes.
@@ -56,6 +58,18 @@ CPPUNIT_TEST_FIXTURE(Test, testOverlapCrash)
     pWrtShell->SplitNode();
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testImgMoveCrash)
+{
+    createSwDoc("tdf154863-img-move-crash.docx");
+    uno::Reference<drawing::XShape> xShape(getShapeByName(u"Image26"), 
uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY);
+    xShapeProps->setPropertyValue("VertOrient", 
uno::Any(static_cast<sal_Int32>(0)));
+    xShapeProps->setPropertyValue("VertOrientPosition", 
uno::Any(static_cast<sal_Int32>(3000)));
+    Scheduler::ProcessEventsToIdle();
+    // Crash expected before assert if bug exists
+    CPPUNIT_ASSERT(true);
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testVertPosFromBottom)
 {
     // Create a document, insert a shape and position it 1cm above the bottom 
of the body area.

Reply via email to