summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-02-21 21:22:15 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-02-22 13:33:24 +0100
commit31f896bb6ef922cf4250c6b971fb9d24a60592b5 (patch)
tree27056bd3ee648d1f97d0afdcb0c3370f67bf048e /sw/qa
parentbde5a8623262e50c12a073eb5a78c95211a650a3 (diff)
sw btlr writing mode shell: fix up/down cursor travelling
By teaching SwEditWin::KeyInput() about 2 vertical modes: the existing tbrl one and the new btlr one. Up now correctly goes to the next character and down to the previous one. Change-Id: I71faebe62e5fa3892b37e8bea6c15d1fb84df5d1 Reviewed-on: https://gerrit.libreoffice.org/68183 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/layout/layout.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index cb94560ab03a..a1f805d42bd9 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -14,10 +14,13 @@
#include <officecfg/Office/Common.hxx>
#include <comphelper/scopeguard.hxx>
#include <unotools/syslocaleoptions.hxx>
+#include <vcl/scheduler.hxx>
#include <fmtanchr.hxx>
#include <fmtfsize.hxx>
#include <fmtcntnt.hxx>
#include <wrtsh.hxx>
+#include <edtwin.hxx>
+#include <view.hxx>
static char const DATA_DIRECTORY[] = "/sw/qa/extras/layout/data/";
@@ -2836,6 +2839,16 @@ void SwLayoutWriter::testBtlrCell()
// range was 2273 -> 2835, the good vertical position is 2730, the bad one was 1830.
CPPUNIT_ASSERT_GREATER(nFirstParaMiddle, rCharRect.Top());
CPPUNIT_ASSERT_LESS(nFirstParaBottom, rCharRect.Top());
+
+ // Test that pressing "up" at the start of the cell goes to the next character position.
+ sal_Int32 nIndex = pWrtShell->GetCursor()->Start()->nContent.GetIndex();
+ KeyEvent aKeyEvent(0, KEY_UP);
+ SwEditWin& rEditWin = pShell->GetView()->GetEditWin();
+ rEditWin.KeyInput(aKeyEvent);
+ Scheduler::ProcessEventsToIdle();
+ // Without the accompanying fix in place, this test would have failed: "up" was interpreted as
+ // logical "left", which does nothing if you're at the start of the text anyway.
+ CPPUNIT_ASSERT_EQUAL(nIndex + 1, pWrtShell->GetCursor()->Start()->nContent.GetIndex());
#endif
}