diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-11-30 09:13:53 +0000 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-11-30 11:38:46 +0100 |
commit | aa0604e81d2cafe500c3f0649c9d14d8d786ec46 (patch) | |
tree | 2e7734881d5fd5052cd75b04d13b1273d9852de8 /sc | |
parent | d9e9caf2ea2a42c09623d69c858921462aeac00e (diff) |
cppunit test for notification of note position changes on row/col changes
Change-Id: I32ed5cd249400f71903e7aa848ba63d03abbd9b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160139
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/tiledrendering/tiledrendering.cxx | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index b33960af5f22..27950831a1f3 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1094,6 +1094,10 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testCommentCallback) SfxLokHelper::setView(nView1); + ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current()); + if (pTabViewShell) + pTabViewShell->SetCursor(4, 4); + // Add a new comment uno::Sequence<beans::PropertyValue> aArgs(comphelper::InitPropertySequence( { @@ -1113,15 +1117,32 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testCommentCallback) CPPUNIT_ASSERT_EQUAL(std::string("LOK User1"), aView2.m_aCommentCallbackResult.get<std::string>("author")); CPPUNIT_ASSERT_EQUAL(std::string("Comment"), aView1.m_aCommentCallbackResult.get<std::string>("text")); CPPUNIT_ASSERT_EQUAL(std::string("Comment"), aView2.m_aCommentCallbackResult.get<std::string>("text")); - CPPUNIT_ASSERT_EQUAL(std::string("0 1 0 1"), aView1.m_aCommentCallbackResult.get<std::string>("cellRange")); - CPPUNIT_ASSERT_EQUAL(std::string("0 1 0 1"), aView2.m_aCommentCallbackResult.get<std::string>("cellRange")); + CPPUNIT_ASSERT_EQUAL(std::string("4 4 4 4"), aView1.m_aCommentCallbackResult.get<std::string>("cellRange")); + CPPUNIT_ASSERT_EQUAL(std::string("4 4 4 4"), aView2.m_aCommentCallbackResult.get<std::string>("cellRange")); + + // Ensure deleting rows updates comments + if (pTabViewShell) + pTabViewShell->SetCursor(2, 2); + + dispatchCommand(mxComponent, ".uno:DeleteRows", {}); + Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT_EQUAL(std::string("4 3 4 3"), aView1.m_aCommentCallbackResult.get<std::string>("cellRange")); + CPPUNIT_ASSERT_EQUAL(std::string("4 3 4 3"), aView2.m_aCommentCallbackResult.get<std::string>("cellRange")); + + // Ensure deleting columns updates comments + if (pTabViewShell) + pTabViewShell->SetCursor(2, 2); + + dispatchCommand(mxComponent, ".uno:DeleteColumns", {}); + Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT_EQUAL(std::string("3 3 3 3"), aView1.m_aCommentCallbackResult.get<std::string>("cellRange")); + CPPUNIT_ASSERT_EQUAL(std::string("3 3 3 3"), aView2.m_aCommentCallbackResult.get<std::string>("cellRange")); std::string aCommentId = aView1.m_aCommentCallbackResult.get<std::string>("id"); // Edit a comment // Select some random cell, we should be able to edit the cell note without // selecting the cell - ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current()); if (pTabViewShell) pTabViewShell->SetCursor(3, 100); aArgs = comphelper::InitPropertySequence( @@ -1141,8 +1162,8 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testCommentCallback) CPPUNIT_ASSERT_EQUAL(std::string("LOK User2"), aView2.m_aCommentCallbackResult.get<std::string>("author")); CPPUNIT_ASSERT_EQUAL(std::string("Edited comment"), aView1.m_aCommentCallbackResult.get<std::string>("text")); CPPUNIT_ASSERT_EQUAL(std::string("Edited comment"), aView2.m_aCommentCallbackResult.get<std::string>("text")); - CPPUNIT_ASSERT_EQUAL(std::string("0 1 0 1"), aView1.m_aCommentCallbackResult.get<std::string>("cellRange")); - CPPUNIT_ASSERT_EQUAL(std::string("0 1 0 1"), aView2.m_aCommentCallbackResult.get<std::string>("cellRange")); + CPPUNIT_ASSERT_EQUAL(std::string("3 3 3 3"), aView1.m_aCommentCallbackResult.get<std::string>("cellRange")); + CPPUNIT_ASSERT_EQUAL(std::string("3 3 3 3"), aView2.m_aCommentCallbackResult.get<std::string>("cellRange")); // Delete the comment if (pTabViewShell) |