From a5c891f59e7dfd81281b8bcc1b54c03f4e395203 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Thu, 23 Feb 2012 15:23:39 +0100 Subject: add test case for XSpreadsheetDocument --- test/Library_subsequenttest.mk | 1 + test/Package_inc.mk | 1 + test/inc/test/sheet/xspreadsheetdocument.hxx | 50 +++++++++++++++++++++++++++ test/source/sheet/xspreadsheetdocument.cxx | 51 ++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+) create mode 100644 test/inc/test/sheet/xspreadsheetdocument.hxx create mode 100644 test/source/sheet/xspreadsheetdocument.cxx (limited to 'test') diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk index cd540d6b379e..bb0214dcb96a 100644 --- a/test/Library_subsequenttest.mk +++ b/test/Library_subsequenttest.mk @@ -79,6 +79,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\ test/source/sheet/xdatapilottable2 \ test/source/sheet/xnamedrange \ test/source/sheet/xnamedranges \ + test/source/sheet/xspreadsheetdocument \ test/source/sheet/xspreadsheets2 \ test/source/util/xreplaceable \ test/source/util/xsearchable \ diff --git a/test/Package_inc.mk b/test/Package_inc.mk index 1dcc10e51cc9..62c3fa49bdf2 100644 --- a/test/Package_inc.mk +++ b/test/Package_inc.mk @@ -46,6 +46,7 @@ $(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xdatapilottable.hxx,te $(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xdatapilottable2.hxx,test/sheet/xdatapilottable2.hxx)) $(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xdatapilotfieldgrouping.hxx,test/sheet/xdatapilotfieldgrouping.hxx)) $(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/datapilotfield.hxx,test/sheet/datapilotfield.hxx)) +$(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xspreadsheetdocument.hxx,test/sheet/xspreadsheetdocument.hxx)) $(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xspreadsheets2.hxx,test/sheet/xspreadsheets2.hxx)) $(eval $(call gb_Package_add_file,test_inc,inc/test/util/xreplaceable.hxx,test/util/xreplaceable.hxx)) $(eval $(call gb_Package_add_file,test_inc,inc/test/util/xsearchable.hxx,test/util/xsearchable.hxx)) diff --git a/test/inc/test/sheet/xspreadsheetdocument.hxx b/test/inc/test/sheet/xspreadsheetdocument.hxx new file mode 100644 index 000000000000..e4e258a5f51f --- /dev/null +++ b/test/inc/test/sheet/xspreadsheetdocument.hxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * Copyright (C) 2012 Markus Mohrhard (initial developer) + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include +#include + +using namespace com::sun::star; + +namespace apitest { + +class XSpreadsheetDocument +{ +public: + XSpreadsheetDocument(sal_Int32 nSheets) : mnSheets(nSheets) {} + + virtual uno::Reference< uno::XInterface > init() = 0; + + void testGetSheets(); +private: + sal_Int32 mnSheets; +}; + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xspreadsheetdocument.cxx b/test/source/sheet/xspreadsheetdocument.cxx new file mode 100644 index 000000000000..a7720f621dbd --- /dev/null +++ b/test/source/sheet/xspreadsheetdocument.cxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * Copyright (C) 2012 Markus Mohrhard (initial developer) + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include +#include +#include +#include +#include "cppunit/extensions/HelperMacros.h" + +using namespace com::sun::star::uno; + +namespace apitest { + +void XSpreadsheetDocument::testGetSheets() +{ + uno::Reference< sheet::XSpreadsheetDocument > xSpreadsheetDoc(init(), UNO_QUERY_THROW); + uno::Reference< sheet::XSpreadsheets > xSheets = xSpreadsheetDoc->getSheets(); + CPPUNIT_ASSERT(xSheets.is()); + + uno::Reference< container::XIndexAccess > xIA(xSheets, UNO_QUERY_THROW); + CPPUNIT_ASSERT( xIA->getCount() == mnSheets ); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit