diff options
author | Tor Lillqvist <tml@collabora.com> | 2022-01-26 13:02:06 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-01-27 11:53:52 +0100 |
commit | 0101c7918bb735d796bc1bc0d1705f995e41ee98 (patch) | |
tree | 98f7dbdb39e455dd4012c0c611680bec66edb91a /writerfilter | |
parent | e0d6f0f9334e368ac45c68a41a736bb34fb31222 (diff) |
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 <vmiklos@collabora.com>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx | 18 | ||||
-rw-r--r-- | writerfilter/qa/cppunittests/dmapper/data/layout-in-cell-2.docx | bin | 0 -> 66189 bytes |
2 files changed, 18 insertions, 0 deletions
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 Binary files differnew file mode 100644 index 000000000000..5b6926460c80 --- /dev/null +++ b/writerfilter/qa/cppunittests/dmapper/data/layout-in-cell-2.docx |