Makefile.in | 2 cui/source/tabpages/page.src | 4 - editeng/CppunitTest_editeng_core.mk | 1 editeng/qa/unit/core-test.cxx | 116 ++++++++++++++++++++++++++++++++++++ editeng/source/misc/svxacorr.cxx | 13 ++-- solenv/bin/callcatcher.Makefile | 12 --- sw/source/filter/ww8/ww8graf.cxx | 5 + vcl/unx/generic/printer/cupsmgr.cxx | 5 + 8 files changed, 137 insertions(+), 21 deletions(-)
New commits: commit a526370737099b57b399f2ca8de43e74e24ab794 Author: Caolán McNamara <[email protected]> Date: Fri Mar 1 10:50:11 2013 +0000 Related: fdo#55693 add regression tests for autocorrection Change-Id: Ie9bbeb38ec9cc2fa0377709e75abb0338b20bab5 diff --git a/editeng/CppunitTest_editeng_core.mk b/editeng/CppunitTest_editeng_core.mk index 6db6082..d8ede2e 100644 --- a/editeng/CppunitTest_editeng_core.mk +++ b/editeng/CppunitTest_editeng_core.mk @@ -81,6 +81,7 @@ $(eval $(call gb_CppunitTest_use_components,editeng_core,\ configmgr/source/configmgr \ framework/util/fwk \ i18npool/util/i18npool \ + linguistic/source/lng \ sfx2/util/sfx \ ucb/source/core/ucb1 \ ucb/source/ucp/file/ucpfile1 \ diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx index a43dcaa..dd4711c 100644 --- a/editeng/qa/unit/core-test.cxx +++ b/editeng/qa/unit/core-test.cxx @@ -38,6 +38,7 @@ #include "editeng/eeitem.hxx" #include "editeng/editids.hrc" #include "editeng/editdoc.hxx" +#include "editeng/svxacorr.hxx" #include "editeng/unofield.hxx" #include <com/sun/star/text/textfield/Type.hpp> @@ -61,9 +62,15 @@ public: */ void testUnoTextFields(); + /** + * AutoCorrect tests + */ + void testAutocorrect(); + CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testConstruction); CPPUNIT_TEST(testUnoTextFields); + CPPUNIT_TEST(testAutocorrect); CPPUNIT_TEST_SUITE_END(); private: @@ -221,6 +228,115 @@ void Test::testUnoTextFields() } } +class TestAutoCorrDoc : public SvxAutoCorrDoc +{ +public: + TestAutoCorrDoc(const OUString &rText, LanguageType eLang) + : m_sText(rText) + , m_eLang(eLang) + { + } + OUString getResult() const + { + return m_sText.toString(); + } +private: + OUStringBuffer m_sText; + LanguageType m_eLang; + virtual sal_Bool Delete( xub_StrLen nStt, xub_StrLen nEnd ) + { + //fprintf(stderr, "TestAutoCorrDoc::Delete\n"); + m_sText.remove(nStt, nEnd-nStt); + return true; + } + virtual sal_Bool Insert( xub_StrLen nPos, const String& rTxt ) + { + //fprintf(stderr, "TestAutoCorrDoc::Insert\n"); + m_sText.insert(nPos, rTxt); + return true; + } + virtual sal_Bool Replace( xub_StrLen nPos, const String& rTxt ) + { + //fprintf(stderr, "TestAutoCorrDoc::Replace\n"); + return ReplaceRange( nPos, rTxt.Len(), rTxt ); + } + virtual sal_Bool ReplaceRange( xub_StrLen nPos, xub_StrLen nLen, const String& rTxt ) + { + //fprintf(stderr, "TestAutoCorrDoc::ReplaceRange %d %d %s\n", nPos, nLen, OUStringToOString(rTxt, RTL_TEXTENCODING_UTF8).getStr()); + m_sText.remove(nPos, nLen); + m_sText.insert(nPos, rTxt); + return true; + } + virtual sal_Bool SetAttr( xub_StrLen, xub_StrLen, sal_uInt16, SfxPoolItem& ) + { + //fprintf(stderr, "TestAutoCorrDoc::SetAttr\n"); + return true; + } + virtual sal_Bool SetINetAttr( xub_StrLen, xub_StrLen, const String& ) + { + //fprintf(stderr, "TestAutoCorrDoc::SetINetAttr\n"); + return true; + } + virtual const String* GetPrevPara( sal_Bool ) + { + //fprintf(stderr, "TestAutoCorrDoc::GetPrevPara\n"); + return NULL; + } + virtual sal_Bool ChgAutoCorrWord( sal_uInt16& rSttPos, + sal_uInt16 nEndPos, SvxAutoCorrect& rACorrect, + const String** ppPara ) + { + //fprintf(stderr, "TestAutoCorrDoc::ChgAutoCorrWord\n"); + + if (m_sText.isEmpty()) + return false; + + const SvxAutocorrWord* pFnd = rACorrect.SearchWordsInList(m_sText.toString(), rSttPos, nEndPos, *this, m_eLang); + if (pFnd && pFnd->IsTextOnly()) + { + m_sText.remove(rSttPos, nEndPos); + m_sText.insert(rSttPos, pFnd->GetLong()); + if( ppPara ) + *ppPara = NULL;//&pCurNode->GetString(); + return true; + } + + return false; + } +}; + +//https://bugs.freedesktop.org/show_bug.cgi?id=55693 +//Two capitalized letters are not corrected if dash or slash are directly +//before the two letters +void Test::testAutocorrect() +{ + OUString sShareAutocorrFile; + OUString sUserAutocorrFile; + SvxAutoCorrect aAutoCorrect(sShareAutocorrFile, sUserAutocorrFile); + + { + OUString sInput("TEst-TEst"); + sal_Unicode cNextChar(' '); + OUString sExpected("Test-Test "); + + TestAutoCorrDoc aFoo(sInput, LANGUAGE_ENGLISH_US); + aAutoCorrect.AutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true); + + CPPUNIT_ASSERT_MESSAGE("autocorrect", aFoo.getResult() == sExpected); + } + + { + OUString sInput("TEst/TEst"); + sal_Unicode cNextChar(' '); + OUString sExpected("Test/Test "); + + TestAutoCorrDoc aFoo(sInput, LANGUAGE_ENGLISH_US); + aAutoCorrect.AutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true); + + CPPUNIT_ASSERT_MESSAGE("autocorrect", aFoo.getResult() == sExpected); + } +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); } diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index e0a0180..fb05f4d 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -1458,12 +1458,15 @@ sal_uLong SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, if( nHelpId ) { - nHelpId -= 1; - Application::GetHelp()->OpenHelpAgent( aHelpIds[nHelpId] ); + Help* pHelp = Application::GetHelp(); + if (pHelp) + { + nHelpId -= 1; + Application::GetHelp()->OpenHelpAgent( aHelpIds[nHelpId] ); + } } } - return nRet; } commit 4a05ab1dd4c7da10810fec9948b2de76b7bdd0b6 Author: Caolán McNamara <[email protected]> Date: Fri Mar 1 09:35:12 2013 +0000 Resolves: #i120028# SvxBorderLine leak Change-Id: I652653ae8a99b8486e893c65b6c82b6ea6e4faec diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 4001639..599b1ac 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -1560,7 +1560,10 @@ sal_Int32 SwWW8ImplReader::MatchSdrBoxIntoFlyBoxItem(const Color& rLineColor, aLine.SetBorderLineStyle(nIdx); for(sal_uInt16 nLine = 0; nLine < 4; ++nLine) - rBox.SetLine(new SvxBorderLine( aLine ), nLine); + { + //aLine is cloned by SetLine + rBox.SetLine(&aLine, nLine); + } } return nOutsideThick; commit 1bb8ae7a52564ec8b3d08ffe2175e466a02cfd76 Author: Caolán McNamara <[email protected]> Date: Fri Mar 1 07:48:49 2013 +0000 fix higher debug level build Change-Id: I1c0fb9a3c36708159495af6ac08f1e66074fc029 diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx index 4a4700a..e087264 100644 --- a/vcl/unx/generic/printer/cupsmgr.cxx +++ b/vcl/unx/generic/printer/cupsmgr.cxx @@ -894,7 +894,10 @@ const char* CUPSManager::authenticateUser( const char* /*pIn*/ ) osl_unloadModule( pLib ); } #if OSL_DEBUG_LEVEL > 1 - else fprintf( stderr, "loading of module %s failed\n", OUStringToOString( aLib, osl_getThreadTextEncoding() ).getStr() ); + else + { + fprintf( stderr, "loading of module %s failed\n", _XSALSET_LIBNAME ); + } #endif return pRet; commit 4e1dd61364d6f158ed18660a0389ceff61007197 Author: Caolán McNamara <[email protected]> Date: Thu Feb 28 23:28:49 2013 +0000 reduce callcatcher call post dmake death Change-Id: I05a68199c606c815ab007cb662c0b29053eb3609 diff --git a/Makefile.in b/Makefile.in index df98339..13a635f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -336,7 +336,7 @@ findunusedcode: @echo unexport CFLAGS >> $(SRCDIR)/config_host_callcatcher.mk @echo unexport CXXFLAGS >> $(SRCDIR)/config_host_callcatcher.mk @mkdir -p $(SRCDIR)/solenv/callcatcher/bin && \ - @$(GNUMAKE) -f $(SOLARENV)/bin/callcatcher.Makefile findunusedcode + $(GNUMAKE) -f $(SOLARENV)/bin/callcatcher.Makefile findunusedcode @grep ::.*\( unusedcode.all \ | grep -v ^Atom \ | grep -v ^atom:: \ diff --git a/solenv/bin/callcatcher.Makefile b/solenv/bin/callcatcher.Makefile index f915750..c88b173 100644 --- a/solenv/bin/callcatcher.Makefile +++ b/solenv/bin/callcatcher.Makefile @@ -18,13 +18,6 @@ export AR:=callarchive ar else export AR:=callarchive $(AR) endif -#old-school ones, can go post-gbuildification is complete -export LINK:=$(CXX) -ifeq ($(LIBMGR),) -export LIBMGR:=callarchive ar -else -export LIBMGR:=callarchive $(LIBMGR) -endif export dbglevel:=2 include $(SOLARENV)/gbuild/gbuild.mk @@ -33,9 +26,6 @@ findunusedcode: $(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS) -f Makefile.build ooinstall -l $(DEVINSTALLDIR)/opt $(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS) -f Makefile.build subsequentcheck - callanalyse \ - $(WORKDIR)/LinkTarget/*/* \ - */$(OUTPATH)/bin/* \ - */$(OUTPATH)/lib/* > unusedcode.all + callanalyse $(WORKDIR)/LinkTarget/*/* > unusedcode.all # vim: set noet sw=4 ts=4: commit b458e734fda37a01db36ed59127984d65f12a883 Author: Caolán McNamara <[email protected]> Date: Thu Feb 28 23:10:33 2013 +0000 vector::at on guaranteed in-bounds values Change-Id: I6ca8ec182e4c68f4cc29c7669168b513cdf148bd diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 2880651..e0a0180 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -393,8 +393,8 @@ sal_Bool SvxAutoCorrect::FnCptlSttWrd( SvxAutoCorrDoc& rDoc, const String& rTxt, // Two capital letters at the beginning of word? for(n = 0; n < aDelimiters.size() - 1; n++) { - nSttPos = aDelimiters.at( n ); - nEndPos = aDelimiters.at( n + 1 ); + nSttPos = aDelimiters[n]; + nEndPos = aDelimiters[n + 1]; if( nSttPos+2 < nEndPos && IsUpperLetter( rCC.getCharacterType( rTxt, nSttPos )) && commit 891a99ce9f5396e752e389d994f794af97dddef6 Author: Caolán McNamara <[email protected]> Date: Thu Feb 28 22:44:01 2013 +0000 Monarch is apparently #7 3/4 not #8 Change-Id: I1664065e9fee3db5b900051ea3bf086c61ef0cee diff --git a/cui/source/tabpages/page.src b/cui/source/tabpages/page.src index 96acd3f..0d2234a 100644 --- a/cui/source/tabpages/page.src +++ b/cui/source/tabpages/page.src @@ -48,8 +48,8 @@ StringArray RID_SVXSTRARY_PAPERSIZE_STD < "C6/5 Envelope" ; PAPERSIZE_C65 ; > ; < "C5 Envelope" ; PAPERSIZE_C5 ; > ; < "C4 Envelope" ; PAPERSIZE_C4 ; > ; - < "#6 3/4 (Personal) Envelope" ; PAPERSIZE_COM675; > ; - < "#8 (Monarch) Envelope" ; PAPERSIZE_MONARCH; > ; + < "#6¾ Envelope" ; PAPERSIZE_COM675; > ; + < "#7¾ (Monarch) Envelope" ; PAPERSIZE_MONARCH; > ; < "#9 Envelope" ; PAPERSIZE_COM9; > ; < "#10 Envelope" ; PAPERSIZE_COM10; > ; < "#11 Envelope" ; PAPERSIZE_COM11; > ;
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
