add test for CJK (~X) mnemonics
Change-Id: I1f69c23dcde6d963ad9c3bc1f2d9178fe15eb27c
This commit is contained in:
@@ -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);
|
||||
|
@@ -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 )
|
||||
|
Reference in New Issue
Block a user