From 3efdd925e0ae1c080fbef3f1f79865eb6e172c68 Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Tue, 21 Feb 2017 12:48:33 +0900 Subject: tdf#106116 "Previous Marker" changes selection only when needed This fixes a hang caused by repeated Shift+F4. Although it seems a regression from 2af1f5691e8d64afd5246d245d7876b5a2cd5cd8, the original code of SmEditWindow::SelPrevMark() had been doomed due to conditional loop depending on obscure signed/unsigned conversion. Change-Id: I61f630eec44b285dc1f1c27097acde4b48ed2991 Reviewed-on: https://gerrit.libreoffice.org/34503 Tested-by: Jenkins Reviewed-by: Takeshi Abe --- starmath/qa/cppunit/test_starmath.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'starmath/qa') diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx index 09f9abd637fa..a6916bf521bf 100644 --- a/starmath/qa/cppunit/test_starmath.cxx +++ b/starmath/qa/cppunit/test_starmath.cxx @@ -133,6 +133,14 @@ void Test::editMarker() m_pEditWindow->Delete(); m_pEditWindow->InsertText("b"); + // tdf#106116: should be safe i.e. do nothing + m_pEditWindow->SelPrevMark(); + auto aSelection = m_pEditWindow->GetSelection(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aSelection.nStartPara); + CPPUNIT_ASSERT_EQUAL(sal_Int32(9), aSelection.nStartPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aSelection.nEndPara); + CPPUNIT_ASSERT_EQUAL(sal_Int32(9), aSelection.nEndPos); + m_pEditWindow->Flush(); OUString sFinalText = m_pEditWindow->GetText(); CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be a under b under c", sTargetText, sFinalText); -- cgit