diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-05-09 16:18:33 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-05-09 19:28:13 +0200 |
commit | 14c12d7a0672148522f0773146f41bb0648f6caa (patch) | |
tree | 4261d03ff65c75ae7fbd15b58ddda7a1aac28653 /sc/qa/unit/opencl-test-2.cxx | |
parent | efdbe4179d151899c8a9a9de8f5bc1660700b27d (diff) |
CppunitTest_sc_opencl: factor out common code
Change-Id: I5da3d3a0e0f9f18033d8695081501a52aea5bd60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151586
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc/qa/unit/opencl-test-2.cxx')
-rw-r--r-- | sc/qa/unit/opencl-test-2.cxx | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/sc/qa/unit/opencl-test-2.cxx b/sc/qa/unit/opencl-test-2.cxx index a99808da19c4..a53613560e71 100644 --- a/sc/qa/unit/opencl-test-2.cxx +++ b/sc/qa/unit/opencl-test-2.cxx @@ -8,9 +8,7 @@ #include <docsh.hxx> #include <document.hxx> -#include <formulagroup.hxx> -#include <com/sun/star/document/MacroExecMode.hpp> #include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> @@ -23,13 +21,6 @@ class ScOpenCLTest2 public: ScOpenCLTest2(); - /** - * Turn on OpenCL group interpreter. Call this after the document is - * loaded and before performing formula calculation. - */ - void enableOpenCL(); - void disableOpenCL(); - void testStatisticalFormulaFDist(); void testStatisticalFormulaVar(); void testStatisticalFormulaChiDist(); @@ -257,65 +248,8 @@ public: CPPUNIT_TEST(testStatisticalFormulaStDevPA1); CPPUNIT_TEST(testFinancialMDurationFormula1); CPPUNIT_TEST_SUITE_END(); - -private: - void initTestEnv(std::u16string_view fileName); - - ScDocument* getScDoc2(); }; -void ScOpenCLTest2::initTestEnv(std::u16string_view fileName) -{ - // Some documents contain macros, disable them, otherwise - // the "Error, BASIC runtime error." dialog is prompted - // and it crashes in tearDown - std::vector<beans::PropertyValue> args; - beans::PropertyValue aMacroValue; - aMacroValue.Name = "MacroExecutionMode"; - aMacroValue.Handle = -1; - aMacroValue.Value <<= document::MacroExecMode::NEVER_EXECUTE; - aMacroValue.State = beans::PropertyState_DIRECT_VALUE; - args.push_back(aMacroValue); - - disableOpenCL(); - CPPUNIT_ASSERT(!ScCalcConfig::isOpenCLEnabled()); - - // Open the document with OpenCL disabled - mxComponent = mxDesktop->loadComponentFromURL( - createFileURL(fileName), "_default", 0, comphelper::containerToSequence(args)); - - enableOpenCL(); - CPPUNIT_ASSERT(ScCalcConfig::isOpenCLEnabled()); - - // it's not possible to open the same document twice, thus, create a temp file - createTempCopy(fileName); - - // Open the document with OpenCL enabled - mxComponent2 = mxDesktop->loadComponentFromURL( - maTempFile.GetURL(), "_default", 0, comphelper::containerToSequence(args)); - - // Check there are 2 documents - uno::Reference<frame::XFrames> xFrames = mxDesktop->getFrames(); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), xFrames->getCount()); -} - -ScDocument* ScOpenCLTest2::getScDoc2() -{ - ScModelObj* pModelObj = comphelper::getFromUnoTunnel<ScModelObj>(mxComponent2); - CPPUNIT_ASSERT(pModelObj); - return pModelObj->GetDocument(); -} - -void ScOpenCLTest2::enableOpenCL() -{ - sc::FormulaGroupInterpreter::enableOpenCL_UnitTestsOnly(); -} - -void ScOpenCLTest2::disableOpenCL() -{ - sc::FormulaGroupInterpreter::disableOpenCL_UnitTestsOnly(); -} - void ScOpenCLTest2::testMathFormulaPi() { initTestEnv(u"xls/opencl/math/pi.xls"); |