summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authoranfanite396 <dipamt1729@gmail.com>2023-08-17 16:45:43 +0530
committerTomaž Vajngerl <quikee@gmail.com>2023-08-23 15:30:47 +0200
commit6d9f68e47a1984fe310293ea2318e314f4a18bb2 (patch)
tree490ec6208b36dc0ef01fe00f132b94e1e772e873 /sw
parentbb720ac6aba93256c0ecdd8e50b29e750428ff49 (diff)
tdf#45904: Remove old SwXBookmark Java test
Change-Id: If17818329b805a03b975e105ea97f7c6cc16d1a4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155767 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/api/SwXBookmark.cxx96
-rw-r--r--sw/qa/unoapi/sw_1.sce1
2 files changed, 37 insertions, 60 deletions
diff --git a/sw/qa/api/SwXBookmark.cxx b/sw/qa/api/SwXBookmark.cxx
index 185e0b53f1db..ca6c02d81f8b 100644
--- a/sw/qa/api/SwXBookmark.cxx
+++ b/sw/qa/api/SwXBookmark.cxx
@@ -7,11 +7,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include <test/bootstrapfixture.hxx>
+#include <test/unoapi_test.hxx>
#include <test/lang/xcomponent.hxx>
#include <test/container/xnamed.hxx>
#include <test/text/xtextcontent.hxx>
-#include <unotest/macros_test.hxx>
#include <com/sun/star/frame/Desktop.hpp>
@@ -28,22 +27,48 @@ namespace
/**
* Initial tests for SwXBookmark.
*/
-class SwXBookmark final : public test::BootstrapFixture,
- public unotest::MacrosTest,
+class SwXBookmark final : public UnoApiTest,
public apitest::XComponent,
public apitest::XNamed,
public apitest::XTextContent
{
public:
- SwXBookmark();
- virtual void setUp() override;
- void tearDown() override;
-
- Reference<XInterface> init() override;
- Reference<text::XTextRange> getTextRange() override;
- Reference<text::XTextContent> getTextContent() override;
+ SwXBookmark()
+ : UnoApiTest("")
+ , XNamed("Bookmark")
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ Reference<XInterface> init() override
+ {
+ Reference<text::XTextDocument> xTextDocument(mxComponent, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(mxComponent, UNO_QUERY_THROW);
+
+ Reference<text::XText> xText = xTextDocument->getText();
+ Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+
+ Reference<text::XTextContent> xBookmark(xMSF->createInstance("com.sun.star.text.Bookmark"),
+ UNO_QUERY_THROW);
+
+ xText->insertTextContent(xCursor, xBookmark, false);
+ mxTextRange = Reference<text::XTextRange>(xCursor, UNO_QUERY_THROW);
+ mxTextContent = Reference<text::XTextContent>(
+ xMSF->createInstance("com.sun.star.text.Bookmark"), UNO_QUERY_THROW);
+
+ return Reference<XInterface>(xBookmark, UNO_QUERY_THROW);
+ }
+
+ Reference<text::XTextRange> getTextRange() override { return mxTextRange; };
+ Reference<text::XTextContent> getTextContent() override { return mxTextContent; };
bool isAttachSupported() override { return true; }
- Reference<text::XTextDocument> getTextDocument() { return mxTextDocument; }
void triggerDesktopTerminate() override { mxDesktop->terminate(); }
CPPUNIT_TEST_SUITE(SwXBookmark);
@@ -57,57 +82,10 @@ public:
CPPUNIT_TEST_SUITE_END();
private:
- Reference<text::XTextDocument> mxTextDocument;
Reference<text::XTextRange> mxTextRange;
Reference<text::XTextContent> mxTextContent;
};
-SwXBookmark::SwXBookmark()
- : XNamed("Bookmark")
-{
-}
-
-void SwXBookmark::setUp()
-{
- test::BootstrapFixture::setUp();
-
- mxDesktop.set(frame::Desktop::create(mxComponentContext));
- mxTextDocument = Reference<text::XTextDocument>(
- loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"),
- UNO_QUERY_THROW);
- CPPUNIT_ASSERT(mxTextDocument.is());
-}
-
-void SwXBookmark::tearDown()
-{
- if (mxTextDocument.is())
- mxTextDocument->dispose();
-
- test::BootstrapFixture::tearDown();
-}
-
-Reference<XInterface> SwXBookmark::init()
-{
- Reference<lang::XMultiServiceFactory> xMSF(mxTextDocument, UNO_QUERY_THROW);
-
- Reference<text::XText> xText = getTextDocument()->getText();
- Reference<text::XTextCursor> xCursor = xText->createTextCursor();
-
- Reference<text::XTextContent> xBookmark(xMSF->createInstance("com.sun.star.text.Bookmark"),
- UNO_QUERY_THROW);
-
- xText->insertTextContent(xCursor, xBookmark, false);
- mxTextRange = Reference<text::XTextRange>(xCursor, UNO_QUERY_THROW);
- mxTextContent = Reference<text::XTextContent>(
- xMSF->createInstance("com.sun.star.text.Bookmark"), UNO_QUERY_THROW);
-
- return Reference<XInterface>(xBookmark, UNO_QUERY_THROW);
-}
-
-Reference<text::XTextRange> SwXBookmark::getTextRange() { return mxTextRange; }
-
-Reference<text::XTextContent> SwXBookmark::getTextContent() { return mxTextContent; }
-
CPPUNIT_TEST_SUITE_REGISTRATION(SwXBookmark);
}
diff --git a/sw/qa/unoapi/sw_1.sce b/sw/qa/unoapi/sw_1.sce
index 69d989ffcf2f..8d26bee21e7f 100644
--- a/sw/qa/unoapi/sw_1.sce
+++ b/sw/qa/unoapi/sw_1.sce
@@ -37,7 +37,6 @@
-o sw.SwXAutoTextEntry
-o sw.SwXAutoTextGroup
-o sw.SwXBodyText
--o sw.SwXBookmark
-o sw.SwXCell
-o sw.SwXCellRange
-o sw.SwXChapterNumbering