1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <sal/config.h>
12 #include "helper/qahelper.hxx"
14 #include <document.hxx>
15 #include <formulagroup.hxx>
17 #include <officecfg/Office/Calc.hxx>
21 // test-suite suitable for loading documents to test parallelism in
22 // with access only to exported symbols
24 class ScParallelismTest
: public ScModelTestBase
28 : ScModelTestBase("sc/qa/unit/data")
32 virtual void setUp() override
;
33 virtual void tearDown() override
;
36 bool getThreadingFlag() const;
37 void setThreadingFlag(bool bSet
);
39 bool m_bThreadingFlagCfg
;
42 bool ScParallelismTest::getThreadingFlag() const
44 return officecfg::Office::Calc::Formula::Calculation::UseThreadedCalculationForFormulaGroups::
48 void ScParallelismTest::setThreadingFlag(bool bSet
)
50 std::shared_ptr
<comphelper::ConfigurationChanges
> xBatch(
51 comphelper::ConfigurationChanges::create());
52 officecfg::Office::Calc::Formula::Calculation::UseThreadedCalculationForFormulaGroups::set(
57 void ScParallelismTest::setUp()
59 ScModelTestBase::setUp();
61 sc::FormulaGroupInterpreter::disableOpenCL_UnitTestsOnly();
63 m_bThreadingFlagCfg
= getThreadingFlag();
64 if (!m_bThreadingFlagCfg
)
65 setThreadingFlag(true);
68 void ScParallelismTest::tearDown()
70 // Restore threading flag
71 if (!m_bThreadingFlagCfg
)
72 setThreadingFlag(false);
74 ScModelTestBase::tearDown();
77 // Dependency range in this document was detected as I9:I9 instead of expected I9:I367
78 CPPUNIT_TEST_FIXTURE(ScParallelismTest
, testTdf160368
)
80 createScDoc("ods/tdf160368.ods");
81 ScDocShell
* pDocSh
= getScDocShell();
82 // without fix: ScFormulaCell::MaybeInterpret(): Assertion `!rDocument.IsThreadedGroupCalcInProgress()' failed.
83 pDocSh
->DoHardRecalc();
86 CPPUNIT_PLUGIN_IMPLEMENT();
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */