Blame SOURCES/0288-sc-lok-Add-initial-test-for-.uno-CellCursor.patch

f325b2
From 605efe926ab66ddf5aa790051008c3ed35b9a0e9 Mon Sep 17 00:00:00 2001
f325b2
From: Andrzej Hunt <andrzej@ahunt.org>
f325b2
Date: Fri, 6 Nov 2015 18:09:34 +0100
f325b2
Subject: [PATCH 288/398] sc lok: Add initial test for .uno:CellCursor
f325b2
f325b2
This should be extended with checking that we receive "EMPTY"
f325b2
when there is no cursor shown - that would require e.g. simulating
f325b2
keyboard input to hide the cell cursor.
f325b2
f325b2
Change-Id: Ia7be5ec3e158f21967b4c307ac10abb2b5e2a56a
f325b2
Reviewed-on: https://gerrit.libreoffice.org/19828
f325b2
Tested-by: Jenkins <ci@libreoffice.org>
f325b2
Reviewed-by: Andrzej Hunt <andrzej@ahunt.org>
f325b2
Tested-by: Andrzej Hunt <andrzej@ahunt.org>
f325b2
(cherry picked from commit 2f13f051c3c39f77d5f65ff0e3f4a476ccb95f1a)
f325b2
---
f325b2
 desktop/qa/desktop_lib/test_desktop_lib.cxx | 20 ++++++++++++++++++++
f325b2
 sc/source/ui/view/gridwin.cxx               |  7 ++-----
f325b2
 2 files changed, 22 insertions(+), 5 deletions(-)
f325b2
f325b2
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
f325b2
index 8c622a577231..df803c4bdaf0 100644
f325b2
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
f325b2
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
f325b2
@@ -68,6 +68,7 @@ public:
f325b2
     void testSaveAsCalc();
f325b2
     void testPasteWriter();
f325b2
     void testRowColumnHeaders();
f325b2
+    void testCellCursor();
f325b2
     void testCommandResult();
f325b2
 
f325b2
     CPPUNIT_TEST_SUITE(DesktopLOKTest);
f325b2
@@ -82,6 +83,7 @@ public:
f325b2
     CPPUNIT_TEST(testSaveAsCalc);
f325b2
     CPPUNIT_TEST(testPasteWriter);
f325b2
     CPPUNIT_TEST(testRowColumnHeaders);
f325b2
+    CPPUNIT_TEST(testCellCursor);
f325b2
     CPPUNIT_TEST(testCommandResult);
f325b2
     CPPUNIT_TEST_SUITE_END();
f325b2
 
f325b2
@@ -435,6 +437,24 @@ void DesktopLOKTest::testRowColumnHeaders()
f325b2
     }
f325b2
 }
f325b2
 
f325b2
+void DesktopLOKTest::testCellCursor()
f325b2
+{
f325b2
+    LibLODocument_Impl* pDocument = loadDoc("search.ods");
f325b2
+
f325b2
+    boost::property_tree::ptree aTree;
f325b2
+
f325b2
+    char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, ".uno:CellCursor?tileWidth=1&tileHeight=1&outputWidth=1&outputHeight=1");
f325b2
+
f325b2
+    std::stringstream aStream(pJSON);
f325b2
+    free(pJSON);
f325b2
+    CPPUNIT_ASSERT(!aStream.str().empty());
f325b2
+
f325b2
+    boost::property_tree::read_json(aStream, aTree);
f325b2
+
f325b2
+    OString aRectangle(aTree.get<std::string>("commandValues").c_str());
f325b2
+    CPPUNIT_ASSERT_EQUAL(aRectangle, OString("0, 0, 1278, 254"));
f325b2
+}
f325b2
+
f325b2
 void DesktopLOKTest::testCommandResult()
f325b2
 {
f325b2
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
f325b2
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
f325b2
index d6887b6f4e07..c2d391d038ef 100644
f325b2
--- a/sc/source/ui/view/gridwin.cxx
f325b2
+++ b/sc/source/ui/view/gridwin.cxx
f325b2
@@ -5796,13 +5796,10 @@ OString ScGridWindow::getCellCursor( int nOutputWidth, int nOutputHeight,
f325b2
 }
f325b2
 
f325b2
 OString ScGridWindow::getCellCursor(const Fraction& rZoomX, const Fraction& rZoomY) {
f325b2
-    ScDocument* pDoc = pViewData->GetDocument();
f325b2
-    ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
f325b2
-
f325b2
-    // GridWindows stores a shown cell cursor in mpOOCursors, hence
f325b2
+    // GridWindow stores a shown cell cursor in mpOOCursors, hence
f325b2
     // we can use that to determine whether we would want to be showing
f325b2
     // one (client-side) for tiled rendering too.
f325b2
-    if (!pDrawLayer->isTiledRendering() || !mpOOCursors.get())
f325b2
+    if (!mpOOCursors.get())
f325b2
     {
f325b2
         return OString("EMPTY");
f325b2
     }
f325b2
-- 
f325b2
2.12.0
f325b2