diff options
author | László Németh <nemeth@numbertext.org> | 2024-04-27 00:26:54 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2024-04-29 00:16:21 +0200 |
commit | f3b899655018397e71300dbb32cdf4f82940a68b (patch) | |
tree | a28cefb33040d8d4472aad79cbda4d3b42483f99 /sw/qa/extras/uiwriter/uiwriter6.cxx | |
parent | 6c00a73348511b688be214439941e128fc430a34 (diff) |
tdf#160842 sw: select cell content instead of cropped part of image
It was not possible to select and edit the content of the bottom
cell, if an image cropped by the fixed row height "covered" it,
i.e. the image was in the previous row, anchored as character.
Note: table cells with fixed row height are usable to crop images
easily, with a single drag & drop, according to the requirement of
the text layout, while the cell above or bottom of the cell with
image is for the caption of the image. This is very useful to
adjust a book layout with sections with multiple columns and
illustrations.
Change-Id: I8683b4066db6ce43549ec3aa69b0e639a59e3681
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166794
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/qa/extras/uiwriter/uiwriter6.cxx')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter6.cxx | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx index 51f15a09f2d8..e6cff1c8ae9a 100644 --- a/sw/qa/extras/uiwriter/uiwriter6.cxx +++ b/sw/qa/extras/uiwriter/uiwriter6.cxx @@ -55,6 +55,10 @@ #include <wrthtml.hxx> #include <dbmgr.hxx> #include <rootfrm.hxx> +#include <pagefrm.hxx> +#include <sortedobjs.hxx> +#include <flyfrms.hxx> +#include <tabfrm.hxx> #include <unotxdoc.hxx> #include <wrong.hxx> #include <com/sun/star/linguistic2/LinguServiceManager.hpp> @@ -1463,6 +1467,43 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf44773) CPPUNIT_ASSERT_EQUAL(tools::Long(810), pCellA1->getFrameArea().Height()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf160842) +{ + createSwDoc("tdf160842.fodt"); + SwDoc* pDoc = getSwDoc(); + CPPUNIT_ASSERT(pDoc); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + CPPUNIT_ASSERT(pWrtShell); + // the cursor is not in the table + CPPUNIT_ASSERT(!pWrtShell->IsCursorInTable()); + + SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); + auto pPage = dynamic_cast<SwPageFrame*>(pLayout->Lower()); + CPPUNIT_ASSERT(pPage); + const SwSortedObjs& rPageObjs = *pPage->GetSortedObjs(); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPageObjs.size()); + auto pPageFly = dynamic_cast<SwFlyAtContentFrame*>(rPageObjs[0]); + CPPUNIT_ASSERT(pPageFly); + auto pTable = dynamic_cast<SwTabFrame*>(pPageFly->GetLower()); + CPPUNIT_ASSERT(pTable); + auto pRow2 = pTable->GetLower()->GetNext(); + CPPUNIT_ASSERT(pRow2->IsRowFrame()); + auto pCellA2 = pRow2->GetLower(); + CPPUNIT_ASSERT(pCellA2); + const SwRect& rCellA2Rect = pCellA2->getFrameArea(); + auto nRowHeight = rCellA2Rect.Height(); + // select center of the bottom cell + Point ptFrom(rCellA2Rect.Left() + rCellA2Rect.Width() / 2, rCellA2Rect.Top() + nRowHeight / 2); + vcl::Window& rEditWin = pDoc->GetDocShell()->GetView()->GetEditWin(); + Point aFrom = rEditWin.LogicToPixel(ptFrom); + MouseEvent aClickEvent(aFrom, 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); + rEditWin.MouseButtonDown(aClickEvent); + rEditWin.MouseButtonUp(aClickEvent); + + // the cursor is in the table + CPPUNIT_ASSERT(pWrtShell->IsCursorInTable()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf115132) { createSwDoc(); |