[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - editeng/source sw/qa

Caolán McNamara caolanm at redhat.com
Fri Nov 6 01:07:15 PST 2015


 editeng/source/misc/svxacorr.cxx     |   34 +++++++++++++++++++++-------------
 sw/qa/extras/inc/swmodeltestbase.hxx |   12 +++++++++---
 sw/qa/extras/uiwriter/uiwriter.cxx   |    5 +++--
 3 files changed, 33 insertions(+), 18 deletions(-)

New commits:
commit de1cb4039756f71d848297981b757c1cfa4609b1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 23 09:11:56 2015 +0100

    Resolves: tdf#76964 fall back to primary language via getLanguage
    
    instead of bittwiddling which ends up trying to resolve the
    system language
    
    (cherry picked from commit a1ff0745cc4f78777e8dba1e7bb52d18386d7394)
    
    more tdf#76964 fall back to primary language via getLanguage
    
    (cherry picked from commit 97893e56e61a466e56d12ee46d11f6e4c32a737b)
    
    sw: fix SwUiWriterTest pointlessly loading an "empty.odt" ...
    
    ... instead of just creating a new document.
    
    (cherry picked from commit 98ddd7a32fd0d5fa080fac368b9dc53a06659285)
    
    Change-Id: I545bd5e39f99003ddedf3c90031e8b818edc1de2
    Reviewed-on: https://gerrit.libreoffice.org/19545
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 10426e1..03b0733 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1729,10 +1729,8 @@ const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList(
     }
 
     // If it still could not be found here, then keep on searching
-
     LanguageType eLang = aLanguageTag.getLanguageType();
-    LanguageType nTmpKey1 = eLang & 0x7ff, // the main language in many cases DE
-                 nTmpKey2 = eLang & 0x3ff; // otherwise for example EN
+    LanguageType nTmpKey1 = eLang & 0x7ff; // the main language in many cases DE
     if(nTmpKey1 != eLang && (pLangTable->find(aLanguageTag.reset(nTmpKey1)) != pLangTable->end() ||
                 CreateLanguageFile(aLanguageTag, false)))
     {
@@ -1746,8 +1744,12 @@ const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList(
         }
     }
 
-    if(nTmpKey2 != eLang && (pLangTable->find(aLanguageTag.reset(nTmpKey2)) != pLangTable->end() ||
-                CreateLanguageFile(aLanguageTag, false)))
+    // otherwise for example EN
+    aLanguageTag.reset(aLanguageTag.getLanguage());
+    LanguageType nTmpKey2 = aLanguageTag.getLanguageType(false);
+    if (nTmpKey2 != eLang && nTmpKey2 != LANGUAGE_UNDETERMINED &&
+                (pLangTable->find(aLanguageTag) != pLangTable->end() ||
+                 CreateLanguageFile(aLanguageTag, false)))
     {
         //the language is available - so bring it on
         SvxAutoCorrectLanguageLists* pList = pLangTable->find(aLanguageTag)->second;
@@ -1783,8 +1785,7 @@ bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang,
 
     // First search for eLang, then US-English -> English
     // and last in LANGUAGE_UNDETERMINED
-    LanguageType nTmpKey1 = eLang & 0x7ff, // the main language in many cases DE
-                 nTmpKey2 = eLang & 0x3ff; // otherwise for example EN
+    LanguageType nTmpKey1 = eLang & 0x7ff; // the main language in many cases DE
     OUString sTemp(sWord);
 
     if(pLangTable->find(aLanguageTag) != pLangTable->end() || CreateLanguageFile(aLanguageTag, false))
@@ -1806,8 +1807,12 @@ bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang,
             return true;
     }
 
-    if(nTmpKey2 != eLang && (pLangTable->find(aLanguageTag.reset(nTmpKey2)) != pLangTable->end() ||
-                CreateLanguageFile(aLanguageTag, false)))
+    // otherwise for example EN
+    aLanguageTag.reset(aLanguageTag.getLanguage());
+    LanguageType nTmpKey2 = aLanguageTag.getLanguageType(false);
+    if (nTmpKey2 != eLang && nTmpKey2 != LANGUAGE_UNDETERMINED &&
+                (pLangTable->find(aLanguageTag) != pLangTable->end() ||
+                 CreateLanguageFile(aLanguageTag, false)))
     {
         //the language is available - so bring it on
         SvxAutoCorrectLanguageLists* pList = pLangTable->find(aLanguageTag)->second;
@@ -1869,8 +1874,7 @@ bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang,
 
     // First search for eLang, then US-English -> English
     // and last in LANGUAGE_UNDETERMINED
-    LanguageType nTmpKey1 = eLang & 0x7ff, // the main language in many cases DE
-                 nTmpKey2 = eLang & 0x3ff; // otherwise for example EN
+    LanguageType nTmpKey1 = eLang & 0x7ff; // the main language in many cases DE
     OUString sTemp( sWord );
 
     if(pLangTable->find(aLanguageTag) != pLangTable->end() || CreateLanguageFile(aLanguageTag, false))
@@ -1890,8 +1894,12 @@ bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang,
             return true;
     }
 
-    if(nTmpKey2 != eLang && (pLangTable->find(aLanguageTag.reset(nTmpKey2)) != pLangTable->end() ||
-                CreateLanguageFile(aLanguageTag, false)))
+    // otherwise for example EN
+    aLanguageTag.reset(aLanguageTag.getLanguage());
+    LanguageType nTmpKey2 = aLanguageTag.getLanguageType(false);
+    if (nTmpKey2 != eLang && nTmpKey2 != LANGUAGE_UNDETERMINED &&
+                (pLangTable->find(aLanguageTag) != pLangTable->end() ||
+                 CreateLanguageFile(aLanguageTag, false)))
     {
         //the language is available - so bring it on
         const SvStringsISortDtor* pList = pLangTable->find(aLanguageTag)->second->GetCplSttExceptList();
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index a3bda09..6b91c23 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -572,14 +572,20 @@ protected:
 
     void load(const char* pDir, const char* pName)
     {
+        return loadURL(getURLFromSrc(pDir) + OUString::createFromAscii(pName), pName);
+    }
+
+    void loadURL(OUString const& rURL, const char* pName)
+    {
         if (mxComponent.is())
             mxComponent->dispose();
         // Output name early, so in the case of a hang, the name of the hanging input file is visible.
-        std::cout << pName << ",";
+        if (pName)
+            std::cout << pName << ",";
         mnStartTime = osl_getGlobalTimer();
-        mxComponent = loadFromDesktop(getURLFromSrc(pDir) + OUString::createFromAscii(pName), "com.sun.star.text.TextDocument");
+        mxComponent = loadFromDesktop(rURL, "com.sun.star.text.TextDocument");
         discardDumpedLayout();
-        if (mustCalcLayoutOf(pName))
+        if (pName && mustCalcLayoutOf(pName))
             calcLayout();
     }
 
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 364439b..9d0d1b1 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -156,8 +156,9 @@ private:
 SwDoc* SwUiWriterTest::createDoc(const char* pName)
 {
     if (!pName)
-        pName = "empty.odt";
-    load(DATA_DIRECTORY, pName);
+        loadURL("private:factory/swriter", nullptr);
+    else
+        load(DATA_DIRECTORY, pName);
 
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);


More information about the Libreoffice-commits mailing list