diff options
author | Jens Carl <j.carl43@gmx.de> | 2019-03-16 17:37:41 +0000 |
---|---|---|
committer | Jens Carl <j.carl43@gmx.de> | 2019-03-16 20:14:47 +0100 |
commit | bb9728bbf9bb29ef2b6ca582a382f66e9adf2623 (patch) | |
tree | bcd6867940dbefdf05c013a900548368cfc958f9 | |
parent | aa04df5fd9c8359a50039f598f4998caf7e5afe6 (diff) |
tdf#45904 Move XNameReplace Java test to C++
Move XNameReplace Java test to C++ for ScAutoFormatsObj.
Change-Id: Iadde8031d9efbec12de76f889175029be448df13
Reviewed-on: https://gerrit.libreoffice.org/69342
Tested-by: Jenkins
Reviewed-by: Jens Carl <j.carl43@gmx.de>
-rw-r--r-- | qadevOOo/objdsc/sc/com.sun.star.comp.office.ScAutoFormatsObj.csv | 1 | ||||
-rw-r--r-- | sc/qa/extras/scautoformatsobj.cxx | 20 |
2 files changed, 19 insertions, 2 deletions
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScAutoFormatsObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScAutoFormatsObj.csv index c96b965eebdb..1e3f8d0e8359 100644 --- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScAutoFormatsObj.csv +++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScAutoFormatsObj.csv @@ -1,4 +1,3 @@ -"ScAutoFormatsObj";"com::sun::star::container::XNameReplace";"replaceByName()" "ScAutoFormatsObj";"com::sun::star::container::XNameContainer";"insertByName()" "ScAutoFormatsObj";"com::sun::star::container::XNameContainer";"removeByName()" "ScAutoFormatsObj";"com::sun::star::container::XIndexAccess";"getCount()" diff --git a/sc/qa/extras/scautoformatsobj.cxx b/sc/qa/extras/scautoformatsobj.cxx index 7ee677a51351..c3c1f30b0468 100644 --- a/sc/qa/extras/scautoformatsobj.cxx +++ b/sc/qa/extras/scautoformatsobj.cxx @@ -9,18 +9,23 @@ #include <test/calc_unoapi_test.hxx> #include <test/container/xnameaccess.hxx> +#include <test/container/xnamereplace.hxx> +#include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Reference.hxx> using namespace css; namespace sc_apitest { -class ScAutoFormatsObj : public CalcUnoApiTest, public apitest::XNameAccess +class ScAutoFormatsObj : public CalcUnoApiTest, + public apitest::XNameAccess, + public apitest::XNameReplace { public: ScAutoFormatsObj(); @@ -36,6 +41,9 @@ public: CPPUNIT_TEST(testGetElementNames); CPPUNIT_TEST(testHasByName); + // XNameReplace + CPPUNIT_TEST(testReplaceByName); + CPPUNIT_TEST_SUITE_END(); private: @@ -45,6 +53,7 @@ private: ScAutoFormatsObj::ScAutoFormatsObj() : CalcUnoApiTest("/sc/qa/extras/testdocuments") , XNameAccess("Default") + , XNameReplace("ScAutoFormatsObj") { } @@ -54,6 +63,15 @@ uno::Reference<uno::XInterface> ScAutoFormatsObj::init() uno::Reference<uno::XInterface> xTAF( xMSF->createInstance("com.sun.star.sheet.TableAutoFormats"), uno::UNO_QUERY_THROW); + uno::Reference<container::XNameContainer> xNC(xTAF, uno::UNO_QUERY_THROW); + if (!xNC->hasByName("ScAutoFormatsObj")) + { + xNC->insertByName("ScAutoFormatsObj", + uno::makeAny(xMSF->createInstance("com.sun.star.sheet.TableAutoFormat"))); + } + // XNameReplace + setReplacmentElement(uno::makeAny(xMSF->createInstance("com.sun.star.sheet.TableAutoFormat"))); + return xTAF; } |