vcl/qa/cppunit/mnemonic.cxx    |    2 ++
 vcl/source/window/mnemonic.cxx |    2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit dd4c66095790993b0ba6a50a17ffff2908ac00cb
Author:     xuenhua <xuenhua2...@sina.com>
AuthorDate: Fri Apr 29 12:34:28 2022 +0800
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sat Apr 30 22:48:21 2022 +0200

    Fix Method EraseAllMnemonicChars bug
    
    MNEMONIC_RANGE_2_START and MNEMONIC_RANGE_2_END defined in 
'core/include/vcl/mnemonic.hxx'  are 'a' and 'z'
    This variable c is UpperCase, should be converted to lowercase, and 
thencompare with MNEMONIC_RANGE_2_START and MNEMONIC_RANGE_2_END.
    
    Change-Id: I721e293e88bf1b8260b7ea2dc39ae6a7fd4f3d79
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133587
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133619

diff --git a/vcl/qa/cppunit/mnemonic.cxx b/vcl/qa/cppunit/mnemonic.cxx
index ed4c8a86f61e..5a2131da2e3b 100644
--- a/vcl/qa/cppunit/mnemonic.cxx
+++ b/vcl/qa/cppunit/mnemonic.cxx
@@ -49,6 +49,8 @@ void VclMnemonicTest::testMnemonic()
         static constexpr OUStringLiteral TEST = u"\u4E00";
         OUString sResult = aGenerator.CreateMnemonic(TEST);
         CPPUNIT_ASSERT_EQUAL(OUString("(~C)"), 
sResult.copy(sResult.getLength() - 4));
+        sResult = MnemonicGenerator::EraseAllMnemonicChars(sResult);
+        CPPUNIT_ASSERT_EQUAL(OUString(TEST), sResult);
     }
 }
 
diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx
index d412b2ad4071..6e4b155c2af5 100644
--- a/vcl/source/window/mnemonic.cxx
+++ b/vcl/source/window/mnemonic.cxx
@@ -322,7 +322,7 @@ OUString MnemonicGenerator::EraseAllMnemonicChars( const 
OUString& rStr )
             // check for CJK-style mnemonic
             if( i > 0 && (i+2) < nLen )
             {
-                sal_Unicode c = sal_Unicode(rtl::toAsciiUpperCase(aStr[i+1]));
+                sal_Unicode c = sal_Unicode(rtl::toAsciiLowerCase(aStr[i+1]));
                 if( aStr[ i-1 ] == '(' &&
                     aStr[ i+2 ] == ')' &&
                     c >= MNEMONIC_RANGE_2_START && c <= MNEMONIC_RANGE_2_END )

Reply via email to