summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej@ahunt.org>2015-11-06 18:09:34 +0100
committerAshod Nakashian <ashnakash@gmail.com>2016-05-07 19:55:49 +0000
commitebf654c44a92a1becb88982da0f68861b444a3da (patch)
tree61ef74d34e3bb751651923c929f7145f3894dfb4
parent6a7e4abb8a280a2db39475b58ac774031c22f0ba (diff)
sc lok: Add initial test for .uno:CellCursor
This should be extended with checking that we receive "EMPTY" when there is no cursor shown - that would require e.g. simulating keyboard input to hide the cell cursor. Reviewed-on: https://gerrit.libreoffice.org/19828 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Andrzej Hunt <andrzej@ahunt.org> Tested-by: Andrzej Hunt <andrzej@ahunt.org> (cherry picked from commit 2f13f051c3c39f77d5f65ff0e3f4a476ccb95f1a) Change-Id: Ia7be5ec3e158f21967b4c307ac10abb2b5e2a56a Reviewed-on: https://gerrit.libreoffice.org/24724 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx20
-rw-r--r--sc/source/ui/view/gridwin.cxx7
2 files changed, 22 insertions, 5 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index e89caae793d3..40099209ada5 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -95,6 +95,7 @@ public:
void testPasteWriter();
void testPasteWriterJPEG();
void testRowColumnHeaders();
+ void testCellCursor();
void testHiddenRowHeaders();
void testCommandResult();
void testWriterComments();
@@ -115,6 +116,7 @@ public:
CPPUNIT_TEST(testPasteWriter);
CPPUNIT_TEST(testPasteWriterJPEG);
CPPUNIT_TEST(testRowColumnHeaders);
+ CPPUNIT_TEST(testCellCursor);
CPPUNIT_TEST(testHiddenRowHeaders);
CPPUNIT_TEST(testCommandResult);
CPPUNIT_TEST(testWriterComments);
@@ -536,6 +538,24 @@ void DesktopLOKTest::testRowColumnHeaders()
}
}
+void DesktopLOKTest::testCellCursor()
+{
+ LibLODocument_Impl* pDocument = loadDoc("search.ods");
+
+ boost::property_tree::ptree aTree;
+
+ char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, ".uno:CellCursor?tileWidth=1&tileHeight=1&outputWidth=1&outputHeight=1");
+
+ std::stringstream aStream(pJSON);
+ free(pJSON);
+ CPPUNIT_ASSERT(!aStream.str().empty());
+
+ boost::property_tree::read_json(aStream, aTree);
+
+ OString aRectangle(aTree.get<std::string>("commandValues").c_str());
+ CPPUNIT_ASSERT_EQUAL(aRectangle, OString("0, 0, 1278, 254"));
+}
+
void DesktopLOKTest::testHiddenRowHeaders()
{
LibLODocument_Impl* pDocument = loadDoc("hidden-row.ods");
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index a3f13d5cd926..e163f6133a7e 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5803,13 +5803,10 @@ OString ScGridWindow::getCellCursor( int nOutputWidth, int nOutputHeight,
}
OString ScGridWindow::getCellCursor(const Fraction& rZoomX, const Fraction& rZoomY) {
- ScDocument* pDoc = pViewData->GetDocument();
- ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
-
- // GridWindows stores a shown cell cursor in mpOOCursors, hence
+ // GridWindow stores a shown cell cursor in mpOOCursors, hence
// we can use that to determine whether we would want to be showing
// one (client-side) for tiled rendering too.
- if (!pDrawLayer->isTiledRendering() || !mpOOCursors.get())
+ if (!mpOOCursors.get())
{
return OString("EMPTY");
}