[Libreoffice-commits] core.git: sc/CppunitTest_sc_range_test.mk sc/Module_sc.mk sc/qa
Markus Mohrhard
markus.mohrhard at googlemail.com
Wed Nov 23 16:28:52 UTC 2016
sc/CppunitTest_sc_range_test.mk | 120 ++++++++++++++++++++++++++++++++++++++++
sc/Module_sc.mk | 1
sc/qa/unit/range.cxx | 110 ++++++++++++++++++++++++++++++++++++
3 files changed, 231 insertions(+)
New commits:
commit 4be1a9f9797fece0de236d26d10246853b4df850
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Nov 23 15:49:56 2016 +0100
add initial test case for ScAddress/ScRange tests
Change-Id: Idefa5a9fd9e6e2342bb0ccb9d88c5ca3094991c5
Reviewed-on: https://gerrit.libreoffice.org/31122
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/CppunitTest_sc_range_test.mk b/sc/CppunitTest_sc_range_test.mk
new file mode 100644
index 0000000..0fdbd3c
--- /dev/null
+++ b/sc/CppunitTest_sc_range_test.mk
@@ -0,0 +1,120 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,sc_range_test))
+
+$(eval $(call gb_CppunitTest_use_externals,sc_range_test, \
+ boost_headers \
+ icu_headers \
+ icui18n \
+ icuuc \
+ libxml2 \
+ mdds_headers \
+))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_range_test, \
+ sc/qa/unit/range \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sc_range_test, \
+ basegfx \
+ comphelper \
+ cppu \
+ cppuhelper \
+ drawinglayer \
+ editeng \
+ for \
+ forui \
+ i18nlangtag \
+ msfilter \
+ oox \
+ sal \
+ salhelper \
+ sax \
+ sb \
+ sc \
+ scqahelper \
+ sfx \
+ sot \
+ svl \
+ svt \
+ svx \
+ svxcore \
+ test \
+ tk \
+ tl \
+ ucbhelper \
+ unotest \
+ utl \
+ vbahelper \
+ vcl \
+ xo \
+ $(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_range_test,\
+ -I$(SRCDIR)/sc/source/ui/inc \
+ -I$(SRCDIR)/sc/inc \
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,sc_range_test,\
+ offapi \
+ oovbaapi \
+ udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,sc_range_test))
+$(eval $(call gb_CppunitTest_use_vcl,sc_range_test))
+
+$(eval $(call gb_CppunitTest_use_components,sc_range_test,\
+ basic/util/sb \
+ chart2/source/chartcore \
+ chart2/source/controller/chartcontroller \
+ comphelper/util/comphelp \
+ configmgr/source/configmgr \
+ dbaccess/util/dba \
+ embeddedobj/util/embobj \
+ eventattacher/source/evtatt \
+ 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 \
+ scaddins/source/analysis/analysis \
+ scaddins/source/datefunc/date \
+ scripting/source/basprov/basprov \
+ scripting/util/scriptframe \
+ sc/util/sc \
+ sc/util/scd \
+ sc/util/scfilt \
+ $(call gb_Helper_optional,SCRIPTING, \
+ sc/util/vbaobj) \
+ sfx2/util/sfx \
+ sot/util/sot \
+ svl/source/fsstor/fsstorage \
+ svl/util/svl \
+ svx/util/svx \
+ svx/util/svxcore \
+ 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_range_test))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 5493c09..ce7e4c1 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -47,6 +47,7 @@ $(eval $(call gb_Module_add_check_targets,sc,\
CppunitTest_sc_bugfix_test \
CppunitTest_sc_filters_test \
CppunitTest_sc_rangelst_test \
+ CppunitTest_sc_range_test \
CppunitTest_sc_mark_test \
CppunitTest_sc_core \
))
diff --git a/sc/qa/unit/range.cxx b/sc/qa/unit/range.cxx
new file mode 100644
index 0000000..c1e4214
--- /dev/null
+++ b/sc/qa/unit/range.cxx
@@ -0,0 +1,110 @@
+/* -*- 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 "helper/qahelper.hxx"
+#include "document.hxx"
+#include "docsh.hxx"
+
+#include "address.hxx"
+
+class ScAddressTest : public test::BootstrapFixture
+{
+public:
+
+ virtual void setUp() override;
+ virtual void tearDown() override;
+
+ CPPUNIT_TEST_SUITE(ScAddressTest);
+ CPPUNIT_TEST(testAddressParsing);
+ CPPUNIT_TEST_SUITE_END();
+
+ void testAddressParsing();
+
+private:
+ ScDocument *m_pDoc;
+ ScDocShellRef m_xDocShRef;
+};
+
+void ScAddressTest::testAddressParsing()
+{
+ ScAddress aAddr;
+ ScRefFlags nRes = aAddr.Parse("1", m_pDoc, formula::FormulaGrammar::CONV_OOO);
+ CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", !(nRes & ScRefFlags::VALID));
+}
+
+void ScAddressTest::setUp()
+{
+ BootstrapFixture::setUp();
+
+ ScDLL::Init();
+ m_xDocShRef = new ScDocShell(
+ SfxModelFlags::EMBEDDED_OBJECT |
+ SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS |
+ SfxModelFlags::DISABLE_DOCUMENT_RECOVERY);
+
+ m_pDoc = &m_xDocShRef->GetDocument();
+}
+
+void ScAddressTest::tearDown()
+{
+ m_xDocShRef.Clear();
+ BootstrapFixture::tearDown();
+}
+
+class ScRangeTest : public test::BootstrapFixture
+{
+public:
+ virtual void setUp() override;
+ virtual void tearDown() override;
+
+ CPPUNIT_TEST_SUITE(ScRangeTest);
+ CPPUNIT_TEST(testRangeParsing);
+ CPPUNIT_TEST_SUITE_END();
+
+ void testRangeParsing();
+
+private:
+ ScDocument *m_pDoc;
+ ScDocShellRef m_xDocShRef;
+};
+
+void ScRangeTest::testRangeParsing()
+{
+ ScRange aRange;
+ ScRefFlags nRes = aRange.Parse(":1", m_pDoc, formula::FormulaGrammar::CONV_OOO);
+ CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", !(nRes & ScRefFlags::VALID));
+}
+
+void ScRangeTest::setUp()
+{
+ BootstrapFixture::setUp();
+
+ ScDLL::Init();
+ m_xDocShRef = new ScDocShell(
+ SfxModelFlags::EMBEDDED_OBJECT |
+ SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS |
+ SfxModelFlags::DISABLE_DOCUMENT_RECOVERY);
+
+ m_pDoc = &m_xDocShRef->GetDocument();
+}
+
+void ScRangeTest::tearDown()
+{
+ m_xDocShRef.Clear();
+ BootstrapFixture::tearDown();
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScAddressTest);
+CPPUNIT_TEST_SUITE_REGISTRATION(ScRangeTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list