summaryrefslogtreecommitdiff
path: root/xmloff/qa/unit/draw.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff/qa/unit/draw.cxx')
-rw-r--r--xmloff/qa/unit/draw.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/xmloff/qa/unit/draw.cxx b/xmloff/qa/unit/draw.cxx
index f13a60082d7d..fc07053cbacf 100644
--- a/xmloff/qa/unit/draw.cxx
+++ b/xmloff/qa/unit/draw.cxx
@@ -19,6 +19,8 @@
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
#include <com/sun/star/drawing/XMasterPageTarget.hpp>
#include <com/sun/star/util/Color.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
#include <unotools/mediadescriptor.hxx>
#include <unotools/tempfile.hxx>
@@ -218,6 +220,28 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testReferToTheme)
"color-lum-off");
}
+CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTableInShape)
+{
+ // Given a document with a shape with a "FrameX" parent style (starts with Frame, but is not
+ // Frame):
+ OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "table-in-shape.fodt";
+
+ // When loading that document:
+ getComponent() = loadFromDesktop(aURL);
+
+ // Then make sure the table inside the shape is not lost:
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(getComponent(), uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
+ uno::Reference<text::XTextRange> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<container::XEnumerationAccess> xText(xShape->getText(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xEnum = xText->createEnumeration();
+ uno::Reference<text::XTextTable> xTable(xEnum->nextElement(), uno::UNO_QUERY);
+ // Without the accompanying fix in place, this test would have crashed, as xTable was an empty
+ // reference, i.e. the table inside the shape was lost.
+ uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("A1"), xCell->getString());
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */