diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2023-11-16 15:19:08 +0100 |
---|---|---|
committer | Regina Henschel <rb.henschel@t-online.de> | 2023-11-17 15:33:41 +0100 |
commit | 270b7efe92751a46c3d85e856b932a365c5f5b73 (patch) | |
tree | ea5db33aa01419be29d88198aab84bb775bf20c3 /oox/qa | |
parent | 5af2041c551e97903d2ba7994c5e893836891832 (diff) |
Add getUnicodeTokenName() to StaticTokenMap and use...
it in several places. Currently these places get a Sequence<sal_Int8>
by call of StaticTokenMap().getUtf8TokenName() and immediately after
that generate an OUString from it using reinterpret_cast<const char*>
and the OUString ctor with 8-Bit character buffer array. The patch
moves this conversion to StaticTokenMap.
Change-Id: Ia2af110e2a0f1708e0685115d325c1c12cab3857
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159514
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'oox/qa')
-rw-r--r-- | oox/qa/token/tokenmap-test.cxx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/oox/qa/token/tokenmap-test.cxx b/oox/qa/token/tokenmap-test.cxx index 058f7c16ebbf..e30b6aef806b 100644 --- a/oox/qa/token/tokenmap-test.cxx +++ b/oox/qa/token/tokenmap-test.cxx @@ -23,10 +23,12 @@ class TokenmapTest: public CppUnit::TestFixture { public: void test_roundTrip(); + void test_roundTripUnicode(); CPPUNIT_TEST_SUITE(TokenmapTest); CPPUNIT_TEST(test_roundTrip); + CPPUNIT_TEST(test_roundTripUnicode); CPPUNIT_TEST_SUITE_END(); private: @@ -46,6 +48,17 @@ void TokenmapTest::test_roundTrip() } } +void TokenmapTest::test_roundTripUnicode() +{ + for (sal_Int32 nToken = 0; nToken < XML_TOKEN_COUNT; ++nToken) + { + // check that the getIdentifier <-> getToken roundtrip works for OUString + OUString sName = tokenMap.getUnicodeTokenName(nToken); + sal_Int32 ret = oox::TokenMap::getTokenFromUnicode(sName); + CPPUNIT_ASSERT_EQUAL(ret, nToken); + } +} + CPPUNIT_TEST_SUITE_REGISTRATION(TokenmapTest); } |