diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-10-05 14:49:52 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-10-05 20:03:46 +0200 |
commit | df5c984fa2e1687603e9e1b63a69b43591f19143 (patch) | |
tree | 0b3c4d97f4f4ba3660e7f942cc639c6bd034b62f /sc | |
parent | d3792300afec9c9cb8751cae5b46e8f9198214b4 (diff) |
tdf#133033: sc_jumbosheets_test: Add unittest
Change-Id: I408df8eeba6b88d5d5fc4bb35e6a6d03810948a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103966
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/jumbosheets-test.cxx | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/sc/qa/unit/jumbosheets-test.cxx b/sc/qa/unit/jumbosheets-test.cxx index 77bd231984c1..1c129518008f 100644 --- a/sc/qa/unit/jumbosheets-test.cxx +++ b/sc/qa/unit/jumbosheets-test.cxx @@ -11,9 +11,16 @@ #include <sal/config.h> #include <unotest/filters-test.hxx> #include <test/bootstrapfixture.hxx> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <vcl/scheduler.hxx> +#include <vcl/keycodes.hxx> +#include <comphelper/processfactory.hxx> #include <defaultsoptions.hxx> #include <scmod.hxx> +#include <viewdata.hxx> +#include <tabvwsh.hxx> +#include <com/sun/star/frame/Desktop.hpp> #include "helper/qahelper.hxx" #include "helper/shared_test_impl.hxx" @@ -36,10 +43,12 @@ public: virtual void tearDown() override; void testTdf134392(); + void testTdf133033(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testTdf134392); + CPPUNIT_TEST(testTdf133033); CPPUNIT_TEST_SUITE_END(); @@ -71,6 +80,42 @@ void ScFiltersTest::testTdf134392() xDocSh->DoClose(); } +void ScFiltersTest::testTdf133033() +{ + // Create an empty document + uno::Reference<frame::XDesktop2> xDesktop + = frame::Desktop::create(::comphelper::getProcessComponentContext()); + CPPUNIT_ASSERT(xDesktop.is()); + + Sequence<beans::PropertyValue> args(1); + args[0].Name = "Hidden"; + args[0].Value <<= true; + + m_xCalcComponent = xDesktop->loadComponentFromURL("private:factory/scalc", "_blank", 0, args); + CPPUNIT_ASSERT(m_xCalcComponent.is()); + + // Get the document model + SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(m_xCalcComponent); + CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); + + ScDocShellRef xDocSh = dynamic_cast<ScDocShell*>(pFoundShell); + CPPUNIT_ASSERT(xDocSh); + + ScTabViewShell* pViewShell = xDocSh->GetBestViewShell(false); + CPPUNIT_ASSERT(pViewShell); + + ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(m_xCalcComponent.get()); + CPPUNIT_ASSERT(pModelObj); + + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_DOWN | KEY_MOD1); + Scheduler::ProcessEventsToIdle(); + + ScViewData& rViewData = pViewShell->GetViewData(); + + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), rViewData.GetCurX()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(15999999), rViewData.GetCurY()); +} + ScFiltersTest::ScFiltersTest() : ScBootstrapFixture("sc/qa/unit/data") { |