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

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