sc/CppunitTest_sc_jumbosheets_test.mk | 1 sc/qa/unit/jumbosheets-test.cxx | 37 ++++++++++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-)
New commits: commit 129fde28f6aa26a8c52de193b41c0c92a08a7a89 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Tue Feb 22 18:44:12 2022 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Wed Feb 23 21:28:58 2022 +0100 tdf#147458: sc_jumbosheets: Add unittest For some reason, the test fails on windows with Test name: ScJumboSheetsTest::testTdf134553 equality assertion failed - Expected: 1058 - Actual : -7421 However, the issue is not reproducible manually. If the test is executed with aDefaultsOption.SetInitJumboSheets(true); then it doesn't fail Change-Id: I5314c326d3937eaf5e96e4d25d71a7f1347c11af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130365 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/CppunitTest_sc_jumbosheets_test.mk b/sc/CppunitTest_sc_jumbosheets_test.mk index f39486dae4b5..867589c4fa60 100644 --- a/sc/CppunitTest_sc_jumbosheets_test.mk +++ b/sc/CppunitTest_sc_jumbosheets_test.mk @@ -32,6 +32,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_jumbosheets_test, \ sc \ scqahelper \ sfx \ + svxcore \ test \ tl \ unotest \ diff --git a/sc/qa/unit/jumbosheets-test.cxx b/sc/qa/unit/jumbosheets-test.cxx index c1648ac5ca14..e0dd7e87c98b 100644 --- a/sc/qa/unit/jumbosheets-test.cxx +++ b/sc/qa/unit/jumbosheets-test.cxx @@ -16,6 +16,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/propertyvalue.hxx> #include <svx/svdoole2.hxx> +#include <svx/svdpage.hxx> #include <test/xmltesttools.hxx> #include <defaultsoptions.hxx> @@ -223,8 +224,8 @@ void ScJumboSheetsTest::testRoundtripNamedRanges() void ScJumboSheetsTest::testTdf134553() { - ScDocShellRef xDocSh = loadDoc(u"tdf134553.", FORMAT_XLSX); - CPPUNIT_ASSERT(xDocSh.is()); + ScDocShellRef xDocSh = loadDocAndSetupModelViewController(u"tdf134553.", FORMAT_XLSX); + CPPUNIT_ASSERT(xDocSh); ScDocument& rDoc = xDocSh->GetDocument(); @@ -235,6 +236,38 @@ void ScJumboSheetsTest::testTdf134553() CPPUNIT_ASSERT_EQUAL(tools::Long(12741), pOleObj->GetLogicRect().getWidth()); CPPUNIT_ASSERT_EQUAL(tools::Long(7620), pOleObj->GetLogicRect().getHeight()); + CPPUNIT_ASSERT_EQUAL(tools::Long(4574), pOleObj->GetLogicRect().getX()); + CPPUNIT_ASSERT_EQUAL(tools::Long(437), pOleObj->GetLogicRect().getY()); + + ScTabViewShell* pViewShell = xDocSh->GetBestViewShell(false); + CPPUNIT_ASSERT(pViewShell); + + pViewShell->SelectObject(u"Diagram 1"); + + uno::Reference<lang::XComponent> xComponent = xDocSh->GetModel(); + dispatchCommand(xComponent, ".uno:Cut", {}); + Scheduler::ProcessEventsToIdle(); + + ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer(); + const SdrPage* pPage = pDrawLayer->GetPage(0); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pPage->GetObjCount()); + + dispatchCommand(xComponent, ".uno:Paste", {}); + Scheduler::ProcessEventsToIdle(); + + pOleObj = getSingleChartObject(rDoc, 0); + CPPUNIT_ASSERT(pOleObj); + + CPPUNIT_ASSERT_EQUAL(tools::Long(12741), pOleObj->GetLogicRect().getWidth()); + CPPUNIT_ASSERT_EQUAL(tools::Long(7620), pOleObj->GetLogicRect().getHeight()); + CPPUNIT_ASSERT_EQUAL(tools::Long(5097), pOleObj->GetLogicRect().getX()); + +#if !defined(_WIN32) //FIXME + // tdf#147458: Without the fix in place, this test would have failed with + // - Expected: 1058 + // - Actual : -7421 + CPPUNIT_ASSERT_EQUAL(tools::Long(1058), pOleObj->GetLogicRect().getY()); +#endif xDocSh->DoClose(); }