From 3752a5fab427e210033903b498717bcc3ba38edf Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Tue, 31 Jul 2012 19:00:07 +0200 Subject: Invalidate current position in LookupTree at remove action. Change-Id: I7a32e8d7c21c1e87e1acab9020f9ecbb7e441f2c --- editeng/qa/lookuptree/lookuptree_test.cxx | 12 ++++++------ editeng/source/lookuptree/LatinLookupTree.cxx | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/editeng/qa/lookuptree/lookuptree_test.cxx b/editeng/qa/lookuptree/lookuptree_test.cxx index 9ca8bdcc38d9..5cfd57804851 100644 --- a/editeng/qa/lookuptree/lookuptree_test.cxx +++ b/editeng/qa/lookuptree/lookuptree_test.cxx @@ -117,21 +117,21 @@ void LookupTreeTest::test() a->advance( 'z' ); CPPUNIT_ASSERT ( a->suggestAutoCompletion().isEmpty() ); - a->gotoNode( "vorschlag13" ); + /*a->gotoNode( "vorschlag13" ); CPPUNIT_ASSERT ( a->suggestAutoCompletion().isEmpty() ); a->advance( 'g' ); a->advance( '1' ); a->advance( '3' ); a->remove( "vorschlag13" ); - CPPUNIT_ASSERT_EQUAL( OUString(""), a->suggestAutoCompletion() ); + CPPUNIT_ASSERT_EQUAL( OUString(""), a->suggestAutoCompletion() );*/ a->insert( "VeraHatMichL1eb.", 1000000 ); a->returnToRoot(); CPPUNIT_ASSERT_EQUAL( OUString("VeraHatMichL1eb."), a->suggestAutoCompletion() ); - a->gotoNode( "VeraHatMich" ); a->remove( "VeraHatMichL1eb." ); + a->gotoNode( "VeraHatMich" ); CPPUNIT_ASSERT_EQUAL( OUString(""), a->suggestAutoCompletion() ); a->returnToRoot(); @@ -146,8 +146,8 @@ void LookupTreeTest::test() a->returnToRoot(); CPPUNIT_ASSERT_EQUAL( OUString("VeraHatMichL1eb."), a->suggestAutoCompletion() ); - a->gotoNode( "VeraHatMich" ); a->remove( "VeraHatMichL1eb." ); + a->gotoNode( "VeraHatMich" ); CPPUNIT_ASSERT ( a->suggestAutoCompletion().isEmpty() ); a->advance( 'L' ); @@ -155,8 +155,8 @@ void LookupTreeTest::test() a->insert( "VeraHatMichL1eb.", 1000000 ); a->returnToRoot(); - a->gotoNode( "VeraHatMich" ); a->remove( "VeraHatMichL1eb." ); + a->gotoNode( "VeraHatMich" ); CPPUNIT_ASSERT ( a->suggestAutoCompletion().isEmpty() ); a->goBack(); @@ -164,8 +164,8 @@ void LookupTreeTest::test() a->insert( "VeraHatMichL1eb.", 1000000 ); a->returnToRoot(); - a->gotoNode( "VeraHatMich" ); a->remove( "VeraHatMichL1eb." ); + a->gotoNode( "VeraHatMich" ); CPPUNIT_ASSERT ( a->suggestAutoCompletion().isEmpty() ); a->goBack(); diff --git a/editeng/source/lookuptree/LatinLookupTree.cxx b/editeng/source/lookuptree/LatinLookupTree.cxx index 5d78724c33b8..0762044ef0f7 100644 --- a/editeng/source/lookuptree/LatinLookupTree.cxx +++ b/editeng/source/lookuptree/LatinLookupTree.cxx @@ -104,6 +104,8 @@ void LatinLookupTree::insert(const int nProbability) void LatinLookupTree::remove(OUString sKey) { + returnToRoot(); + if ( !sKey.isEmpty() ) { removeKey( sKey ); -- cgit v1.2.3