sd/qa/unit/tiledrendering/data/NotesView.odp              |binary
 sd/qa/unit/tiledrendering/tiledrendering2.cxx             |   22 ++++++++++++++
 sd/qa/unit/tiledrendering/tiledrenderingmodeltestbase.cxx |   12 +++++++
 3 files changed, 34 insertions(+)

New commits:
commit 3a593bf6bb5e6a2696205e4ef6c712fe828b47cf
Author:     Gökay Şatır <gokaysa...@collabora.com>
AuthorDate: Wed Feb 12 13:15:04 2025 +0300
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon Mar 10 15:31:17 2025 +0100

    cool#10967: Add a test for the fix.
    
    Before the fix, there are 4 calls to invalidateTiles while switching to 
notes view.
    After the fix, the call count is 8.
    
    Change-Id: Idd737a8ceb954073d2962b8cc7a9bbfa5830d285
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182737
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sd/qa/unit/tiledrendering/data/NotesView.odp 
b/sd/qa/unit/tiledrendering/data/NotesView.odp
new file mode 100644
index 000000000000..02e2e9253b35
Binary files /dev/null and b/sd/qa/unit/tiledrendering/data/NotesView.odp differ
diff --git a/sd/qa/unit/tiledrendering/tiledrendering2.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering2.cxx
index 2ad35487e9b1..02962989d5a5 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering2.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering2.cxx
@@ -109,6 +109,28 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testInsertSignatureLineExternal)
     CPPUNIT_ASSERT(!pViewShell->GetViewShell()->GetSignPDFCertificate().Is());
 }
 
+CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testNotesViewInvalidations)
+{
+    // Given a document with 2 slides.
+    SdXImpressDocument* pXImpressDocument = createDoc("NotesView.odp");
+    ViewCallback aView;
+    CPPUNIT_ASSERT_EQUAL(2, pXImpressDocument->getParts());
+
+    // Switching to the second slide.
+    pXImpressDocument->setPart(1);
+
+    Scheduler::ProcessEventsToIdle();
+
+    aView.invalidatedAll = false;
+
+    // Switching to notes view.
+    dispatchCommand(mxComponent, ".uno:NotesMode", 
uno::Sequence<beans::PropertyValue>());
+
+    CPPUNIT_ASSERT_EQUAL(true, aView.invalidatedAll);
+    CPPUNIT_ASSERT_EQUAL(1, aView.partOfInvalidation);
+    CPPUNIT_ASSERT_EQUAL(2, aView.editModeOfInvalidation);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/qa/unit/tiledrendering/tiledrenderingmodeltestbase.cxx 
b/sd/qa/unit/tiledrendering/tiledrenderingmodeltestbase.cxx
index 19905add0af7..dec211944cf9 100644
--- a/sd/qa/unit/tiledrendering/tiledrenderingmodeltestbase.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrenderingmodeltestbase.cxx
@@ -251,6 +251,9 @@ public:
     std::vector<std::string> m_aStateChanged;
     std::map<std::string, boost::property_tree::ptree> m_aStateChanges;
     TestLokCallbackWrapper m_callbackWrapper;
+    bool invalidatedAll;
+    int editModeOfInvalidation;
+    int partOfInvalidation;
 
     ViewCallback()
         : m_bGraphicSelectionInvalidated(false)
@@ -262,6 +265,9 @@ public:
         , m_bTilesInvalidated(false)
         , m_bViewSelectionSet(false)
         , m_callbackWrapper(&callback, this)
+        , invalidatedAll(false)
+        , editModeOfInvalidation(0)
+        , partOfInvalidation(0)
     {
         mpViewShell = SfxViewShell::Current();
         mpViewShell->setLibreOfficeKitViewCallback(&m_callbackWrapper);
@@ -300,6 +306,12 @@ public:
                     aInvalidationRect.setHeight(aSeq[3].toInt32());
                     m_aInvalidations.push_back(aInvalidationRect);
                 }
+                else
+                {
+                    editModeOfInvalidation = mpViewShell->getEditMode();
+                    partOfInvalidation = mpViewShell->getPart();
+                    invalidatedAll = true;
+                }
             }
             break;
             case LOK_CALLBACK_GRAPHIC_SELECTION:

Reply via email to