summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-09-17 02:11:02 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-09-17 02:14:13 +0200
commit21edfcb82484be3e30e8e7f27f4cf68ec1cb8c4b (patch)
tree6c3146fde7dd9ede56eb1fe6d509ee4479ce57f6 /sc/qa
parent4cf0759e7c6bd698c929a11c771d2ab03f1b9536 (diff)
test case for ScRangeList
Change-Id: I371ac1b3236777a73e4f25f93d465041308e34b4
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/rangelst_test.cxx76
1 files changed, 76 insertions, 0 deletions
diff --git a/sc/qa/unit/rangelst_test.cxx b/sc/qa/unit/rangelst_test.cxx
new file mode 100644
index 000000000000..a65a0eb27010
--- /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: */