writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx          |   18 
++++++++++
 writerfilter/qa/cppunittests/dmapper/data/layout-in-cell-2.docx |binary
 2 files changed, 18 insertions(+)

New commits:
commit 0101c7918bb735d796bc1bc0d1705f995e41ee98
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Wed Jan 26 13:02:06 2022 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Jan 27 11:53:52 2022 +0100

    Add simple unit test for recent fix to take layoutInCell into consideration
    
    ... when a graphic is in table row.
    
    The test just checks that the IsFollowingTextFlow property gets set as
    true, it doesn't check that the table row height actually is correct
    or that the result looks correct.
    
    Change-Id: Ia6feec2b2a9bbff6e130f9542c15106750ff415d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128982
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx 
b/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx
index 2f9faefab55f..a20c8490501b 100644
--- a/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx
+++ b/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx
@@ -388,6 +388,24 @@ CPPUNIT_TEST_FIXTURE(Test, testLayoutInCellWrapnoneColumn)
     CPPUNIT_ASSERT(xShape->getPropertyValue("IsFollowingTextFlow") >>= 
bFollowingTextFlow);
     CPPUNIT_ASSERT(!bFollowingTextFlow);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testLayoutInCellOfHraphics)
+{
+    // Given a file with a table, then a shape anchored inside the cell:
+    OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"layout-in-cell-2.docx";
+
+    // When loading that document:
+    getComponent() = loadFromDesktop(aURL);
+
+    // Then make sure the cell obeys the layoutInCell:
+    uno::Reference<drawing::XDrawPageSupplier> 
xDrawPageSupplier(getComponent(), uno::UNO_QUERY);
+    uno::Reference<drawing::XDrawPage> xDrawPage = 
xDrawPageSupplier->getDrawPage();
+    uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(1), 
uno::UNO_QUERY);
+    uno::Reference<container::XNamed> xNamedShape(xShape, uno::UNO_QUERY);
+    bool bFollowingTextFlow = false;
+    CPPUNIT_ASSERT(xShape->getPropertyValue("IsFollowingTextFlow") >>= 
bFollowingTextFlow);
+    CPPUNIT_ASSERT(bFollowingTextFlow);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/qa/cppunittests/dmapper/data/layout-in-cell-2.docx 
b/writerfilter/qa/cppunittests/dmapper/data/layout-in-cell-2.docx
new file mode 100644
index 000000000000..5b6926460c80
Binary files /dev/null and 
b/writerfilter/qa/cppunittests/dmapper/data/layout-in-cell-2.docx differ

Reply via email to