diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:44:47 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:44:47 +0000 |
commit | 91fe6b97952aa6f7cef58327fd085a17db38ad95 (patch) | |
tree | 7a4412295bfb80e15a4936fe67d4bd7b96458ce8 /sw/qa/core/unocore | |
parent | Releasing progress-linux version 4:24.2.1-4~progress7.99u1. (diff) | |
download | libreoffice-91fe6b97952aa6f7cef58327fd085a17db38ad95.tar.xz libreoffice-91fe6b97952aa6f7cef58327fd085a17db38ad95.zip |
Merging upstream version 4:24.2.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/qa/core/unocore')
-rw-r--r-- | sw/qa/core/unocore/unocore.cxx | 27 |
1 files changed, 27 insertions, 0 deletions
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(); |