diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-04-01 21:34:50 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-04-02 13:18:05 +0200 |
commit | e651a4f45b310f9890ffbf712b9970d4c452ecec (patch) | |
tree | df240f98d32b446fcb4aae2641282f091611cd5a /sw/qa/extras/uiwriter/uiwriter2.cxx | |
parent | ff1bafa9755a1099f12cdf7c89dd62ec328dd223 (diff) |
tdf#124261 sw btlr writing mode render: fix invalidation rectangle
SwTextFrame::SwitchHorizontalToVertical(SwRect) did not handle the non-swapped
case, also the text frame took the tblr codepath when determining the
invalidation rectangle of the layout frame, but that special-case is not
needed for the btlr direction.
Typing into the cell of the bugdoc now determines the paint rectangle
correctly, so the typed letters show up right after typing.
Change-Id: I48c75603963868591d72bf4d0e8dbba679f3b5e9
Reviewed-on: https://gerrit.libreoffice.org/70087
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/qa/extras/uiwriter/uiwriter2.cxx')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter2.cxx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 27b4a4716586..9655d1e9b80c 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -32,6 +32,7 @@ #include <swtypes.hxx> #include <fmtornt.hxx> #include <xmloff/odffields.hxx> +#include <txtfrm.hxx> namespace { @@ -69,6 +70,7 @@ public: void testCheckboxFormFieldInsertion(); void testDropDownFormFieldInsertion(); void testMixedFormFieldInsertion(); + void testTdf124261(); CPPUNIT_TEST_SUITE(SwUiWriterTest2); CPPUNIT_TEST(testRedlineMoveInsertInDelete); @@ -97,6 +99,7 @@ public: CPPUNIT_TEST(testCheckboxFormFieldInsertion); CPPUNIT_TEST(testDropDownFormFieldInsertion); CPPUNIT_TEST(testMixedFormFieldInsertion); + CPPUNIT_TEST(testTdf124261); CPPUNIT_TEST_SUITE_END(); virtual std::unique_ptr<Resetter> preTest(const char* filename) override @@ -1121,6 +1124,40 @@ void SwUiWriterTest2::testMixedFormFieldInsertion() CPPUNIT_ASSERT_EQUAL(sal_Int32(3), pMarkAccess->getAllMarksCount()); } +void SwUiWriterTest2::testTdf124261() +{ +#if !defined(WNT) + // Make sure that pressing a key in a btlr cell frame causes an immediate, correct repaint. + SwDoc* pDoc = createDoc("tdf124261.docx"); + SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); + SwFrame* pPageFrame = pLayout->GetLower(); + CPPUNIT_ASSERT(pPageFrame->IsPageFrame()); + + SwFrame* pBodyFrame = pPageFrame->GetLower(); + CPPUNIT_ASSERT(pBodyFrame->IsBodyFrame()); + + SwFrame* pTabFrame = pBodyFrame->GetLower(); + CPPUNIT_ASSERT(pTabFrame->IsTabFrame()); + + SwFrame* pRowFrame = pTabFrame->GetLower(); + CPPUNIT_ASSERT(pRowFrame->IsRowFrame()); + + SwFrame* pCellFrame = pRowFrame->GetLower(); + CPPUNIT_ASSERT(pCellFrame->IsCellFrame()); + + SwFrame* pFrame = pCellFrame->GetLower(); + CPPUNIT_ASSERT(pFrame->IsTextFrame()); + + // Make sure that the text frame's area and the paint rectangle match. + // Without the accompanying fix in place, this test would have failed with 'Expected: 1721; + // Actual: 1547', i.e. an area other than the text frame was invalidated for a single-line + // paragraph. + SwTextFrame* pTextFrame = static_cast<SwTextFrame*>(pFrame); + SwRect aRect = pTextFrame->GetPaintSwRect(); + CPPUNIT_ASSERT_EQUAL(pTextFrame->getFrameArea().Top(), aRect.Top()); +#endif +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest2); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |