[Libreoffice-commits] .: 2 commits - sc/CppunitTest_sc_rangelst_test.mk sc/inc sc/Module_sc.mk sc/qa sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sun Sep 16 17:14:40 PDT 2012
sc/CppunitTest_sc_rangelst_test.mk | 133 +++++++++++++++++++++++++++++++++++++
sc/Module_sc.mk | 1
sc/inc/scdll.hxx | 4 -
sc/qa/unit/rangelst_test.cxx | 76 +++++++++++++++++++++
sc/source/core/tool/rangelst.cxx | 2
5 files changed, 214 insertions(+), 2 deletions(-)
New commits:
commit 21edfcb82484be3e30e8e7f27f4cf68ec1cb8c4b
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Sep 17 02:11:02 2012 +0200
test case for ScRangeList
Change-Id: I371ac1b3236777a73e4f25f93d465041308e34b4
diff --git a/sc/CppunitTest_sc_rangelst_test.mk b/sc/CppunitTest_sc_rangelst_test.mk
new file mode 100644
index 0000000..67762d9
--- /dev/null
+++ b/sc/CppunitTest_sc_rangelst_test.mk
@@ -0,0 +1,133 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+# 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) 2011 Red Hat, Inc., Caolán McNamara <caolanm at redhat.com>
+# (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.
+
+$(eval $(call gb_CppunitTest_CppunitTest,sc_rangelst_test))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_rangelst_test, \
+ sc/qa/unit/rangelst_test \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sc_rangelst_test, \
+ avmedia \
+ basegfx \
+ comphelper \
+ cppu \
+ cppuhelper \
+ drawinglayer \
+ editeng \
+ fileacc \
+ for \
+ forui \
+ i18nisolang1 \
+ msfilter \
+ oox \
+ sal \
+ salhelper \
+ sax \
+ sb \
+ sc \
+ sfx \
+ sot \
+ svl \
+ svt \
+ svx \
+ svxcore \
+ test \
+ tl \
+ tk \
+ ucbhelper \
+ unotest \
+ utl \
+ vbahelper \
+ vcl \
+ xo \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_rangelst_test,\
+ -I$(SRCDIR)/sc/source/ui/inc \
+ -I$(SRCDIR)/sc/inc \
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,sc_rangelst_test,\
+ offapi \
+ oovbaapi \
+ udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,sc_rangelst_test))
+
+$(eval $(call gb_CppunitTest_use_components,sc_rangelst_test,\
+ basic/util/sb \
+ chart2/source/controller/chartcontroller \
+ chart2/source/chartcore \
+ comphelper/util/comphelp \
+ configmgr/source/configmgr \
+ dbaccess/util/dba \
+ embeddedobj/util/embobj \
+ eventattacher/source/evtatt \
+ fileaccess/source/fileacc \
+ filter/source/config/cache/filterconfig1 \
+ forms/util/frm \
+ framework/util/fwk \
+ i18npool/util/i18npool \
+ oox/util/oox \
+ package/source/xstor/xstor \
+ package/util/package2 \
+ sax/source/expatwrap/expwrap \
+ sax/source/fastparser/fastsax \
+ sc/util/sc \
+ sc/util/scd \
+ sc/util/scfilt \
+ sc/util/vbaobj \
+ scaddins/source/analysis/analysis \
+ scaddins/source/datefunc/date \
+ scripting/source/basprov/basprov \
+ scripting/util/scriptframe \
+ sfx2/util/sfx \
+ sot/util/sot \
+ svl/source/fsstor/fsstorage \
+ svl/util/svl \
+ svx/util/svx \
+ 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 \
+ xmloff/util/xo \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sc_rangelst_test))
+
+$(eval $(call gb_CppunitTest_use_filter_configuration,sc_rangelst_test))
+
+$(eval $(call gb_CppunitTest_use_unittest_configuration,sc_rangelst_test))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index dc63ff7..c5c0449 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -44,6 +44,7 @@ endif
$(eval $(call gb_Module_add_check_targets,sc,\
CppunitTest_sc_ucalc \
CppunitTest_sc_filters_test \
+ CppunitTest_sc_rangelst_test \
))
$(eval $(call gb_Module_add_slowcheck_targets,sc,\
diff --git a/sc/inc/scdll.hxx b/sc/inc/scdll.hxx
index bd86e49..983f91d 100644
--- a/sc/inc/scdll.hxx
+++ b/sc/inc/scdll.hxx
@@ -36,6 +36,8 @@ class SfxFilter;
#include <sfx2/module.hxx>
#include <sfx2/docfac.hxx>
+#include "scdllapi.h"
+
/**
* This class is a wrapper for a Load-On-Demand-DLL. One instance per
* SfxApplication will be created for the runtime of
@@ -56,7 +58,7 @@ public:
static void PreExit(); // muss vor LibExit gerufen werden
// DLL-init/exit-code must be linked to the DLL only
- static void Init(); // called directly after loading the DLL
+ static SC_DLLPUBLIC void Init(); // called directly after loading the DLL
static sal_uLong DetectFilter( SfxMedium& rMedium, const SfxFilter** ppFilter,
SfxFilterFlags nMust, SfxFilterFlags nDont );
diff --git a/sc/qa/unit/rangelst_test.cxx b/sc/qa/unit/rangelst_test.cxx
new file mode 100644
index 0000000..a65a0eb
--- /dev/null
+++ b/sc/qa/unit/rangelst_test.cxx
@@ -0,0 +1,76 @@
+/* -*- 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 <sal/config.h>
+#include <test/bootstrapfixture.hxx>
+#include "document.hxx"
+#include "docsh.hxx"
+
+#include "rangelst.hxx"
+
+class Test : public test::BootstrapFixture {
+
+public:
+ virtual void setUp();
+ virtual void tearDown();
+
+ void testDeleteArea_4Ranges();
+
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(testDeleteArea_4Ranges);
+ CPPUNIT_TEST_SUITE_END();
+
+
+private:
+ ScDocument *m_pDoc;
+ ScDocShellRef m_xDocShRef;
+};
+
+
+void Test::setUp()
+{
+ BootstrapFixture::setUp();
+
+ ScDLL::Init();
+ m_xDocShRef = new ScDocShell(
+ SFXMODEL_STANDARD |
+ SFXMODEL_DISABLE_EMBEDDED_SCRIPTS |
+ SFXMODEL_DISABLE_DOCUMENT_RECOVERY);
+
+ m_pDoc = m_xDocShRef->GetDocument();
+}
+
+void Test::tearDown()
+{
+ m_xDocShRef.Clear();
+ BootstrapFixture::tearDown();
+}
+
+void Test::testDeleteArea_4Ranges()
+{
+ ScRangeList aList(ScRange(0,0,0,5,5,0));
+ aList.DeleteArea(2,2,0,3,3,0);
+
+ CPPUNIT_ASSERT_EQUAL(aList.size(), static_cast<size_t>(4));
+ for(SCCOL nCol = 0; nCol <= 5; ++nCol)
+ {
+ for(SCROW nRow = 0; nRow <= 5; ++nRow)
+ {
+ if((nCol == 2 || nCol == 3) && ( nRow == 2 || nRow == 3))
+ CPPUNIT_ASSERT(!aList.Intersects(ScRange(nCol, nRow, 0)));
+ else
+ CPPUNIT_ASSERT(aList.Intersects(ScRange(nCol, nRow, 0)));
+ }
+ }
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 4cf0759e7c6bd698c929a11c771d2ab03f1b9536
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Sep 17 02:09:20 2012 +0200
fix ScRangeList::DeleteArea for the 4 ranges case
Change-Id: I6321a722be6779d839459ed71b793a46e0968567
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index 7ad7212..de87e6c 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -689,7 +689,7 @@ bool handleFourRanges( const ScRange& rDelRange, ScRange* p, std::vector<ScRange
{
SCTAB nTab = rDelStart.Tab();
- ScRange aNewRange( ScAddress( rPStart.Col(), rDelEnd.Row(), nTab ), rDelEnd );
+ ScRange aNewRange( ScAddress( rPStart.Col(), rDelEnd.Row()+1, nTab ), rPEnd );
rNewRanges.push_back( aNewRange );
aNewRange = ScRange( rPStart.Col(), rDelStart.Row(), nTab, rDelStart.Col() -1, rDelEnd.Row(), nTab );
More information about the Libreoffice-commits
mailing list