[Libreoffice-commits] core.git: sc/qa

Jens Carl (via logerrit) logerrit at kemper.freedesktop.org
Mon Mar 2 03:57:59 UTC 2020


 sc/qa/extras/sctablesheetsobj.cxx |   49 ++++++++++++++++++++++++--------------
 1 file changed, 31 insertions(+), 18 deletions(-)

New commits:
commit a741e86aaf9cc148dca20c2337a42e68270e669f
Author:     Jens Carl <j.carl43 at gmx.de>
AuthorDate: Sat Feb 29 11:10:25 2020 -0800
Commit:     Jens Carl <j.carl43 at gmx.de>
CommitDate: Mon Mar 2 04:57:24 2020 +0100

    Add XServiceInfo tests to ScTableSheetsObj
    
    Change-Id: Iaaadc2554bb0ce103ef01bbf02c316d21fae51af
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89761
    Tested-by: Jenkins
    Reviewed-by: Jens Carl <j.carl43 at gmx.de>

diff --git a/sc/qa/extras/sctablesheetsobj.cxx b/sc/qa/extras/sctablesheetsobj.cxx
index 41856b5b2df7..286ff839622c 100644
--- a/sc/qa/extras/sctablesheetsobj.cxx
+++ b/sc/qa/extras/sctablesheetsobj.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -14,17 +14,25 @@
 #include <test/container/xnameaccess.hxx>
 #include <test/container/xnamecontainer.hxx>
 #include <test/container/xnamereplace.hxx>
+#include <test/lang/xserviceinfo.hxx>
 #include <test/sheet/xspreadsheets.hxx>
 #include <test/sheet/xspreadsheets2.hxx>
-#include <cppu/unotype.hxx>
 
+#include <com/sun/star/lang/XComponent.hpp>
 #include <com/sun/star/sheet/XSpreadsheet.hpp>
 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <cppu/unotype.hxx>
 
 using namespace css;
 using namespace css::uno;
 
-namespace sc_apitest {
+namespace sc_apitest
+{
 class ScTableSheetsObj : public CalcUnoApiTest,
                          public ::apitest::XElementAccess,
                          public ::apitest::XEnumerationAccess,
@@ -32,6 +40,7 @@ class ScTableSheetsObj : public CalcUnoApiTest,
                          public ::apitest::XNameAccess,
                          public ::apitest::XNameContainer,
                          public ::apitest::XNameReplace,
+                         public ::apitest::XServiceInfo,
                          public ::apitest::XSpreadsheets,
                          public ::apitest::XSpreadsheets2
 {
@@ -40,6 +49,7 @@ public:
 
     virtual void setUp() override;
     virtual void tearDown() override;
+    virtual uno::Reference<uno::XInterface> init() override;
 
     CPPUNIT_TEST_SUITE(ScTableSheetsObj);
 
@@ -69,6 +79,11 @@ public:
     // XNameReplace
     CPPUNIT_TEST(testReplaceByName);
 
+    // XServiceInfo
+    CPPUNIT_TEST(testGetImplementationName);
+    CPPUNIT_TEST(testGetSupportedServiceNames);
+    CPPUNIT_TEST(testSupportsService);
+
     // XSpreadsheets
     CPPUNIT_TEST(testInsertNewByName);
     CPPUNIT_TEST(testInsertNewByNameBadName);
@@ -90,12 +105,12 @@ public:
 
     CPPUNIT_TEST_SUITE_END();
 
-    virtual uno::Reference< lang::XComponent > getComponent() override;
+    virtual uno::Reference<lang::XComponent> getComponent() override;
     virtual void createFileURL(const OUString& rFileBase, OUString& rFileURL) override;
-    virtual uno::Reference< lang::XComponent > loadFromDesktop(const OUString& rString) override;
-    virtual uno::Reference< uno::XInterface > init() override;
+    virtual uno::Reference<lang::XComponent> loadFromDesktop(const OUString& rString) override;
+
 protected:
-    uno::Reference< lang::XComponent > mxComponent;
+    uno::Reference<lang::XComponent> mxComponent;
 };
 
 ScTableSheetsObj::ScTableSheetsObj()
@@ -105,31 +120,30 @@ ScTableSheetsObj::ScTableSheetsObj()
     , ::apitest::XNameAccess("Sheet1")
     , ::apitest::XNameContainer("Sheet2")
     , ::apitest::XNameReplace("Sheet2")
+    , ::apitest::XServiceInfo("ScTableSheetsObj", "com.sun.star.sheet.Spreadsheets")
 {
 }
 
-uno::Reference< lang::XComponent > ScTableSheetsObj::getComponent()
-{
-    return mxComponent;
-}
+uno::Reference<lang::XComponent> ScTableSheetsObj::getComponent() { return mxComponent; }
 
 void ScTableSheetsObj::createFileURL(const OUString& rFileBase, OUString& rFileURL)
 {
     CalcUnoApiTest::createFileURL(rFileBase, rFileURL);
 }
 
-uno::Reference< lang::XComponent > ScTableSheetsObj::loadFromDesktop(const OUString& rString)
+uno::Reference<lang::XComponent> ScTableSheetsObj::loadFromDesktop(const OUString& rString)
 {
     return CalcUnoApiTest::loadFromDesktop(rString);
 }
 
-uno::Reference< uno::XInterface > ScTableSheetsObj::init()
+uno::Reference<uno::XInterface> ScTableSheetsObj::init()
 {
     xDocument.set(mxComponent, UNO_QUERY_THROW);
-    uno::Reference< uno::XInterface > xReturn( xDocument->getSheets(), UNO_QUERY_THROW);
+    uno::Reference<uno::XInterface> xReturn(xDocument->getSheets(), UNO_QUERY_THROW);
 
     uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY_THROW);
-    XNameContainer::setElement(uno::makeAny(xMSF->createInstance("com.sun.star.sheet.Spreadsheet")));
+    XNameContainer::setElement(
+        uno::makeAny(xMSF->createInstance("com.sun.star.sheet.Spreadsheet")));
     // XNameReplace
     setReplacementElement(uno::makeAny(xMSF->createInstance("com.sun.star.sheet.Spreadsheet")));
 
@@ -152,9 +166,8 @@ void ScTableSheetsObj::tearDown()
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ScTableSheetsObj);
-
-}
+} // namespace sc_apitest
 
 CPPUNIT_PLUGIN_IMPLEMENT();
 
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */


More information about the Libreoffice-commits mailing list