summaryrefslogtreecommitdiffstats
path: root/sw/qa/core
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa/core')
-rw-r--r--sw/qa/core/layout/data/floattable-wrapped-by-table-nested.docxbin0 -> 28111 bytes
-rw-r--r--sw/qa/core/layout/tabfrm.cxx14
-rw-r--r--sw/qa/core/unocore/unocore.cxx27
3 files changed, 41 insertions, 0 deletions
diff --git a/sw/qa/core/layout/data/floattable-wrapped-by-table-nested.docx b/sw/qa/core/layout/data/floattable-wrapped-by-table-nested.docx
new file mode 100644
index 0000000000..d6950a6c8e
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-wrapped-by-table-nested.docx
Binary files differ
diff --git a/sw/qa/core/layout/tabfrm.cxx b/sw/qa/core/layout/tabfrm.cxx
index 61b1a25109..e0d099c771 100644
--- a/sw/qa/core/layout/tabfrm.cxx
+++ b/sw/qa/core/layout/tabfrm.cxx
@@ -221,6 +221,20 @@ CPPUNIT_TEST_FIXTURE(Test, testInlineTableThenSplitFly)
// large positive one.
CPPUNIT_ASSERT_LESS(static_cast<SwTwips>(0), nInlineLeft);
}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyWrappedByTableNested)
+{
+ // Given a document with 3 tables, one inline toplevel and two inner ones (one inline, one
+ // floating):
+ // When laying out that document:
+ // Without the accompanying fix in place, this test would have failed here with a layout loop.
+ createSwDoc("floattable-wrapped-by-table-nested.docx");
+
+ // Than make sure we have 3 tables, but only one of them is floating:
+ SwDoc* pDoc = getSwDoc();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pDoc->GetTableFrameFormats()->GetFormatCount());
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDoc->GetSpzFrameFormats()->GetFormatCount());
+}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx
index 381fe0dab3..3e52b12a36 100644
--- a/sw/qa/core/unocore/unocore.cxx
+++ b/sw/qa/core/unocore/unocore.cxx
@@ -78,6 +78,33 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testTdf119081)
CPPUNIT_ASSERT_EQUAL(OUString("x"), pWrtShell->GetCurrentShellCursor().GetText());
}
+CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, selectTextRange)
+{
+ createSwDoc();
+ uno::Reference<text::XTextDocument> const xTD(mxComponent, uno::UNO_QUERY_THROW);
+ uno::Reference<text::XText> const xText(xTD->getText());
+ uno::Reference<text::XTextCursor> const xCursor(xText->createTextCursor());
+ xText->insertString(xCursor, "test", /*bAbsorb=*/false);
+ xCursor->gotoStart(false);
+ xCursor->gotoEnd(true);
+ CPPUNIT_ASSERT_EQUAL(OUString("test"), xCursor->getString());
+ uno::Reference<lang::XMultiServiceFactory> const xMSF(mxComponent, uno::UNO_QUERY_THROW);
+ uno::Reference<text::XTextSection> const xSection(
+ xMSF->createInstance("com.sun.star.text.TextSection"), uno::UNO_QUERY_THROW);
+ xText->insertTextContent(xCursor, xSection, true);
+ uno::Reference<text::XTextRange> const xAnchor(xSection->getAnchor());
+ uno::Reference<view::XSelectionSupplier> const xView(xTD->getCurrentController(),
+ uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("test"), xAnchor->getString());
+ CPPUNIT_ASSERT(xView->select(uno::Any(xAnchor)));
+ uno::Reference<container::XIndexAccess> xSel;
+ CPPUNIT_ASSERT(xView->getSelection() >>= xSel);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSel->getCount());
+ uno::Reference<text::XTextRange> xSelRange;
+ CPPUNIT_ASSERT(xSel->getByIndex(0) >>= xSelRange);
+ CPPUNIT_ASSERT_EQUAL(OUString("test"), xSelRange->getString());
+}
+
CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, flyAtParaAnchor)
{
createSwDoc();