include/test/sheet/tableautoformat.hxx                          |   34 +++
 qadevOOo/Jar_OOoRunner.mk                                       |    1 
 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScAutoFormatObj.csv |    6 
 qadevOOo/tests/java/ifc/sheet/_TableAutoFormat.java             |   40 ---
 sc/CppunitTest_sc_autoformatobj.mk                              |  105 
++++++++++
 sc/Module_sc.mk                                                 |    1 
 sc/qa/extras/scautoformatobj.cxx                                |  101 
+++++++++
 test/Library_subsequenttest.mk                                  |    1 
 test/source/sheet/tableautoformat.cxx                           |   95 
+++++++++
 9 files changed, 337 insertions(+), 47 deletions(-)

New commits:
commit 5de151f0fd7b590ae13560086b46ea84e4d9cf9c
Author: Jens Carl <j.car...@gmx.de>
Date:   Wed Jan 3 22:45:19 2018 +0000

    tdf#45904 Move _TableAutoFormat Java tests to C++
    
    Change-Id: Ib26a2d2a05d926a0d031c86812456996cb368792
    Reviewed-on: https://gerrit.libreoffice.org/47361
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Jens Carl <j.car...@gmx.de>

diff --git a/include/test/sheet/tableautoformat.hxx 
b/include/test/sheet/tableautoformat.hxx
new file mode 100644
index 000000000000..3a04784a198c
--- /dev/null
+++ b/include/test/sheet/tableautoformat.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_TABLEAUTOFORMAT_HXX
+#define INCLUDED_TEST_SHEET_TABLEAUTOFORMAT_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST TableAutoFormat
+{
+public:
+    virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+    void testTableAutoFormatProperties();
+
+protected:
+    ~TableAutoFormat() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_TABLEAUTOFORMAT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk
index b8ed2487e317..bc33f52aa853 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -579,7 +579,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
     qadevOOo/tests/java/ifc/sheet/_SpreadsheetDocumentSettings \
     qadevOOo/tests/java/ifc/sheet/_SpreadsheetViewSettings \
     qadevOOo/tests/java/ifc/sheet/_SubTotalDescriptor \
-    qadevOOo/tests/java/ifc/sheet/_TableAutoFormat \
     qadevOOo/tests/java/ifc/sheet/_TableAutoFormatField \
     qadevOOo/tests/java/ifc/sheet/_XActivationBroadcaster \
     qadevOOo/tests/java/ifc/sheet/_XArrayFormulaRange \
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScAutoFormatObj.csv 
b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScAutoFormatObj.csv
index e5015197c6bc..5c2ef08269c9 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScAutoFormatObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScAutoFormatObj.csv
@@ -1,11 +1,5 @@
 "ScAutoFormatObj";"com::sun::star::container::XIndexAccess";"getCount()"
 "ScAutoFormatObj";"com::sun::star::container::XIndexAccess";"getByIndex()"
-"ScAutoFormatObj";"com::sun::star::sheet::TableAutoFormat";"IncludeFont"
-"ScAutoFormatObj";"com::sun::star::sheet::TableAutoFormat";"IncludeJustify"
-"ScAutoFormatObj";"com::sun::star::sheet::TableAutoFormat";"IncludeBorder"
-"ScAutoFormatObj";"com::sun::star::sheet::TableAutoFormat";"IncludeBackground"
-"ScAutoFormatObj";"com::sun::star::sheet::TableAutoFormat";"IncludeNumberFormat"
-"ScAutoFormatObj";"com::sun::star::sheet::TableAutoFormat";"IncludeWidthAndHeight"
 
"ScAutoFormatObj";"com::sun::star::container::XElementAccess";"getElementType()"
 "ScAutoFormatObj";"com::sun::star::container::XElementAccess";"hasElements()"
 "ScAutoFormatObj";"com::sun::star::container::XNamed";"getName()"
diff --git a/qadevOOo/tests/java/ifc/sheet/_TableAutoFormat.java 
b/qadevOOo/tests/java/ifc/sheet/_TableAutoFormat.java
deleted file mode 100644
index 817a4cc55a5f..000000000000
--- a/qadevOOo/tests/java/ifc/sheet/_TableAutoFormat.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package ifc.sheet;
-
-import lib.MultiPropertyTest;
-
-/**
-* Testing <code>com.sun.star.sheet.TableAutoFormat</code>
-* service properties :
-* <ul>
-*  <li><code> IncludeFont</code></li>
-*  <li><code> IncludeJustify</code></li>
-*  <li><code> IncludeBorder</code></li>
-*  <li><code> IncludeBackground</code></li>
-*  <li><code> IncludeNumberFormat</code></li>
-*  <li><code> IncludeWidthAndHeight</code></li>
-* </ul> <p>
-* Properties testing is automated by <code>lib.MultiPropertyTest</code>.
-* @see com.sun.star.sheet.TableAutoFormat
-*/
-public class _TableAutoFormat extends MultiPropertyTest {
-}  // finish class _TableAutoFormat
-
-
diff --git a/sc/CppunitTest_sc_autoformatobj.mk 
b/sc/CppunitTest_sc_autoformatobj.mk
new file mode 100644
index 000000000000..76b93534de7f
--- /dev/null
+++ b/sc/CppunitTest_sc_autoformatobj.mk
@@ -0,0 +1,105 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sc_autoformatobj))
+
+$(eval $(call gb_CppunitTest_use_external,sc_autoformatobj,boost_headers))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_autoformatobj, \
+       sc/qa/extras/scautoformatobj \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sc_autoformatobj, \
+       basegfx \
+       comphelper \
+       cppu \
+       cppuhelper \
+       drawinglayer \
+       editeng \
+       for \
+       forui \
+       i18nlangtag \
+       msfilter \
+       oox \
+       sal \
+       salhelper \
+       sax \
+       sb \
+       sc \
+       sfx \
+       sot \
+       subsequenttest \
+       svl \
+       svt \
+       svx \
+       svxcore \
+       test \
+       tk \
+       tl \
+       ucbhelper \
+       unotest \
+       utl \
+       vbahelper \
+       vcl \
+       xo \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_autoformatobj,\
+       -I$(SRCDIR)/sc/source/ui/inc \
+       -I$(SRCDIR)/sc/inc \
+       $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,sc_autoformatobj))
+
+$(eval $(call gb_CppunitTest_use_ure,sc_autoformatobj))
+$(eval $(call gb_CppunitTest_use_vcl,sc_autoformatobj))
+
+$(eval $(call gb_CppunitTest_use_components,sc_autoformatobj,\
+       basic/util/sb \
+       comphelper/util/comphelp \
+       configmgr/source/configmgr \
+       dbaccess/util/dba \
+       filter/source/config/cache/filterconfig1 \
+       filter/source/storagefilterdetect/storagefd \
+       forms/util/frm \
+       framework/util/fwk \
+       i18npool/util/i18npool \
+       linguistic/source/lng \
+       oox/util/oox \
+       package/source/xstor/xstor \
+       package/util/package2 \
+       sax/source/expatwrap/expwrap \
+       scripting/source/basprov/basprov \
+       scripting/util/scriptframe \
+       sc/util/sc \
+       sc/util/scd \
+       sc/util/scfilt \
+       $(call gb_Helper_optional,SCRIPTING, \
+               sc/util/vbaobj) \
+       sfx2/util/sfx \
+       sot/util/sot \
+       svl/source/fsstor/fsstorage \
+       toolkit/util/tk \
+       ucb/source/core/ucb1 \
+       ucb/source/ucp/file/ucpfile1 \
+       ucb/source/ucp/tdoc/ucptdoc1 \
+       unotools/util/utl \
+       unoxml/source/rdf/unordf \
+       unoxml/source/service/unoxml \
+       uui/util/uui \
+       xmloff/util/xo \
+       svtools/util/svt \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sc_autoformatobj))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index bfdf6f277aa3..a9e986b7053d 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -148,6 +148,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
        CppunitTest_sc_databaserangesobj \
        CppunitTest_sc_consolidationdescriptorobj \
        CppunitTest_sc_chart2dataprovider \
