summaryrefslogtreecommitdiff
path: root/vcl/qa/cppunit/mnemonic.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-07-21 20:07:41 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-07-21 21:36:49 +0100
commit5488ff0be8ec4625822428781298ffb76ea84041 (patch)
treeeaa2afe1b982dd326ad5dc4e8c2bb0fc8626f4c9 /vcl/qa/cppunit/mnemonic.cxx
parent91795dfd726c76db03e5bc731608e7bff8eabacb (diff)
mnemonics in words with Eszett misplaced
because the text is normalized with toUpper and uppercase ß is SS and using the insertion index of the normalized string in the original string is out by one if we normalize with toLower then according to icu/source/data/unidata/SpecialCasing.txt then as long as the language is not Lithuanian its always one to one so just normalize to lower case with blank locale Change-Id: I0ad1c7e2ad0216b7c27ec62105f9a25672ade8a8
Diffstat (limited to 'vcl/qa/cppunit/mnemonic.cxx')
-rw-r--r--vcl/qa/cppunit/mnemonic.cxx42
1 files changed, 42 insertions, 0 deletions
diff --git a/vcl/qa/cppunit/mnemonic.cxx b/vcl/qa/cppunit/mnemonic.cxx
new file mode 100644
index 000000000000..1e5ec74c1ec8
--- /dev/null
+++ b/vcl/qa/cppunit/mnemonic.cxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <cppunit/TestAssert.h>
+#include <cppunit/TestFixture.h>
+
+#include <osl/file.hxx>
+#include <osl/process.h>
+
+#include <vcl/mnemonic.hxx>
+
+class VclMnemonicTest : public test::BootstrapFixture
+{
+public:
+ VclMnemonicTest() : BootstrapFixture(true, false) {}
+
+ void testMnemonic();
+
+ CPPUNIT_TEST_SUITE(VclMnemonicTest);
+ CPPUNIT_TEST(testMnemonic);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+void VclMnemonicTest::testMnemonic()
+{
+ MnemonicGenerator aGenerator;
+ OUString sResult = aGenerator.CreateMnemonic(OUString::fromUtf8(u8"ßa"));
+ CPPUNIT_ASSERT_EQUAL(sResult[1], sal_Unicode('~'));
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(VclMnemonicTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */