tdf#155349 add a test case to catch if full invalidation ever returns

Change-Id: Ifea1102fd27643ba950b4c9e8d42dd06c1ce71e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152001
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 412ff2b..2fbe09c 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -107,6 +107,7 @@ protected:
    int m_nRedlineTableSizeChanged;
    int m_nRedlineTableEntryModified;
    int m_nTrackedChangeIndex;
    bool m_bFullInvalidateSeen;
    OString m_sHyperlinkText;
    OString m_sHyperlinkLink;
    OString m_aFormFieldButton;
@@ -124,6 +125,7 @@ SwTiledRenderingTest::SwTiledRenderingTest()
    m_nRedlineTableSizeChanged(0),
    m_nRedlineTableEntryModified(0),
    m_nTrackedChangeIndex(-1),
    m_bFullInvalidateSeen(false),
    m_callbackWrapper(&callback, this)
{
}
@@ -194,7 +196,11 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload)
                tools::Rectangle aInvalidation;
                uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload));
                if (std::string_view("EMPTY") == pPayload)
                {
                    m_bFullInvalidateSeen = true;
                    return;
                }

                CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5);
                aInvalidation.SetLeft(aSeq[0].toInt32());
                aInvalidation.SetTop(aSeq[1].toInt32());
@@ -3531,6 +3537,21 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testBulletDeleteInvalidation)
    CPPUNIT_ASSERT(!aFirstTextRect.Overlaps(m_aInvalidations));
}

CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testTdf155349)
{
    SwXTextDocument* pXTextDocument = createDoc();
    SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
    Scheduler::ProcessEventsToIdle();
    setupLibreOfficeKitViewCallback(pWrtShell->GetSfxViewShell());
    pWrtShell->Insert2("a");
    Scheduler::ProcessEventsToIdle();
    pWrtShell->Insert2("b");
    m_bFullInvalidateSeen = false;
    Scheduler::ProcessEventsToIdle();
    // before fix for tdf#155349 the total area got invalidated when changing one line
    CPPUNIT_ASSERT(!m_bFullInvalidateSeen);
}

CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testBulletNoNumInvalidation)
{
    // Given a document with 3 paragraphs: all are bulleted.