+       CppunitTest_sc_autoformatobj \
 ))
 
 $(eval $(call gb_Module_add_perfcheck_targets,sc,\
diff --git a/sc/qa/extras/scautoformatobj.cxx b/sc/qa/extras/scautoformatobj.cxx
new file mode 100644
index 000000000000..bf5722e7159a
--- /dev/null
+++ b/sc/qa/extras/scautoformatobj.cxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/calc_unoapi_test.hxx>
+#include <test/sheet/tableautoformat.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+using namespace css;
+using namespace css::uno;
+using namespace com::sun::star;
+
+namespace sc_apitest
+{
+#define NUMBER_OF_TESTS 1
+
+class ScTableAutoFormatObj : public CalcUnoApiTest, public 
apitest::TableAutoFormat
+{
+public:
+    ScTableAutoFormatObj();
+
+    virtual uno::Reference<uno::XInterface> init() override;
+    virtual void setUp() override;
+    virtual void tearDown() override;
+
+    CPPUNIT_TEST_SUITE(ScTableAutoFormatObj);
+
+    // TableAutoFormat
+    CPPUNIT_TEST(testTableAutoFormatProperties);
+
+    CPPUNIT_TEST_SUITE_END();
+
+private:
+    static sal_Int32 nTest;
+    static uno::Reference<lang::XComponent> mxComponent;
+};
+
+sal_Int32 ScTableAutoFormatObj::nTest = 0;
+uno::Reference<lang::XComponent> ScTableAutoFormatObj::mxComponent;
+
+ScTableAutoFormatObj::ScTableAutoFormatObj()
+    : CalcUnoApiTest("/sc/qa/extras/testdocuments")
+{
+}
+
+uno::Reference<uno::XInterface> ScTableAutoFormatObj::init()
+{
+    // create a calc document
+    if (!mxComponent.is())
+        mxComponent = loadFromDesktop("private:factory/scalc");
+
+    uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, 
UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is());
+
+    uno::Reference<lang::XMultiServiceFactory> xMSF(xDoc, UNO_QUERY_THROW);
+    uno::Reference<container::XIndexAccess> xIA(
+        xMSF->createInstance("com.sun.star.sheet.TableAutoFormats"), 
UNO_QUERY_THROW);
+
+    uno::Reference<beans::XPropertySet> 
xTableAutoFormat(xIA->getByIndex(xIA->getCount() - 1),
+                                                         UNO_QUERY_THROW);
+    return xTableAutoFormat;
+}
+
+void ScTableAutoFormatObj::setUp()
+{
+    nTest++;
+    CPPUNIT_ASSERT(nTest <= NUMBER_OF_TESTS);
+    CalcUnoApiTest::setUp();
+}
+
+void ScTableAutoFormatObj::tearDown()
+{
+    if (nTest == NUMBER_OF_TESTS)
+    {
+        closeDocument(mxComponent);
+        mxComponent.clear();
+    }
+
+    CalcUnoApiTest::tearDown();
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScTableAutoFormatObj);
+
+} // end namespace
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 6768f10fc692..d4152b3290e6 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -48,6 +48,7 @@ $(eval $(call 
gb_Library_add_exception_objects,subsequenttest,\
        test/source/sheet/datapilotfield \
        test/source/sheet/datapilotitem \
        test/source/sheet/scenario \
+       test/source/sheet/tableautoformat \
        test/source/sheet/tablevalidation \
        test/source/sheet/xarealink \
        test/source/sheet/xarealinks \
diff --git a/test/source/sheet/tableautoformat.cxx 
b/test/source/sheet/tableautoformat.cxx
new file mode 100644
index 000000000000..28f98eb172f6
--- /dev/null
+++ b/test/source/sheet/tableautoformat.cxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/sheet/tableautoformat.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+namespace apitest
+{
+void TableAutoFormat::testTableAutoFormatProperties()
+{
+    uno::Reference<beans::XPropertySet> xTableAutoFormat(init(), 
UNO_QUERY_THROW);
+    OUString propName;
+    uno::Any aNewValue;
+
+    propName = "IncludeFont";
+    bool aIncludeFont = false;
+    CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= 
aIncludeFont);
+    CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeFont", 
aIncludeFont);
+
+    aNewValue <<= false;
+    xTableAutoFormat->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= 
aIncludeFont);
+    CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeFont", 
!aIncludeFont);
+
+    propName = "IncludeJustify";
+    bool aIncludeJustify = false;
+    CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= 
aIncludeJustify);
+    CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeJustify", 
aIncludeJustify);
+
+    aNewValue <<= false;
+    xTableAutoFormat->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= 
aIncludeJustify);
+    CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeJustify", 
!aIncludeJustify);
+
+    propName = "IncludeBorder";
+    bool aIncludeBorder = false;
+    CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= 
aIncludeBorder);
+    CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeBorder", 
aIncludeBorder);
+
+    aNewValue <<= false;
+    xTableAutoFormat->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= 
aIncludeBorder);
+    CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeBorder", 
!aIncludeBorder);
+
+    propName = "IncludeBackground";
+    bool aIncludeBackground = false;
+    CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= 
aIncludeBackground);
+    CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeBackground", 
aIncludeBackground);
+
+    aNewValue <<= false;
+    xTableAutoFormat->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= 
aIncludeBackground);
+    CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeBackground", 
!aIncludeBackground);
+
+    propName = "IncludeNumberFormat";
+    bool aIncludeNumberFormat = false;
+    CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= 
aIncludeNumberFormat);
+    CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeNumberFormat",
+                           aIncludeNumberFormat);
+
+    aNewValue <<= false;
+    xTableAutoFormat->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= 
aIncludeNumberFormat);
+    CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeNumberFormat",
+                           !aIncludeNumberFormat);
+
+    propName = "IncludeWidthAndHeight";
+    bool aIncludeWidthAndHeight = false;
+    CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= 
aIncludeWidthAndHeight);
+    CPPUNIT_ASSERT_MESSAGE("Unable to get property value 
IncludeWidthAndHeight",
+                           aIncludeWidthAndHeight);
+
+    aNewValue <<= false;
+    xTableAutoFormat->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= 
aIncludeWidthAndHeight);
+    CPPUNIT_ASSERT_MESSAGE("Unable to set property value 
IncludeWidthAndHeight",
+                           !aIncludeWidthAndHeight);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to