summaryrefslogtreecommitdiffstats
path: root/sc/qa/unit/parallelism.cxx
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 05:03:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 05:03:24 +0000
commite3cf16e6fbf8d39cad8762f002b6db1d4f61ed36 (patch)
tree3c1753125149dcf36ba42a57f1574369e8524225 /sc/qa/unit/parallelism.cxx
parentAdding debian version 4:24.2.2-3. (diff)
downloadlibreoffice-e3cf16e6fbf8d39cad8762f002b6db1d4f61ed36.tar.xz
libreoffice-e3cf16e6fbf8d39cad8762f002b6db1d4f61ed36.zip
Merging upstream version 4:24.2.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sc/qa/unit/parallelism.cxx')
-rw-r--r--sc/qa/unit/parallelism.cxx88
1 files changed, 88 insertions, 0 deletions
diff --git a/sc/qa/unit/parallelism.cxx b/sc/qa/unit/parallelism.cxx
new file mode 100644
index 0000000000..0ced71c442
--- /dev/null
+++ b/sc/qa/unit/parallelism.cxx
@@ -0,0 +1,88 @@
+/* -*- 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 <sal/config.h>
+
+#include "helper/qahelper.hxx"
+
+#include <document.hxx>
+#include <formulagroup.hxx>
+
+#include <officecfg/Office/Calc.hxx>
+
+using namespace sc;
+
+// test-suite suitable for loading documents to test parallelism in
+// with access only to exported symbols
+
+class ScParallelismTest : public ScModelTestBase
+{
+public:
+ ScParallelismTest()
+ : ScModelTestBase("sc/qa/unit/data")
+ {
+ }
+
+ virtual void setUp() override;
+ virtual void tearDown() override;
+
+private:
+ bool getThreadingFlag() const;
+ void setThreadingFlag(bool bSet);
+
+ bool m_bThreadingFlagCfg;
+};
+
+bool ScParallelismTest::getThreadingFlag() const
+{
+ return officecfg::Office::Calc::Formula::Calculation::UseThreadedCalculationForFormulaGroups::
+ get();
+}
+
+void ScParallelismTest::setThreadingFlag(bool bSet)
+{
+ std::shared_ptr<comphelper::ConfigurationChanges> xBatch(
+ comphelper::ConfigurationChanges::create());
+ officecfg::Office::Calc::Formula::Calculation::UseThreadedCalculationForFormulaGroups::set(
+ bSet, xBatch);
+ xBatch->commit();
+}
+
+void ScParallelismTest::setUp()
+{
+ ScModelTestBase::setUp();
+
+ sc::FormulaGroupInterpreter::disableOpenCL_UnitTestsOnly();
+
+ m_bThreadingFlagCfg = getThreadingFlag();
+ if (!m_bThreadingFlagCfg)
+ setThreadingFlag(true);
+}
+
+void ScParallelismTest::tearDown()
+{
+ // Restore threading flag
+ if (!m_bThreadingFlagCfg)
+ setThreadingFlag(false);
+
+ ScModelTestBase::tearDown();
+}
+
+// Dependency range in this document was detected as I9:I9 instead of expected I9:I367
+CPPUNIT_TEST_FIXTURE(ScParallelismTest, testTdf160368)
+{
+ createScDoc("ods/tdf160368.ods");
+ ScDocShell* pDocSh = getScDocShell();
+ // without fix: ScFormulaCell::MaybeInterpret(): Assertion `!rDocument.IsThreadedGroupCalcInProgress()' failed.
+ pDocSh->DoHardRecalc();
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */