diff options
-rw-r--r-- | include/test/sheet/xspreadsheetview.hxx | 33 | ||||
-rw-r--r-- | qadevOOo/Jar_OOoRunner.mk | 1 | ||||
-rw-r--r-- | qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTabViewObj.csv | 2 | ||||
-rw-r--r-- | qadevOOo/tests/java/ifc/sheet/_XSpreadsheetView.java | 83 | ||||
-rw-r--r-- | sc/qa/extras/sctabviewobj.cxx | 14 | ||||
-rw-r--r-- | test/Library_subsequenttest.mk | 1 | ||||
-rw-r--r-- | test/source/sheet/xspreadsheetview.cxx | 41 |
7 files changed, 87 insertions, 88 deletions
diff --git a/include/test/sheet/xspreadsheetview.hxx b/include/test/sheet/xspreadsheetview.hxx new file mode 100644 index 000000000000..144b54ac128b --- /dev/null +++ b/include/test/sheet/xspreadsheetview.hxx @@ -0,0 +1,33 @@ +/* -*- 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_XSPREADSHEETVIEW_HXX +#define INCLUDED_TEST_SHEET_XSPREADSHEETVIEW_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 XSpreadsheetView +{ +public: + virtual css::uno::Reference<css::uno::XInterface> init() = 0; + + void testGetSetActiveSheet(); + +protected: + ~XSpreadsheetView() {} +}; +} + +#endif // INCLUDED_TEST_SHEET_XSPREADSHEETVIEW_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 229bef198f03..9faab8d10327 100644 --- a/qadevOOo/Jar_OOoRunner.mk +++ b/qadevOOo/Jar_OOoRunner.mk @@ -613,7 +613,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\ qadevOOo/tests/java/ifc/sheet/_XSheetAnnotationAnchor \ qadevOOo/tests/java/ifc/sheet/_XSheetAuditing \ qadevOOo/tests/java/ifc/sheet/_XSheetCellCursor \ - qadevOOo/tests/java/ifc/sheet/_XSpreadsheetView \ 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 6a366ee450cc..bd00af8e020d 100644 --- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTabViewObj.csv +++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTabViewObj.csv @@ -61,8 +61,6 @@ "ScTabViewObj";"com::sun::star::view::XFormLayerAccess#optional";"isFormDesignMode()" "ScTabViewObj";"com::sun::star::view::XFormLayerAccess#optional";"setFormDesignMode()" "ScTabViewObj";"com::sun::star::container::XEnumerationAccess";"createEnumeration()" -"ScTabViewObj";"com::sun::star::sheet::XSpreadsheetView";"getActiveSheet()" -"ScTabViewObj";"com::sun::star::sheet::XSpreadsheetView";"setActiveSheet()" "ScTabViewObj";"com::sun::star::frame::XController";"attachFrame()" "ScTabViewObj";"com::sun::star::frame::XController";"attachModel()" "ScTabViewObj";"com::sun::star::frame::XController";"suspend()" diff --git a/qadevOOo/tests/java/ifc/sheet/_XSpreadsheetView.java b/qadevOOo/tests/java/ifc/sheet/_XSpreadsheetView.java deleted file mode 100644 index 947d55a0de63..000000000000 --- a/qadevOOo/tests/java/ifc/sheet/_XSpreadsheetView.java +++ /dev/null @@ -1,83 +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 lib.Status; -import lib.StatusException; - -import com.sun.star.sheet.XSpreadsheet; -import com.sun.star.sheet.XSpreadsheetView; - -/** -* Testing <code>com.sun.star.sheet.XSpreadsheetView</code> -* interface methods : -* <ul> -* <li><code> getActiveSheet()</code></li> -* <li><code> setActiveSheet()</code></li> -* </ul> <p> -* This test needs the following object relations : -* <ul> -* <li> <code>'Sheet'</code> (of type <code>XSpreadsheet</code>): -* to set new active spreadsheet </li> -* <ul> <p> -* @see com.sun.star.sheet.XSpreadsheetView -*/ -public class _XSpreadsheetView extends MultiMethodTest { - - public XSpreadsheetView oObj = null; - public XSpreadsheet oSheet = null; - - /** - * Test calls the method, stores and checks returned value. <p> - * Has <b> OK </b> status if returned value isn't null. <p> - */ - public void _getActiveSheet() { - oSheet = oObj.getActiveSheet(); - tRes.tested("getActiveSheet()", oSheet != null); - } - - /** - * Test sets new active sheet that was obtained by relation - * <code>'Sheet'</code>, gets the current active sheet and compares - * returned value with value that was stored by method - * <code>getFilterFields()</code>. <p> - * Has <b> OK </b> status if values aren't equal. <p> - * The following method tests are to be completed successfully before : - * <ul> - * <li> <code> getActiveSheet() </code> : to have the current - * active sheet </li> - * </ul> - */ - public void _setActiveSheet() { - requiredMethod("getActiveSheet()"); - - XSpreadsheet new_Sheet = (XSpreadsheet)tEnv.getObjRelation("Sheet"); - if (new_Sheet == null) throw new StatusException(Status.failed - ("Relation 'Sheet' not found")); - - oObj.setActiveSheet(new_Sheet); - new_Sheet = oObj.getActiveSheet(); - tRes.tested("setActiveSheet()", !oSheet.equals(new_Sheet)); - } - - -} // finish class _XSpreadsheetView - - diff --git a/sc/qa/extras/sctabviewobj.cxx b/sc/qa/extras/sctabviewobj.cxx index a3614e63a4e4..fbcf21bd8f67 100644 --- a/sc/qa/extras/sctabviewobj.cxx +++ b/sc/qa/extras/sctabviewobj.cxx @@ -8,23 +8,29 @@ */ #include <test/calc_unoapi_test.hxx> +#include <test/sheet/xspreadsheetview.hxx> #include <test/sheet/xviewfreezable.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/XSpreadsheet.hpp> #include <com/sun/star/sheet/XViewSplitable.hpp> + #include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/uno/Reference.hxx> using namespace css; using namespace css::uno; namespace sc_apitest { -#define NUMBER_OF_TESTS 2 +#define NUMBER_OF_TESTS 3 -class ScTabViewObj : public CalcUnoApiTest, public apitest::XViewFreezable, public apitest::XViewSplitable +class ScTabViewObj : public CalcUnoApiTest, public apitest::XSpreadsheetView, + public apitest::XViewFreezable, + public apitest::XViewSplitable { public: ScTabViewObj(); @@ -35,6 +41,9 @@ public: CPPUNIT_TEST_SUITE(ScTabViewObj); + // XSpreadsheetView + CPPUNIT_TEST(testGetSetActiveSheet); + // XViewFreezable CPPUNIT_TEST(testFreeze); @@ -66,6 +75,7 @@ uno::Reference< uno::XInterface > ScTabViewObj::init() CPPUNIT_ASSERT_MESSAGE("no calc document", xSheetDoc.is()); uno::Reference< frame::XModel > xModel(xSheetDoc, uno::UNO_QUERY_THROW); + return xModel->getCurrentController(); } diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk index 531dfa35dc47..2b60f192df78 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/xspreadsheet \ test/source/sheet/xspreadsheets \ test/source/sheet/xspreadsheets2 \ + test/source/sheet/xspreadsheetview \ test/source/sheet/xsheetannotation \ test/source/sheet/xsheetannotations \ test/source/sheet/xsheetannotationssupplier \ diff --git a/test/source/sheet/xspreadsheetview.cxx b/test/source/sheet/xspreadsheetview.cxx new file mode 100644 index 000000000000..236d2870f709 --- /dev/null +++ b/test/source/sheet/xspreadsheetview.cxx @@ -0,0 +1,41 @@ +/* -*- 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/xspreadsheetview.hxx> + +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/sheet/XSpreadsheetView.hpp> +#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 XSpreadsheetView::testGetSetActiveSheet() +{ + uno::Reference<sheet::XSpreadsheetView> xView(init(), UNO_QUERY_THROW); + + uno::Reference<sheet::XSpreadsheet> xActiveSheet = xView->getActiveSheet(); + CPPUNIT_ASSERT_MESSAGE("Unable to get default active sheet", xActiveSheet.is()); + + uno::Reference<sheet::XSpreadsheet> xNewSheet = xActiveSheet; + CPPUNIT_ASSERT_MESSAGE("no sheet", xNewSheet.is()); + xView->setActiveSheet(xNewSheet); + + uno::Reference<sheet::XSpreadsheet> xNewActiveSheet = xView->getActiveSheet(); + CPPUNIT_ASSERT_MESSAGE("Unable to get new active sheet", xNewActiveSheet.is()); + CPPUNIT_ASSERT_MESSAGE("Default and new active sheet are not different", + xActiveSheet.get() != xNewActiveSheet.get()); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |