[Libreoffice-commits] core.git: include/test qadevOOo/Jar_OOoRunner.mk qadevOOo/objdsc qadevOOo/tests sc/CppunitTest_sc_tabviewobj.mk sc/Module_sc.mk sc/qa test/Library_subsequenttest.mk test/source

Jens Carl j.carl43 at gmx.de
Tue Aug 8 05:24:14 UTC 2017


 include/test/sheet/xviewsplitable.hxx                        |   36 +++
 qadevOOo/Jar_OOoRunner.mk                                    |    1 
 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTabViewObj.csv |    6 
 qadevOOo/tests/java/ifc/sheet/_XViewSplitable.java           |  127 -----------
 sc/CppunitTest_sc_tabviewobj.mk                              |  105 +++++++++
 sc/Module_sc.mk                                              |    1 
 sc/qa/extras/sctabviewobj.cxx                                |   92 +++++++
 test/Library_subsequenttest.mk                               |    1 
 test/source/sheet/xviewsplitable.cxx                         |   43 +++
 9 files changed, 278 insertions(+), 134 deletions(-)

New commits:
commit 0bd57d62d0f15eced0e99097d9f46a86f177e9a1
Author: Jens Carl <j.carl43 at gmx.de>
Date:   Sun Aug 6 07:10:36 2017 +0000

    tdf#45904 Move Java _XViewSplitable tests to C++
    
    Change-Id: Ib9cf1c53947d10260673e1e1088bbfbaa30efbc9
    Reviewed-on: https://gerrit.libreoffice.org/40801
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/include/test/sheet/xviewsplitable.hxx b/include/test/sheet/xviewsplitable.hxx
new file mode 100644
index 000000000000..3ead42a919a9
--- /dev/null
+++ b/include/test/sheet/xviewsplitable.hxx
@@ -0,0 +1,36 @@
+/* -*- 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_XVIEWSPLITABLE_HXX
+#define INCLUDED_TEST_SHEET_XVIEWSPLITABLE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XViewSplitable
+{
+
+public:
+    virtual uno::Reference< uno::XInterface > init() = 0;
+    virtual ~XViewSplitable(){}
+
+    void testSplit();
+};
+
+}
+
+#endif // INCLUDED_TEST_SHEET_XVIEWSPLITABLE_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 553e5cb521ff..dfb164ffa102 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -653,7 +653,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
     qadevOOo/tests/java/ifc/sheet/_XUniqueCellFormatRangesSupplier \
     qadevOOo/tests/java/ifc/sheet/_XUsedAreaCursor \
     qadevOOo/tests/java/ifc/sheet/_XViewFreezable \
-    qadevOOo/tests/java/ifc/sheet/_XViewSplitable \
     qadevOOo/tests/java/ifc/style/_CharacterProperties \
     qadevOOo/tests/java/ifc/style/_CharacterPropertiesAsian \
     qadevOOo/tests/java/ifc/style/_CharacterPropertiesComplex \
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTabViewObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTabViewObj.csv
index 7119ec7ffe98..3f082cec3a73 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTabViewObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTabViewObj.csv
@@ -39,12 +39,6 @@
 "ScTabViewObj";"com::sun::star::sheet::XViewFreezable";"freezeAtPosition()"
 "ScTabViewObj";"com::sun::star::sheet::XActivationBroadcaster#optional";"addActivationEventListener()"
 "ScTabViewObj";"com::sun::star::sheet::XActivationBroadcaster#optional";"removeActivationEventListener()"
-"ScTabViewObj";"com::sun::star::sheet::XViewSplitable";"getIsWindowSplit()"
-"ScTabViewObj";"com::sun::star::sheet::XViewSplitable";"getSplitHorizontal()"
-"ScTabViewObj";"com::sun::star::sheet::XViewSplitable";"getSplitVertical()"
-"ScTabViewObj";"com::sun::star::sheet::XViewSplitable";"getSplitColumn()"
-"ScTabViewObj";"com::sun::star::sheet::XViewSplitable";"getSplitRow()"
-"ScTabViewObj";"com::sun::star::sheet::XViewSplitable";"splitAtPosition()"
 "ScTabViewObj";"com::sun::star::sheet::XRangeSelection";"startRangeSelection()"
 "ScTabViewObj";"com::sun::star::sheet::XRangeSelection";"abortRangeSelection()"
 "ScTabViewObj";"com::sun::star::sheet::XRangeSelection";"addRangeSelectionListener()"
diff --git a/qadevOOo/tests/java/ifc/sheet/_XViewSplitable.java b/qadevOOo/tests/java/ifc/sheet/_XViewSplitable.java
deleted file mode 100644
index c70719babe53..000000000000
--- a/qadevOOo/tests/java/ifc/sheet/_XViewSplitable.java
+++ /dev/null
@@ -1,127 +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.MultiMethodTest;
-
-import com.sun.star.sheet.XViewSplitable;
-
-/**
-* Testing <code>com.sun.star.sheet.XViewSplitable</code>
-* interface methods :
-* <ul>
-*  <li><code> getIsWindowSplit()</code></li>
-*  <li><code> getSplitHorizontal()</code></li>
-*  <li><code> getSplitVertical()</code></li>
-*  <li><code> getSplitColumn()</code></li>
-*  <li><code> getSplitRow()</code></li>
-*  <li><code> splitAtPosition()</code></li>
-* </ul> <p>
-* @see com.sun.star.sheet.XViewSplitable
-*/
-public class _XViewSplitable extends MultiMethodTest {
-
-    public XViewSplitable oObj = null;
-    protected static final int posX = 101, posY = 51;
-
-    /**
-    * Test just calls the method. <p>
-    * Has <b> OK </b> status if the method successfully returns. <p>
-    */
-    public void _splitAtPosition(){
-        oObj.splitAtPosition(posX, posY);
-        tRes.tested("splitAtPosition()", true);
-    }
-
-    /**
-    * Test calls the method and checks returned value. <p>
-    * Has <b> OK </b> status if returned value is equal to true. <p>
-    * The following method tests are to be completed successfully before :
-    * <ul>
-    *  <li> <code> splitAtPosition() </code> : that the view was splitted into
-    *   individual panes </li>
-    * </ul>
-    */
-    public void _getIsWindowSplit(){
-        requiredMethod("splitAtPosition()");
-        tRes.tested("getIsWindowSplit()", oObj.getIsWindowSplit());
-    }
-
-    /**
-    * Test calls the method and compares returned value with value that was
-    * set by method <code>splitAtPosition()</code>. <p>
-    * Has <b> OK </b> status if returned value is equal to value that was
-    * set by method <code>splitAtPosition()</code>. <p>
-    * The following method tests are to be completed successfully before :
-    * <ul>
-    *  <li> <code> splitAtPosition() </code> : to split the view at the
-    *  specified position </li>
-    * </ul>
-    */
-    public void _getSplitHorizontal() {
-        requiredMethod("splitAtPosition()");
-        tRes.tested("getSplitHorizontal()", oObj.getSplitHorizontal() == posX);
-    }
-
-    /**
-    * Test calls the method and compares returned value with value that was
-    * set by method <code>splitAtPosition()</code>. <p>
-    * Has <b> OK </b> status if returned value is equal to value that was
-    * set by method <code>splitAtPosition()</code>. <p>
-    * The following method tests are to be completed successfully before :
-    * <ul>
-    *  <li> <code> splitAtPosition() </code> : to split the view at the
-    *  specified position </li>
-    * </ul>
-    */
-    public void _getSplitVertical() {
-        requiredMethod("splitAtPosition()");
-        tRes.tested("getSplitVertical()", oObj.getSplitVertical() == posY);
-    }
-
-    /**
-    * Test calls the method and checks returned value. <p>
-    * Has <b> OK </b> status if returned value isn't equal zero. <p>
-    * The following method tests are to be completed successfully before :
-    * <ul>
-    *  <li> <code> splitAtPosition() </code> : to split the view at the
-    *  specified position </li>
-    * </ul>
-    */
-    public void _getSplitColumn() {
-        requiredMethod("splitAtPosition()");
-        tRes.tested("getSplitColumn()", oObj.getSplitColumn() != 0);
-    }
-
-    /**
-    * Test calls the method and checks returned value. <p>
-    * Has <b> OK </b> status if returned value isn't equal zero. <p>
-    * The following method tests are to be completed successfully before :
-    * <ul>
-    *  <li> <code> splitAtPosition() </code> : to split the view at the
-    *  specified position </li>
-    * </ul>
-    */
-    public void _getSplitRow() {
-        requiredMethod("splitAtPosition()");
-        tRes.tested("getSplitRow()", oObj.getSplitRow() != 0);
-    }
-}  // finish class _XViewSplitable
-
-
diff --git a/sc/CppunitTest_sc_tabviewobj.mk b/sc/CppunitTest_sc_tabviewobj.mk
new file mode 100644
index 000000000000..f29a986b2643
--- /dev/null
+++ b/sc/CppunitTest_sc_tabviewobj.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_tabviewobj))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_tabviewobj, \
+    sc/qa/extras/sctabviewobj \
+))
+
+$(eval $(call gb_CppunitTest_use_external,sc_tabviewobj,boost_headers))
+
+$(eval $(call gb_CppunitTest_use_libraries,sc_tabviewobj, \
+    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_tabviewobj,\
+    -I$(SRCDIR)/sc/source/ui/inc \
+    -I$(SRCDIR)/sc/inc \
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,sc_tabviewobj))
+
+$(eval $(call gb_CppunitTest_use_ure,sc_tabviewobj))
+$(eval $(call gb_CppunitTest_use_vcl,sc_tabviewobj))
+
+$(eval $(call gb_CppunitTest_use_components,sc_tabviewobj,\
+    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_tabviewobj))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 25c987ff4ae2..03a7565b899d 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -122,6 +122,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
 	CppunitTest_sc_viewpaneobj \
 	CppunitTest_sc_cellobj \
 	CppunitTest_sc_cellcursorobj \
