[Libreoffice-commits] core.git: include/test qadevOOo/Jar_OOoRunner.mk qadevOOo/objdsc qadevOOo/tests sc/qa test/Library_subsequenttest.mk test/source
Jens Carl
j.carl43 at gmx.de
Sun Oct 29 22:45:19 UTC 2017
include/test/sheet/xsheetlinkable.hxx | 40 +++
qadevOOo/Jar_OOoRunner.mk | 1
qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv | 7
qadevOOo/tests/java/ifc/sheet/_XSheetLinkable.java | 104 ----------
sc/qa/extras/sctablesheetobj.cxx | 47 ++--
test/Library_subsequenttest.mk | 1
test/source/sheet/xsheetlinkable.cxx | 50 ++++
7 files changed, 121 insertions(+), 129 deletions(-)
New commits:
commit 4200896e36f259a60b3d3288e13ff08d2fda861c
Author: Jens Carl <j.carl43 at gmx.de>
Date: Fri Oct 20 03:27:37 2017 +0000
tdf#45904: Move Java _XSheetLinkable tests to C++
Change-Id: I0f99c3b4a74748d7f1c73ef584170ae84b08cd9a
Reviewed-on: https://gerrit.libreoffice.org/43582
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/include/test/sheet/xsheetlinkable.hxx b/include/test/sheet/xsheetlinkable.hxx
new file mode 100644
index 000000000000..2abd87335799
--- /dev/null
+++ b/include/test/sheet/xsheetlinkable.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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_XSHEETLINKABLE_HXX
+#define INCLUDED_TEST_SHEET_XSHEETLINKABLE_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 XSheetLinkable
+{
+public:
+ virtual css::uno::Reference< css::uno::XInterface > init() =0;
+ virtual OUString getFileURL() =0;
+
+ void testSheetLinkable();
+
+protected:
+ ~XSheetLinkable() {}
+
+private:
+ OUString maFileName;
+};
+
+}
+
+#endif // INCLUDED_TEST_SHEET_XSHEETLINKABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk
index a6ebf3502b72..42108bb54891 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -627,7 +627,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/ifc/sheet/_XSheetFilterable \
qadevOOo/tests/java/ifc/sheet/_XSheetFilterableEx \
qadevOOo/tests/java/ifc/sheet/_XSheetFilterDescriptor \
- qadevOOo/tests/java/ifc/sheet/_XSheetLinkable \
qadevOOo/tests/java/ifc/sheet/_XSpreadsheetView \
qadevOOo/tests/java/ifc/style/_CharacterProperties \
qadevOOo/tests/java/ifc/style/_CharacterPropertiesAsian \
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv
index 16ddec448d96..89344e1ff08a 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv
@@ -172,13 +172,6 @@
"ScTableSheetObj";"com::sun::star::beans::XTolerantMultiPropertySet#optional";"setPropertyValuesTolerant()"
"ScTableSheetObj";"com::sun::star::beans::XTolerantMultiPropertySet#optional";"getPropertyValuesTolerant()"
"ScTableSheetObj";"com::sun::star::beans::XTolerantMultiPropertySet#optional";"getDirectPropertyValuesTolerant()"
-"ScTableSheetObj";"com::sun::star::sheet::XSheetLinkable";"getLinkMode()"
-"ScTableSheetObj";"com::sun::star::sheet::XSheetLinkable";"setLinkMode()"
-"ScTableSheetObj";"com::sun::star::sheet::XSheetLinkable";"getLinkUrl()"
-"ScTableSheetObj";"com::sun::star::sheet::XSheetLinkable";"setLinkUrl()"
-"ScTableSheetObj";"com::sun::star::sheet::XSheetLinkable";"getLinkSheetName()"
-"ScTableSheetObj";"com::sun::star::sheet::XSheetLinkable";"setLinkSheetName()"
-"ScTableSheetObj";"com::sun::star::sheet::XSheetLinkable";"link()"
"ScTableSheetObj";"com::sun::star::container::XNamed";"getName()"
"ScTableSheetObj";"com::sun::star::container::XNamed";"setName()"
"ScTableSheetObj";"com::sun::star::sheet::XCellRangeMovement";"insertCells()"
diff --git a/qadevOOo/tests/java/ifc/sheet/_XSheetLinkable.java b/qadevOOo/tests/java/ifc/sheet/_XSheetLinkable.java
deleted file mode 100644
index 8494525b40d5..000000000000
--- a/qadevOOo/tests/java/ifc/sheet/_XSheetLinkable.java
+++ /dev/null
@@ -1,104 +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 com.sun.star.sheet.SheetLinkMode;
-import com.sun.star.sheet.XSheetLinkable;
-import lib.MultiMethodTest;
-import util.utils;
-
-/**
- *
- */
-public class _XSheetLinkable extends MultiMethodTest {
- public XSheetLinkable oObj = null;
- SheetLinkMode slm = null;
- String linkSheetName = null;
- String linkUrl = null;
- String linkUrl2 = null;
-
- @Override
- public void before() {
- // get a document for linking.
- linkUrl = (String)tEnv.getObjRelation("XSheetLinkable.LinkSheet");
- linkUrl = utils.getFullTestURL(linkUrl);
-
- // get a second sheet for changing the link url: if it's not set,
- // this part of the test is omitted.
- linkUrl2 = (String)tEnv.getObjRelation("XSheetLinkable.LinkSheet2");
- if (linkUrl2 != null)
- linkUrl = utils.getFullTestURL(linkUrl);
-
- // set a name for the sheet.
- linkSheetName = "Sheet1";
- }
-
- public void _getLinkMode() {
- requiredMethod("link()");
- slm = oObj.getLinkMode();
- tRes.tested("getLinkMode()", slm == SheetLinkMode.VALUE);
- }
-
- public void _getLinkSheetName() {
- requiredMethod("link()");
- String lSheetName = oObj.getLinkSheetName();
- tRes.tested("getLinkSheetName()", linkSheetName.equals(lSheetName));
- }
-
- public void _getLinkUrl() {
- requiredMethod("link()");
- String lUrl = oObj.getLinkUrl();
- System.out.println("URL: " + lUrl);
- tRes.tested("getLinkUrl()", lUrl.equals(linkUrl));
- }
-
- public void _link() {
- oObj.link(linkUrl, linkSheetName, "", "", SheetLinkMode.VALUE);
- tRes.tested("link()", true);
- }
-
- public void _setLinkMode() {
- requiredMethod("getLinkMode()");
- oObj.setLinkMode(SheetLinkMode.NONE);
- slm = oObj.getLinkMode();
- tRes.tested("setLinkMode()", slm == SheetLinkMode.NONE);
- }
-
- public void _setLinkSheetName() {
- requiredMethod("getLinkSheetName()");
- oObj.setLinkSheetName("Sheet2");
- linkSheetName = oObj.getLinkSheetName();
- tRes.tested("setLinkSheetName()", linkSheetName.equals("Sheet2"));
- }
-
- public void _setLinkUrl() {
- requiredMethod("getLinkUrl()");
- boolean result = false;
- if (linkUrl2 == null) {
- // set back to the original value
- oObj.setLinkUrl(linkUrl);
- result = true;
- }
- else {
- oObj.setLinkUrl(linkUrl2);
- linkUrl = oObj.getLinkUrl();
- result = linkUrl.equals(linkUrl2);
- }
- tRes.tested("setLinkUrl()", result);
- }
-}
diff --git a/sc/qa/extras/sctablesheetobj.cxx b/sc/qa/extras/sctablesheetobj.cxx
index a3b246055965..277cd54cbddf 100644
--- a/sc/qa/extras/sctablesheetobj.cxx
+++ b/sc/qa/extras/sctablesheetobj.cxx
@@ -10,6 +10,7 @@
#include <test/calc_unoapi_test.hxx>
#include <test/sheet/xcellseries.hxx>
#include <test/sheet/xprintareas.hxx>
+#include <test/sheet/xsheetlinkable.hxx>
#include <test/sheet/xsheetoperation.hxx>
#include <test/sheet/xsheetpagebreak.hxx>
#include <test/sheet/xspreadsheet.hxx>
@@ -27,12 +28,13 @@ using namespace css::uno;
namespace sc_apitest
{
-#define NUMBER_OF_TESTS 19
+#define NUMBER_OF_TESTS 20
class ScTableSheetObj : public CalcUnoApiTest, public apitest::XCellSeries,
public apitest::XPrintAreas,
public apitest::XReplaceable,
public apitest::XSearchable,
+ public apitest::XSheetLinkable,
public apitest::XSheetOperation,
public apitest::XSheetPageBreak,
public apitest::XSpreadsheet,
@@ -45,27 +47,32 @@ public:
virtual void setUp() override;
virtual void tearDown() override;
+ virtual OUString getFileURL() override;
+
virtual uno::Reference< uno::XInterface > init() override;
virtual uno::Reference< uno::XInterface > getXSpreadsheet() override;
CPPUNIT_TEST_SUITE(ScTableSheetObj);
- // XSearchable
- CPPUNIT_TEST(testFindAll);
- CPPUNIT_TEST(testFindNext);
- CPPUNIT_TEST(testFindFirst);
+ // XCellSeries
+ CPPUNIT_TEST(testFillAuto);
+ CPPUNIT_TEST(testFillSeries);
+
+ // XPrintAreas
+ CPPUNIT_TEST(testSetAndGetPrintTitleColumns);
+ CPPUNIT_TEST(testSetAndGetPrintTitleRows);
// XReplaceable
CPPUNIT_TEST(testReplaceAll);
CPPUNIT_TEST(testCreateReplaceDescriptor);
- // XPrintAreas
- CPPUNIT_TEST(testSetAndGetPrintTitleColumns);
- CPPUNIT_TEST(testSetAndGetPrintTitleRows);
+ // XSearchable
+ CPPUNIT_TEST(testFindAll);
+ CPPUNIT_TEST(testFindNext);
+ CPPUNIT_TEST(testFindFirst);
- // XCellSeries
- CPPUNIT_TEST(testFillAuto);
- CPPUNIT_TEST(testFillSeries);
+ // XSheetLinkable
+ CPPUNIT_TEST(testSheetLinkable);
// XSheetOperation
CPPUNIT_TEST(testComputeFunction);
@@ -76,9 +83,6 @@ public:
CPPUNIT_TEST(testGetRowPageBreaks);
CPPUNIT_TEST(testRemoveAllManualPageBreaks);
- // XUniqueCellFormatRangesSupplier
- CPPUNIT_TEST(testGetUniqueCellFormatRanges);
-
// XSpreadsheet
CPPUNIT_TEST(testCreateCursor);
CPPUNIT_TEST(testCreateCursorByRange);
@@ -87,9 +91,13 @@ public:
CPPUNIT_TEST(testCreateSubTotalDescriptor);
CPPUNIT_TEST(testApplyRemoveSubTotals);
+ // XUniqueCellFormatRangesSupplier
+ CPPUNIT_TEST(testGetUniqueCellFormatRanges);
+
CPPUNIT_TEST_SUITE_END();
private:
+ OUString maFileURL;
static sal_Int32 nTest;
static uno::Reference< lang::XComponent > mxComponent;
};
@@ -107,10 +115,10 @@ ScTableSheetObj::ScTableSheetObj():
uno::Reference< uno::XInterface > ScTableSheetObj::init()
{
- OUString aFileURL;
- createFileURL("ScTableSheetObj.ods", aFileURL);
+ //OUString aFileURL;
+ createFileURL("ScTableSheetObj.ods", maFileURL);
if(!mxComponent.is())
- mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument");
+ mxComponent = loadFromDesktop(maFileURL, "com.sun.star.sheet.SpreadsheetDocument");
CPPUNIT_ASSERT(mxComponent.is());
uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
@@ -135,6 +143,11 @@ uno::Reference< uno::XInterface > ScTableSheetObj::getXSpreadsheet()
return xSheet;
}
+OUString ScTableSheetObj::getFileURL()
+{
+ return maFileURL;
+}
+
void ScTableSheetObj::setUp()
{
nTest++;
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 98f4ce9d566d..79463d688958 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -71,6 +71,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/xsheetannotations \
test/source/sheet/xsheetannotationshapesupplier \
test/source/sheet/xsheetoutline \
+ test/source/sheet/xsheetlinkable \
test/source/sheet/xsheetoperation \
test/source/sheet/xsheetpagebreak \
test/source/sheet/xstyleloader \
diff --git a/test/source/sheet/xsheetlinkable.cxx b/test/source/sheet/xsheetlinkable.cxx
new file mode 100644
index 000000000000..6608d439514a
--- /dev/null
+++ b/test/source/sheet/xsheetlinkable.cxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/xsheetlinkable.hxx>
+
+#include <com/sun/star/sheet/SheetLinkMode.hpp>
+#include <com/sun/star/sheet/XSheetLinkable.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace css;
+using namespace css::uno;
+
+namespace apitest {
+
+void XSheetLinkable::testSheetLinkable()
+{
+ uno::Reference< sheet::XSheetLinkable > xSheetLinkable(init(), UNO_QUERY_THROW);
+
+ xSheetLinkable->link(getFileURL(), "Sheet1", "", "", sheet::SheetLinkMode_VALUE);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get link mode",
+ sheet::SheetLinkMode_VALUE, xSheetLinkable->getLinkMode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get link URL",
+ getFileURL(), xSheetLinkable->getLinkUrl());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get sheet name",
+ OUString("Sheet1"), xSheetLinkable->getLinkSheetName());
+
+ xSheetLinkable->setLinkMode(sheet::SheetLinkMode_NONE);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set link mode",
+ sheet::SheetLinkMode_NONE, xSheetLinkable->getLinkMode());
+
+ xSheetLinkable->setLinkSheetName("Sheet2");
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set sheet name",
+ OUString("Sheet2"), xSheetLinkable->getLinkSheetName());
+
+ xSheetLinkable->setLinkUrl(getFileURL());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set link URL",
+ getFileURL(), xSheetLinkable->getLinkUrl());
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list