[Libreoffice-commits] core.git: sd/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 6 13:43:56 UTC 2020


 sd/qa/unit/tiledrendering/data/tdf118354.odp |binary
 sd/qa/unit/tiledrendering/tiledrendering.cxx |   30 +++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

New commits:
commit 4361e87deff63bd7dca2c5c22372379254912a0c
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Mon Apr 6 13:28:03 2020 +0200
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Mon Apr 6 15:43:22 2020 +0200

    tdf#118354: Add unittest
    
    Change-Id: I10fe6180f9a793ff9bb1cd9ad18d2cfddc1c1ec6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91743
    Tested-by: Jenkins
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/sd/qa/unit/tiledrendering/data/tdf118354.odp b/sd/qa/unit/tiledrendering/data/tdf118354.odp
new file mode 100644
index 000000000000..beb132c7e34d
Binary files /dev/null and b/sd/qa/unit/tiledrendering/data/tdf118354.odp differ
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 2fed5db352df..9bf4a5acb47f 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -107,6 +107,7 @@ public:
     void testCreateViewGraphicSelection();
     void testCreateViewTextCursor();
     void testTdf102223();
+    void testTdf118354();
     void testPostKeyEventInvalidation();
     void testTdf103083();
     void testTdf104405();
@@ -162,6 +163,7 @@ public:
     CPPUNIT_TEST(testCreateViewGraphicSelection);
     CPPUNIT_TEST(testCreateViewTextCursor);
     CPPUNIT_TEST(testTdf102223);
+    CPPUNIT_TEST(testTdf118354);
     CPPUNIT_TEST(testPostKeyEventInvalidation);
     CPPUNIT_TEST(testTdf103083);
     CPPUNIT_TEST(testTdf104405);
@@ -1540,6 +1542,34 @@ void SdTiledRenderingTest::testTdf102223()
     CPPUNIT_ASSERT_EQUAL(int(1411), static_cast<int>(rItem2.GetHeight()));
 }
 
+void SdTiledRenderingTest::testTdf118354()
+{
+    // Load the document.
+    SdXImpressDocument* pXImpressDocument = createDoc("tdf118354.odp");
+
+    sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
+    SdPage* pActualPage = pViewShell->GetActualPage();
+
+    CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), pActualPage->GetObjCount());
+
+    auto pTableObject = dynamic_cast<sdr::table::SdrTableObj*>(pActualPage->GetObj(0));
+    CPPUNIT_ASSERT(pTableObject);
+
+    // Without the fix, it would crash here
+    ::tools::Rectangle aRect = pTableObject->GetCurrentBoundRect();
+    pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
+                                      convertMm100ToTwip(aRect.getX() + 2), convertMm100ToTwip(aRect.getY() + 2),
+                                      1, MOUSE_LEFT, 0);
+    pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP,
+                                      convertMm100ToTwip(aRect.getX() + 2), convertMm100ToTwip(aRect.getY() + 2),
+                                      1, MOUSE_LEFT, 0);
+    Scheduler::ProcessEventsToIdle();
+
+    SdrView* pView = pViewShell->GetView();
+    rtl::Reference<sdr::SelectionController> xSelectionController(pView->getSelectionController());
+    CPPUNIT_ASSERT(xSelectionController->hasSelectedCells());
+}
+
 void SdTiledRenderingTest::testPostKeyEventInvalidation()
 {
     // Load a document and begin text edit on the first slide.


More information about the Libreoffice-commits mailing list