diff options
-rw-r--r-- | include/test/sheet/xscenario.hxx | 34 | ||||
-rw-r--r-- | qadevOOo/Jar_OOoRunner.mk | 1 | ||||
-rw-r--r-- | qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv | 5 | ||||
-rw-r--r-- | qadevOOo/tests/java/ifc/sheet/_XScenario.java | 91 | ||||
-rw-r--r-- | sc/qa/extras/sctablesheetobj.cxx | 11 | ||||
-rw-r--r-- | test/Library_subsequenttest.mk | 1 | ||||
-rw-r--r-- | test/source/sheet/xscenario.cxx | 43 |
7 files changed, 87 insertions, 99 deletions
diff --git a/include/test/sheet/xscenario.hxx b/include/test/sheet/xscenario.hxx new file mode 100644 index 000000000000..8892d26c1c1d --- /dev/null +++ b/include/test/sheet/xscenario.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_XSCENARIO_HXX +#define INCLUDED_TEST_SHEET_XSCENARIO_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 XScenario +{ +public: + virtual css::uno::Reference<css::uno::XInterface> getScenarioSpreadsheet() = 0; + + void testScenario(); + +protected: + ~XScenario() {} +}; +} // namespace apitest + +#endif // INCLUDED_TEST_SHEET_XSCENARIO_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 575e130efcd8..409785f35ef8 100644 --- a/qadevOOo/Jar_OOoRunner.mk +++ b/qadevOOo/Jar_OOoRunner.mk @@ -571,7 +571,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\ qadevOOo/tests/java/ifc/sheet/_XEnhancedMouseClickBroadcaster \ qadevOOo/tests/java/ifc/sheet/_XFormulaQuery \ qadevOOo/tests/java/ifc/sheet/_XRangeSelection \ - qadevOOo/tests/java/ifc/sheet/_XScenario \ qadevOOo/tests/java/ifc/sheet/_XSheetCellCursor \ 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 03e907459e78..78efd29dae01 100644 --- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv +++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv @@ -125,11 +125,6 @@ "ScTableSheetObj";"com::sun::star::sheet::XCellRangesQuery";"queryColumnDifferences()" "ScTableSheetObj";"com::sun::star::sheet::XCellRangesQuery";"queryRowDifferences()" "ScTableSheetObj";"com::sun::star::sheet::XCellRangesQuery";"queryIntersection()" -"ScTableSheetObj";"com::sun::star::sheet::XScenario";"getIsScenario()" -"ScTableSheetObj";"com::sun::star::sheet::XScenario";"getScenarioComment()" -"ScTableSheetObj";"com::sun::star::sheet::XScenario";"setScenarioComment()" -"ScTableSheetObj";"com::sun::star::sheet::XScenario";"addRanges()" -"ScTableSheetObj";"com::sun::star::sheet::XScenario";"apply()" "ScTableSheetObj";"com::sun::star::table::XCellRange";"getCellByPosition()" "ScTableSheetObj";"com::sun::star::table::XCellRange";"getCellRangeByPosition()" "ScTableSheetObj";"com::sun::star::table::XCellRange";"getCellRangeByName()" diff --git a/qadevOOo/tests/java/ifc/sheet/_XScenario.java b/qadevOOo/tests/java/ifc/sheet/_XScenario.java deleted file mode 100644 index 4d58f1e04eac..000000000000 --- a/qadevOOo/tests/java/ifc/sheet/_XScenario.java +++ /dev/null @@ -1,91 +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.XScenario; -import com.sun.star.table.CellRangeAddress; -import lib.MultiMethodTest; -import lib.Status; - -/** - * - */ -public class _XScenario extends MultiMethodTest { - public XScenario oObj = null; - String comment = null; - boolean skipTest = false; - - @Override - public void before() { - // testing a scenario containing the whole sheet does not make sense. - // test is skipped until this interface is implemented somewhere else - skipTest = true; - } - - public void _addRanges() { - if (skipTest) { - tRes.tested("addRanges()",Status.skipped(true)); - return; - } - oObj.addRanges(new CellRangeAddress[] {null}); - tRes.tested("addRanges()", true); - } - - public void _apply() { - requiredMethod("addRanges()"); - if (skipTest) { - tRes.tested("apply()",Status.skipped(true)); - return; - } - oObj.apply(); - tRes.tested("apply()", true); - } - - public void _getIsScenario() { - requiredMethod("apply()"); - if (skipTest) { - tRes.tested("getIsScenario()",Status.skipped(true)); - return; - } - boolean getIs = oObj.getIsScenario(); - tRes.tested("getIsScenario()", getIs); - } - - public void _getScenarioComment() { - if (skipTest) { - tRes.tested("getScenarioComment()",Status.skipped(true)); - return; - } - comment = oObj.getScenarioComment(); - tRes.tested("getScenarioComment()", true); - } - - public void _setScenarioComment() { - requiredMethod("getScenarioComment()"); - if (skipTest) { - tRes.tested("setScenarioComment()",Status.skipped(true)); - return; - } - boolean res = false; - oObj.setScenarioComment("MyComment"); - String c = oObj.getScenarioComment(); - res = c.equals("MyComment"); - oObj.setScenarioComment(comment); - tRes.tested("setScenarioComment()", res); - } -} diff --git a/sc/qa/extras/sctablesheetobj.cxx b/sc/qa/extras/sctablesheetobj.cxx index eed8cbd3440e..2194a710da55 100644 --- a/sc/qa/extras/sctablesheetobj.cxx +++ b/sc/qa/extras/sctablesheetobj.cxx @@ -20,6 +20,7 @@ #include <test/sheet/xdatapilottablessupplier.hxx> #include <test/sheet/xmultipleoperation.hxx> #include <test/sheet/xprintareas.hxx> +#include <test/sheet/xscenario.hxx> #include <test/sheet/xscenarioenhanced.hxx> #include <test/sheet/xscenariossupplier.hxx> #include <test/sheet/xsheetannotationssupplier.hxx> @@ -60,6 +61,7 @@ class ScTableSheetObj : public CalcUnoApiTest, public apitest::Scenario, public apitest::XMultipleOperation, public apitest::XPrintAreas, public apitest::XReplaceable, + public apitest::XScenario, public apitest::XScenarioEnhanced, public apitest::XScenariosSupplier, public apitest::XSearchable, @@ -146,6 +148,10 @@ public: CPPUNIT_TEST(testReplaceAll); CPPUNIT_TEST(testCreateReplaceDescriptor); + // XScenario + // test was disabled in qadevOOo/tests/java/ifc/sheet/_XScenario.java + CPPUNIT_TEST(testScenario); + // XScenarioEnhanced CPPUNIT_TEST(testGetRanges); @@ -218,8 +224,8 @@ uno::Reference< uno::XInterface > ScTableSheetObj::init() CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is()); uno::Reference<sheet::XSpreadsheets> xSheets(xDoc->getSheets(), UNO_QUERY_THROW); - uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW); - uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW); + uno::Reference<container::XIndexAccess> xIndex (xDoc->getSheets(), UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheet> xSheet(xIndex->getByIndex(0), UNO_QUERY_THROW); xSheet->getCellByPosition(5 ,5)->setValue(15); xSheet->getCellByPosition(2 ,0)->setValue(-5.15); @@ -232,6 +238,7 @@ uno::Reference< uno::XInterface > ScTableSheetObj::init() uno::Sequence<table::CellRangeAddress> aCellRangeAddr(1); aCellRangeAddr[0] = table::CellRangeAddress(0, 0, 0, 10, 10); + uno::Reference<sheet::XScenariosSupplier> xScence(xSheet, UNO_QUERY_THROW); xScence->getScenarios()->addNewByName("Scenario", aCellRangeAddr, "Comment"); xSheets->getByName("Scenario"); diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk index 222efe6dd289..e854b0d17551 100644 --- a/test/Library_subsequenttest.mk +++ b/test/Library_subsequenttest.mk @@ -107,6 +107,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\ test/source/sheet/xmultipleoperation \ test/source/sheet/xprintareas \ test/source/sheet/xrecentfunctions \ + test/source/sheet/xscenario \ test/source/sheet/xscenarioenhanced \ test/source/sheet/xscenarios \ test/source/sheet/xscenariossupplier \ diff --git a/test/source/sheet/xscenario.cxx b/test/source/sheet/xscenario.cxx new file mode 100644 index 000000000000..96dca2a21cf8 --- /dev/null +++ b/test/source/sheet/xscenario.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/xscenario.hxx> + +#include <com/sun/star/sheet/XScenario.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/extensions/HelperMacros.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XScenario::testScenario() +{ + uno::Reference<sheet::XScenario> xScenario(getScenarioSpreadsheet(), UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("Sheet is not a Scenario sheet", xScenario->getIsScenario()); + + uno::Sequence<table::CellRangeAddress> aCellRangeAddr(1); + xScenario->addRanges(aCellRangeAddr); + xScenario->apply(); + + CPPUNIT_ASSERT_MESSAGE("Unable add and apply ranges", xScenario->getIsScenario()); + CPPUNIT_ASSERT_MESSAGE("Unable execute getScenarioComment()", + !xScenario->getScenarioComment().isEmpty()); + + xScenario->setScenarioComment("Test"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable execute setScenarioComment()", OUString("Test"), + xScenario->getScenarioComment()); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |