[Libreoffice-commits] core.git: sc/qa
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Feb 13 16:07:20 UTC 2019
sc/qa/perf/scperfobj.cxx | 106 -----------------------------------------------
1 file changed, 1 insertion(+), 105 deletions(-)
New commits:
commit bbd722dcd808fdcec225c78f09c11a21248e4377
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
AuthorDate: Thu Feb 14 00:00:09 2019 +0800
Commit: Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Wed Feb 13 17:06:53 2019 +0100
remove unused methods from calc's perf tests
Change-Id: I5063ae048ee940f9fd88925882df7ba8dc0daf09
Reviewed-on: https://gerrit.libreoffice.org/67786
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/qa/perf/scperfobj.cxx b/sc/qa/perf/scperfobj.cxx
index 4c63d3d1c6aa..b7e1cb33617f 100644
--- a/sc/qa/perf/scperfobj.cxx
+++ b/sc/qa/perf/scperfobj.cxx
@@ -11,6 +11,7 @@
#include <rtl/ustring.hxx>
#include <cppunit/extensions/HelperMacros.h>
+#include <comphelper/processfactory.hxx>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XModel2.hpp>
@@ -128,111 +129,6 @@ void ScPerfObj::tearDown()
CalcUnoApiTest::tearDown();
}
-namespace {
-
-class SpreadsheetDoc
-{
-public:
- SpreadsheetDoc();
- ~SpreadsheetDoc();
-
- void copyRange( const OUString& rSrcRange, const OUString& rDstRange );
-
- ScDocument& GetDocument() { return *pDoc; }
- ScModelObj* GetModel() { return pModel; }
-
-private:
- uno::Reference< lang::XComponent > xComponent;
- ScDocument* pDoc;
- ScModelObj* pModel;
- ScTabViewShell* pViewShell;
- bool bOpenCLState;
-};
-
-SpreadsheetDoc::SpreadsheetDoc()
- : xComponent()
- , pDoc(nullptr)
- , pModel(nullptr)
- , pViewShell(nullptr)
- , bOpenCLState(ScCalcConfig::isOpenCLEnabled())
-{
- uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(::comphelper::getProcessComponentContext());
- CPPUNIT_ASSERT( xDesktop.is() );
-
- // create a frame
- Reference< frame::XFrame > xTargetFrame = xDesktop->findFrame( "_blank", 0 );
- CPPUNIT_ASSERT( xTargetFrame.is() );
-
- // Create spreadsheet
- uno::Sequence< beans::PropertyValue > aEmptyArgList;
- xComponent = xDesktop->loadComponentFromURL(
- "private:factory/scalc",
- "_blank",
- 0,
- aEmptyArgList );
- CPPUNIT_ASSERT( xComponent.is() );
-
- // Get the document model
- SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent);
- CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
-
- ScDocShellRef xDocSh = dynamic_cast<ScDocShell*>(pFoundShell);
- CPPUNIT_ASSERT(xDocSh != nullptr);
-
- uno::Reference< frame::XModel2 > xModel2 ( xDocSh->GetModel(), UNO_QUERY );
- CPPUNIT_ASSERT( xModel2.is() );
-
- Reference< frame::XController2 > xController ( xModel2->createDefaultViewController( xTargetFrame ), UNO_QUERY );
- CPPUNIT_ASSERT( xController.is() );
-
- // introduce model/view/controller to each other
- xController->attachModel( xModel2.get() );
- xModel2->connectController( xController.get() );
- xTargetFrame->setComponent( xController->getComponentWindow(), xController.get() );
- xController->attachFrame( xTargetFrame );
- xModel2->setCurrentController( xController.get() );
-
- pDoc = &(xDocSh->GetDocument());
-
- // Get the document controller
- pViewShell = xDocSh->GetBestViewShell(false);
- CPPUNIT_ASSERT(pViewShell != nullptr);
-
- pModel = ScModelObj::getImplementation(pFoundShell->GetModel());
- CPPUNIT_ASSERT(pModel != nullptr);
-}
-
-SpreadsheetDoc::~SpreadsheetDoc()
-{
- // Close the document (Ctrl-W)
- if (pModel)
- pModel->enableOpenCL(bOpenCLState);
- if (xComponent.is())
- xComponent->dispose();
-}
-
-void SpreadsheetDoc::copyRange( const OUString& rSrcRange, const OUString& rDstRange )
-{
-
- ScDocument aClipDoc(SCDOCMODE_CLIP);
-
- // 1. Copy
- ScRange aSrcRange;
- ScRefFlags nRes = aSrcRange.Parse(rSrcRange, pDoc, pDoc->GetAddressConvention());
- CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & ScRefFlags::VALID));
- pViewShell->GetViewData().GetMarkData().SetMarkArea(aSrcRange);
- pViewShell->GetViewData().GetView()->CopyToClip(&aClipDoc, false, false, false, false);
-
- // 2. Paste
- ScRange aDstRange;
- nRes = aDstRange.Parse(rDstRange, pDoc, pDoc->GetAddressConvention());
- CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & ScRefFlags::VALID));
- pViewShell->GetViewData().GetMarkData().SetMarkArea(aDstRange);
- pViewShell->GetViewData().GetView()->PasteFromClip(InsertDeleteFlags::ALL, &aClipDoc);
-}
-
-} // anonymous namespace
-
void ScPerfObj::testSheetFindAll()
{
More information about the Libreoffice-commits
mailing list