From 5a7157d319477830426797532e02ac39d3b859f4 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 11:29:03 +0200 Subject: Merging upstream version 4:24.2.1. Signed-off-by: Daniel Baumann --- .../tiledrendering/data/invalidate-on-save.ods | Bin 0 -> 10807 bytes sc/qa/unit/tiledrendering/tiledrendering.cxx | 30 +++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 sc/qa/unit/tiledrendering/data/invalidate-on-save.ods (limited to 'sc/qa/unit/tiledrendering') diff --git a/sc/qa/unit/tiledrendering/data/invalidate-on-save.ods b/sc/qa/unit/tiledrendering/data/invalidate-on-save.ods new file mode 100644 index 0000000000..efe2c225a4 Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/invalidate-on-save.ods differ diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 00fda9336f..9e07c0c060 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -3113,6 +3113,36 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testGetViewRenderState) CPPUNIT_ASSERT_EQUAL(";Default"_ostr, pModelObj->getViewRenderState()); } +// Saving shouldn't trigger an invalidation +CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testNoInvalidateOnSave) +{ + comphelper::LibreOfficeKit::setCompatFlag( + comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs); + + loadFromFile(u"invalidate-on-save.ods"); + + // .uno:Save modifies the original file, make a copy first + saveAndReload("calc8"); + ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); + CPPUNIT_ASSERT(pModelObj); + pModelObj->initializeForTiledRendering(uno::Sequence()); + + ScTabViewShell* pView = dynamic_cast(SfxViewShell::Current()); + CPPUNIT_ASSERT(pView); + + Scheduler::ProcessEventsToIdle(); + + // track invalidations + ViewCallback aView; + + uno::Sequence aArgs; + dispatchCommand(mxComponent, ".uno:Save", aArgs); + + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT(!aView.m_bInvalidateTiles); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3