summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/qa/cppunit/mnemonic.cxx21
-rw-r--r--vcl/source/window/mnemonic.cxx4
2 files changed, 20 insertions, 5 deletions
diff --git a/vcl/qa/cppunit/mnemonic.cxx b/vcl/qa/cppunit/mnemonic.cxx
index f377a2d1085a..fb8bc8c454ac 100644
--- a/vcl/qa/cppunit/mnemonic.cxx
+++ b/vcl/qa/cppunit/mnemonic.cxx
@@ -32,9 +32,24 @@ void VclMnemonicTest::testMnemonic()
{
MnemonicGenerator aGenerator;
- const sal_Unicode TEST[] = { 0x00DF, 'a' };
- OUString sResult = aGenerator.CreateMnemonic(OUString(TEST, SAL_N_ELEMENTS(TEST)));
- CPPUNIT_ASSERT_EQUAL(u'~', sResult[1]);
+ {
+ const sal_Unicode TEST[] = { 0x00DF, 'a' };
+ OUString sResult = aGenerator.CreateMnemonic(OUString(TEST, SAL_N_ELEMENTS(TEST)));
+ CPPUNIT_ASSERT_EQUAL(u'~', sResult[1]);
+ }
+
+ {
+ const sal_Unicode TEST[] = { 0x4E00, 'b' };
+ OUString sResult = aGenerator.CreateMnemonic(OUString(TEST, SAL_N_ELEMENTS(TEST)));
+ CPPUNIT_ASSERT_EQUAL(u'~', sResult[1]);
+ }
+
+ {
+ const sal_Unicode TEST[] = { 0x4E00 };
+ OUString sResult = aGenerator.CreateMnemonic(OUString(TEST, SAL_N_ELEMENTS(TEST)));
+ CPPUNIT_ASSERT_EQUAL(OUString("(~C)"), sResult.copy(sResult.getLength() - 4));
+ }
+
}
CPPUNIT_TEST_SUITE_REGISTRATION(VclMnemonicTest);
diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx
index b95f372f33c3..fe26cd14c152 100644
--- a/vcl/source/window/mnemonic.cxx
+++ b/vcl/source/window/mnemonic.cxx
@@ -253,14 +253,14 @@ OUString MnemonicGenerator::CreateMnemonic( const OUString& _rKey )
// Append Ascii Mnemonic
for ( c = MNEMONIC_RANGE_2_START; c <= MNEMONIC_RANGE_2_END; c++ )
{
- nMnemonicIndex = ImplGetMnemonicIndex(sal_Unicode(rtl::toAsciiUpperCase(c)));
+ nMnemonicIndex = ImplGetMnemonicIndex(c);
if ( nMnemonicIndex != MNEMONIC_INDEX_NOTFOUND )
{
if ( maMnemonics[nMnemonicIndex] )
{
maMnemonics[nMnemonicIndex] = 0;
OUString aStr = OUStringBuffer().
- append('(').append(MNEMONIC_CHAR).append(c).
+ append('(').append(MNEMONIC_CHAR).append(sal_Unicode(rtl::toAsciiUpperCase(c))).
append(')').makeStringAndClear();
nIndex = rKey.getLength();
if( nIndex >= 2 )