summaryrefslogtreecommitdiff
path: root/sc/qa/unit/bugfix-test.cxx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2015-11-06 17:56:19 +1000
committerCaolán McNamara <caolanm@redhat.com>2015-11-10 11:57:48 +0000
commit1fa38d29030ae9d9751a1fbec30d8ba3263e681d (patch)
treed5dad2fde44389f55eee7ffb645376fbd3c525b9 /sc/qa/unit/bugfix-test.cxx
parenta152908657ef662e9c5608e3bca3c5f511a01b8e (diff)
tdf#91979: ScViewData::GetScrPos(): remove coordinates limit of 32767
This removes the restriction for returned coodrinates from ScViewData::GetScrPos(). The reasoning is the following: 1. In the existing implementation, the limit enforcement is flawed. The routine is capable to return negative coordinates, but only positives are checked. Also, the routine code itself uses value greater than 32767 (specifically, 65535 in case of col/row exceed MAXCOL/MAXROW), that later gets truncated. 2. In case of tiled rendering, it's already possible to see the numbers greater than 32767. 3. Given that the code works for long time and produces big negatives, as well as big positives in case of tiled rendering, it's highly probable that existing code is prepared for large returned values. Another option could be additionally check for !bAllowNeg before emposing the limit Change-Id: Ie78cfe5907253e6648fed27dfac78b292922f5b4 Reviewed-on: https://gerrit.libreoffice.org/19816 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/qa/unit/bugfix-test.cxx')
-rw-r--r--sc/qa/unit/bugfix-test.cxx43
1 files changed, 43 insertions, 0 deletions
diff --git a/sc/qa/unit/bugfix-test.cxx b/sc/qa/unit/bugfix-test.cxx
index 0c2d43b57862..209776d2a6b0 100644
--- a/sc/qa/unit/bugfix-test.cxx
+++ b/sc/qa/unit/bugfix-test.cxx
@@ -47,6 +47,7 @@
#include "cellvalue.hxx"
#include "attrib.hxx"
#include "dpshttab.hxx"
+#include "tabvwsh.hxx"
#include <scopetools.hxx>
#include <columnspanset.hxx>
#include <tokenstringcontext.hxx>
@@ -62,6 +63,7 @@
#include <com/sun/star/text/textfield/Type.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include "helper/qahelper.hxx"
#include "helper/shared_test_impl.hxx"
@@ -82,6 +84,7 @@ public:
void testTdf36933();
void testTdf43700();
void testTdf43534();
+ void testTdf91979();
// void testTdf40110();
CPPUNIT_TEST_SUITE(ScFiltersTest);
@@ -89,6 +92,7 @@ public:
CPPUNIT_TEST(testTdf36933);
CPPUNIT_TEST(testTdf43700);
CPPUNIT_TEST(testTdf43534);
+ CPPUNIT_TEST(testTdf91979);
// CPPUNIT_TEST(testTdf40110);
CPPUNIT_TEST_SUITE_END();
private:
@@ -167,6 +171,45 @@ void ScFiltersTest::testTdf43534()
xDocSh->DoClose();
}
+void ScFiltersTest::testTdf91979()
+{
+ uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(::comphelper::getProcessComponentContext());
+ CPPUNIT_ASSERT(xDesktop.is());
+
+ Sequence < beans::PropertyValue > args(1);
+ args[0].Name = "Hidden";
+ args[0].Value <<= sal_True;
+
+ uno::Reference< lang::XComponent > xComponent = xDesktop->loadComponentFromURL(
+ "private:factory/scalc",
+ "_blank",
+ 0,
+ args);
+ 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 != NULL);
+
+ // Get the document controller
+ ScTabViewShell* pViewShell = xDocSh->GetBestViewShell(false);
+ CPPUNIT_ASSERT(pViewShell != NULL);
+ auto& aViewData = pViewShell->GetViewData();
+ auto* pDoc = aViewData.GetDocument();
+
+ // Check coordinates of a distant cell
+ Point aPos = aViewData.GetScrPos(MAXCOL - 1, 10000, SC_SPLIT_TOPLEFT, true);
+ int nColWidth = aViewData.ToPixel(pDoc->GetColWidth(0, 0), aViewData.GetPPTX());
+ int nRowHeight = aViewData.ToPixel(pDoc->GetRowHeight(0, 0), aViewData.GetPPTY());
+ CPPUNIT_ASSERT(aPos.getX() == (MAXCOL - 1) * nColWidth);
+ CPPUNIT_ASSERT(aPos.getY() == 10000 * nRowHeight);
+
+ xDocSh->DoClose();
+}
+
/*
void ScFiltersTest::testTdf40110()
{