sc/qa/unit/jumbosheets-test.cxx | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
New commits: commit df5c984fa2e1687603e9e1b63a69b43591f19143 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Mon Oct 5 14:49:52 2020 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Oct 5 20:03:46 2020 +0200 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 <xiscofa...@libreoffice.org> 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") { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits