summaryrefslogtreecommitdiff
path: root/sc/qa/unit/opencl-test-1.cxx
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-05-09 16:18:33 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2023-05-09 19:28:13 +0200
commit14c12d7a0672148522f0773146f41bb0648f6caa (patch)
tree4261d03ff65c75ae7fbd15b58ddda7a1aac28653 /sc/qa/unit/opencl-test-1.cxx
parentefdbe4179d151899c8a9a9de8f5bc1660700b27d (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-1.cxx')
-rw-r--r--sc/qa/unit/opencl-test-1.cxx66
1 files changed, 0 insertions, 66 deletions
diff --git a/sc/qa/unit/opencl-test-1.cxx b/sc/qa/unit/opencl-test-1.cxx
index 773c576b40db..3352ab3e4ad6 100644
--- a/sc/qa/unit/opencl-test-1.cxx
+++ b/sc/qa/unit/opencl-test-1.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 ScOpenCLTest1
public:
ScOpenCLTest1();
- /**
- * Turn on OpenCL group interpreter. Call this after the document is
- * loaded and before performing formula calculation.
- */
- void enableOpenCL();
- void disableOpenCL();
-
void testSystematic();
void testSharedFormulaXLS();
#if 0
@@ -269,65 +260,8 @@ public:
CPPUNIT_TEST(testMathFormulaCoth);
CPPUNIT_TEST(testFinacialNPER1Formula);
CPPUNIT_TEST_SUITE_END();
-
-private:
- void initTestEnv(std::u16string_view fileName);
-
- ScDocument* getScDoc2();
};
-void ScOpenCLTest1::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* ScOpenCLTest1::getScDoc2()
-{
- ScModelObj* pModelObj = comphelper::getFromUnoTunnel<ScModelObj>(mxComponent2);
- CPPUNIT_ASSERT(pModelObj);
- return pModelObj->GetDocument();
-}
-
-void ScOpenCLTest1::enableOpenCL()
-{
- sc::FormulaGroupInterpreter::enableOpenCL_UnitTestsOnly();
-}
-
-void ScOpenCLTest1::disableOpenCL()
-{
- sc::FormulaGroupInterpreter::disableOpenCL_UnitTestsOnly();
-}
-
void ScOpenCLTest1::testCompilerHorizontal()
{
initTestEnv(u"ods/opencl/compiler/horizontal.ods");