diff options
-rw-r--r-- | include/test/lang/xcomponent.hxx | 1 | ||||
-rw-r--r-- | qadevOOo/objdsc/sc/com.sun.star.comp.office.ScShapeObj.csv | 3 | ||||
-rw-r--r-- | sc/qa/extras/scshapeobj.cxx | 26 | ||||
-rw-r--r-- | test/source/lang/xcomponent.cxx | 10 |
4 files changed, 27 insertions, 13 deletions
diff --git a/include/test/lang/xcomponent.hxx b/include/test/lang/xcomponent.hxx index 347a36e2925c..fdbeccc6cf7b 100644 --- a/include/test/lang/xcomponent.hxx +++ b/include/test/lang/xcomponent.hxx @@ -26,6 +26,7 @@ public: void testAddEventListener(); void testRemoveEventListener(); + void testDispose(); void testDisposedByDesktopTerminate(); protected: diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScShapeObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScShapeObj.csv index e7385e4ec6f7..47138b49c5ea 100644 --- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScShapeObj.csv +++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScShapeObj.csv @@ -1,6 +1,3 @@ -"ScShapeObj";"com::sun::star::lang::XComponent";"dispose()" -"ScShapeObj";"com::sun::star::lang::XComponent";"addEventListener()" -"ScShapeObj";"com::sun::star::lang::XComponent";"removeEventListener()" "ScShapeObj";"com::sun::star::drawing::Shape";"ZOrder#optional" "ScShapeObj";"com::sun::star::drawing::Shape";"LayerID#optional" "ScShapeObj";"com::sun::star::drawing::Shape";"LayerName#optional" diff --git a/sc/qa/extras/scshapeobj.cxx b/sc/qa/extras/scshapeobj.cxx index 279b07dead3d..2a1be6666bb1 100644 --- a/sc/qa/extras/scshapeobj.cxx +++ b/sc/qa/extras/scshapeobj.cxx @@ -8,6 +8,7 @@ */ #include <test/calc_unoapi_test.hxx> +#include <test/lang/xcomponent.hxx> #include <test/sheet/shape.hxx> #include <com/sun/star/awt/Point.hpp> @@ -25,17 +26,17 @@ #include <com/sun/star/uno/Reference.hxx> using namespace css; -using namespace css::uno; namespace sc_apitest { -class ScShapeObj : public CalcUnoApiTest, public apitest::Shape +class ScShapeObj : public CalcUnoApiTest, public apitest::Shape, public apitest::XComponent { public: ScShapeObj(); virtual uno::Reference<uno::XInterface> init() override; virtual uno::Reference<uno::XInterface> getXSheetDocument() override; + virtual void triggerDesktopTerminate() override{}; virtual void setUp() override; virtual void tearDown() override; @@ -45,6 +46,11 @@ public: CPPUNIT_TEST(testShapePropertiesAnchor); CPPUNIT_TEST(testShapePropertiesPosition); + // XComponent + CPPUNIT_TEST(testAddEventListener); + CPPUNIT_TEST(testDispose); + CPPUNIT_TEST(testRemoveEventListener); + CPPUNIT_TEST_SUITE_END(); private: @@ -58,18 +64,18 @@ ScShapeObj::ScShapeObj() uno::Reference<uno::XInterface> ScShapeObj::init() { - uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, uno::UNO_QUERY_THROW); - uno::Reference<lang::XMultiServiceFactory> xMSF(xDoc, UNO_QUERY_THROW); + uno::Reference<lang::XMultiServiceFactory> xMSF(xDoc, uno::UNO_QUERY_THROW); uno::Reference<drawing::XShape> xShape( - xMSF->createInstance("com.sun.star.drawing.RectangleShape"), UNO_QUERY_THROW); + xMSF->createInstance("com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY_THROW); xShape->setPosition(awt::Point(5000, 3500)); xShape->setSize(awt::Size(7500, 5000)); - uno::Reference<drawing::XDrawPagesSupplier> xDPS(xDoc, UNO_QUERY_THROW); + uno::Reference<drawing::XDrawPagesSupplier> xDPS(xDoc, uno::UNO_QUERY_THROW); uno::Reference<drawing::XDrawPages> xDrawPages = xDPS->getDrawPages(); - uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPages->getByIndex(0), UNO_QUERY_THROW); - uno::Reference<drawing::XShapes> xShapes(xDrawPage, UNO_QUERY_THROW); + uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPages->getByIndex(0), uno::UNO_QUERY_THROW); + uno::Reference<drawing::XShapes> xShapes(xDrawPage, uno::UNO_QUERY_THROW); xShapes->add(xShape); for (auto i = 0; i < 10; i++) @@ -84,7 +90,7 @@ uno::Reference<uno::XInterface> ScShapeObj::init() uno::Reference<uno::XInterface> ScShapeObj::getXSheetDocument() { - uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, uno::UNO_QUERY_THROW); return xDoc; } @@ -103,7 +109,7 @@ void ScShapeObj::tearDown() CPPUNIT_TEST_SUITE_REGISTRATION(ScShapeObj); -} // end namespace +} // namespace sc_apitest CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/test/source/lang/xcomponent.cxx b/test/source/lang/xcomponent.cxx index 386fa45f232f..ef0049d5953c 100644 --- a/test/source/lang/xcomponent.cxx +++ b/test/source/lang/xcomponent.cxx @@ -57,6 +57,16 @@ void XComponent::testRemoveEventListener() CPPUNIT_ASSERT_EQUAL(false, pListenerAddedAndRemoved->m_hasDisposingCalled); } +void XComponent::testDispose() +{ + Reference<lang::XComponent> xComponent(init(), uno::UNO_QUERY_THROW); + auto pListenerAdded(new TestEventListener()); + Reference<lang::XEventListener> xListenerAdded(pListenerAdded); + xComponent->addEventListener(xListenerAdded); + xComponent->dispose(); + CPPUNIT_ASSERT_EQUAL(true, pListenerAdded->m_hasDisposingCalled); +} + void XComponent::testDisposedByDesktopTerminate() { Reference<lang::XComponent> xComponent(init(), uno::UNO_QUERY_THROW); |