summaryrefslogtreecommitdiff
path: root/sw/qa/api/SwXTextTable.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa/api/SwXTextTable.cxx')
-rw-r--r--sw/qa/api/SwXTextTable.cxx36
1 files changed, 9 insertions, 27 deletions
diff --git a/sw/qa/api/SwXTextTable.cxx b/sw/qa/api/SwXTextTable.cxx
index 71a3a502cabc..83971f2c3eaf 100644
--- a/sw/qa/api/SwXTextTable.cxx
+++ b/sw/qa/api/SwXTextTable.cxx
@@ -7,15 +7,13 @@
* 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 <unotest/macros_test.hxx>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/text/XTextDocument.hpp>
-#include <com/sun/star/text/XTextContent.hpp>
#include <com/sun/star/text/XText.hpp>
#include <com/sun/star/text/XTextTable.hpp>
#include <com/sun/star/text/XTextCursor.hpp>
@@ -30,12 +28,9 @@ namespace
/**
* Initial tests for SwXTextTable.
*/
-struct SwXTextTable final : public test::BootstrapFixture,
- public unotest::MacrosTest,
- public apitest::XComponent
+struct SwXTextTable final : public UnoApiTest, public apitest::XComponent
{
- virtual void setUp() override;
- void tearDown() override;
+ SwXTextTable();
Reference<XInterface> init() override;
void triggerDesktopTerminate() override;
@@ -44,36 +39,23 @@ struct SwXTextTable final : public test::BootstrapFixture,
CPPUNIT_TEST(testAddEventListener);
CPPUNIT_TEST(testRemoveEventListener);
CPPUNIT_TEST_SUITE_END();
-
-private:
- css::uno::Reference<css::lang::XComponent> component_;
};
-void SwXTextTable::setUp()
-{
- test::BootstrapFixture::setUp();
- mxDesktop.set(
- frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory())));
-}
-
-void SwXTextTable::tearDown()
+SwXTextTable::SwXTextTable()
+ : UnoApiTest(u""_ustr)
{
- if (component_.is())
- {
- component_->dispose();
- }
}
void SwXTextTable::triggerDesktopTerminate() { mxDesktop->terminate(); }
Reference<XInterface> SwXTextTable::init()
{
- component_ = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument");
- Reference<text::XTextDocument> xTextDocument(component_, UNO_QUERY_THROW);
- Reference<lang::XMultiServiceFactory> xMSF(component_, UNO_QUERY_THROW);
+ loadFromURL(u"private:factory/swriter"_ustr);
+ 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::XTextTable> xTable(xMSF->createInstance("com.sun.star.text.TextTable"),
+ Reference<text::XTextTable> xTable(xMSF->createInstance(u"com.sun.star.text.TextTable"_ustr),
UNO_QUERY_THROW);
xTable->initialize(4, 3);
xText->insertTextContent(xCursor, xTable, false);