+	CppunitTest_sc_tabviewobj \
 ))
 
 $(eval $(call gb_Module_add_perfcheck_targets,sc,\
diff --git a/sc/qa/extras/sctabviewobj.cxx b/sc/qa/extras/sctabviewobj.cxx
new file mode 100644
index 000000000000..7b83d08037da
--- /dev/null
+++ b/sc/qa/extras/sctabviewobj.cxx
@@ -0,0 +1,92 @@
+/* -*- 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/xviewsplitable.hxx>
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XViewSplitable.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+
+using namespace css;
+using namespace css::uno;
+
+namespace sc_apitest {
+
+#define NUMBER_OF_TESTS 1
+
+class ScTabViewObj : public CalcUnoApiTest, public apitest::XViewSplitable
+{
+public:
+    ScTabViewObj();
+
+    virtual uno::Reference< uno::XInterface > init() override;
+    virtual void setUp() override;
+    virtual void tearDown() override;
+
+    CPPUNIT_TEST_SUITE(ScTabViewObj);
+    // XViewSplitable
+    CPPUNIT_TEST(testSplit);
+
+    CPPUNIT_TEST_SUITE_END();
+
+private:
+
+    static sal_Int32 nTest;
+    static uno::Reference< lang::XComponent > mxComponent;
+};
+
+sal_Int32 ScTabViewObj::nTest = 0;
+uno::Reference< lang::XComponent > ScTabViewObj::mxComponent;
+
+ScTabViewObj::ScTabViewObj()
+    : CalcUnoApiTest("/sc/qa/extras/testdocuments")
+{
+}
+
+uno::Reference< uno::XInterface > ScTabViewObj::init()
+{
+    if (!mxComponent.is())
+        mxComponent = loadFromDesktop("private:factory/scalc");
+
+    uno::Reference< sheet::XSpreadsheetDocument > xSheetDoc(mxComponent, uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_MESSAGE("no calc document", xSheetDoc.is());
+
+    uno::Reference< frame::XModel > xModel(xSheetDoc, uno::UNO_QUERY_THROW);
+    uno::Reference< sheet::XViewSplitable > xViewSplitable(xModel->getCurrentController(), uno::UNO_QUERY_THROW);
+
+    return xViewSplitable;
+}
+
+void ScTabViewObj::setUp()
+{
+    nTest++;
+    CalcUnoApiTest::setUp();
+}
+
+void ScTabViewObj::tearDown()
+{
+    if (nTest == NUMBER_OF_TESTS)
+    {
+        closeDocument(mxComponent);
+        mxComponent.clear();
+    }
+
+    CalcUnoApiTest::tearDown();
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScTabViewObj);
+
+} // 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 d996d7ddf524..e69afd4d2a38 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -67,6 +67,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
     test/source/sheet/xsheetoutline \
     test/source/sheet/xstyleloader \
     test/source/sheet/xviewpane \
+    test/source/sheet/xviewsplitable \
     test/source/text/xtext \
     test/source/text/xtextfield \
     test/source/text/xtextcontent \
diff --git a/test/source/sheet/xviewsplitable.cxx b/test/source/sheet/xviewsplitable.cxx
new file mode 100644
index 000000000000..88bd531311f5
--- /dev/null
+++ b/test/source/sheet/xviewsplitable.cxx
@@ -0,0 +1,43 @@
+/* -*- 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/xviewsplitable.hxx>
+
+#include <com/sun/star/sheet/XViewSplitable.hpp>
+
+#include "cppunit/extensions/HelperMacros.h"
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+namespace apitest {
+
+void XViewSplitable::testSplit()
+{
+    uno::Reference< sheet::XViewSplitable > xViewSplitable(init(), UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_MESSAGE("View is already split", !xViewSplitable->getIsWindowSplit());
+
+    xViewSplitable->splitAtPosition(101, 51);
+
+    CPPUNIT_ASSERT_MESSAGE("View wasn't split", xViewSplitable->getIsWindowSplit());
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong horizontal pixel position",
+                                 sal_Int32(101), xViewSplitable->getSplitHorizontal());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical pixel position",
+                                 sal_Int32(51), xViewSplitable->getSplitVertical());
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong column",
+                                 sal_Int32(1), xViewSplitable->getSplitColumn());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong row",
+                                 sal_Int32(3), xViewSplitable->getSplitRow());
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */


More information about the Libreoffice-commits mailing list