summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2020-03-09 21:20:19 +0100
committerXisco FaulĂ­ <xiscofauli@libreoffice.org>2020-03-10 11:50:42 +0100
commit976cabe84f3b6e5591ccf2b043d72cbca3e31ba0 (patch)
tree9ab706d0db523ba9f0805819d6cc3466d9dc4f9a /sc
parent30b23d77c894bdf6f7ae0d18d594ea267a80f662 (diff)
tdf#126904: Add unittest
Change-Id: Ie5ec86642bcd4a8822d885d18516ee3ad6fecbfe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90250 Tested-by: Jenkins Reviewed-by: Xisco FaulĂ­ <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/uicalc/data/tdf126904.odsbin0 -> 23144 bytes
-rw-r--r--sc/qa/unit/uicalc/uicalc.cxx50
2 files changed, 49 insertions, 1 deletions
diff --git a/sc/qa/unit/uicalc/data/tdf126904.ods b/sc/qa/unit/uicalc/data/tdf126904.ods
new file mode 100644
index 000000000000..0f2cf05132c4
--- /dev/null
+++ b/sc/qa/unit/uicalc/data/tdf126904.ods
Binary files differ
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 3dfcade9de98..193f50e7978e 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -29,7 +29,7 @@ public:
ScModelObj* createDoc(const char* pName);
-private:
+protected:
uno::Reference<lang::XComponent> mxComponent;
};
@@ -87,6 +87,54 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf122232)
CPPUNIT_ASSERT_EQUAL(sal_Int32(6), ScDocShell::GetViewData()->GetCurY());
}
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf126904)
+{
+ ScModelObj* pModelObj = createDoc("tdf126904.ods");
+ ScDocument* pDoc = pModelObj->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(0), ScDocShell::GetViewData()->GetCurX());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4), ScDocShell::GetViewData()->GetCurY());
+
+ dispatchCommand(mxComponent, ".uno:GoRight", {});
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(1), ScDocShell::GetViewData()->GetCurX());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4), ScDocShell::GetViewData()->GetCurY());
+
+ dispatchCommand(mxComponent, ".uno:GoRight", {});
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(4), ScDocShell::GetViewData()->GetCurX());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4), ScDocShell::GetViewData()->GetCurY());
+
+ dispatchCommand(mxComponent, ".uno:GoRight", {});
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(5), ScDocShell::GetViewData()->GetCurX());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4), ScDocShell::GetViewData()->GetCurY());
+
+ dispatchCommand(mxComponent, ".uno:GoRight", {});
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(8), ScDocShell::GetViewData()->GetCurX());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4), ScDocShell::GetViewData()->GetCurY());
+
+ dispatchCommand(mxComponent, ".uno:GoRight", {});
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(9), ScDocShell::GetViewData()->GetCurX());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4), ScDocShell::GetViewData()->GetCurY());
+
+ dispatchCommand(mxComponent, ".uno:GoRight", {});
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(12), ScDocShell::GetViewData()->GetCurX());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4), ScDocShell::GetViewData()->GetCurY());
+
+ //Cursor can't move forward to the right
+ for (size_t i = 0; i < 5; ++i)
+ {
+ dispatchCommand(mxComponent, ".uno:GoRight", {});
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(13), ScDocShell::GetViewData()->GetCurX());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4), ScDocShell::GetViewData()->GetCurY());
+ }
+}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */