i18npool/qa/cppunit/test_characterclassification.cxx | 49 ++++++++++++++----- 1 file changed, 37 insertions(+), 12 deletions(-)
New commits: commit c728b15cbad331f8be545d6b4aad167c1244f3d0 Author: Khaled Hosny <[email protected]> AuthorDate: Mon Jul 24 03:46:20 2023 +0300 Commit: خالد حسني <[email protected]> CommitDate: Mon Jul 24 07:35:29 2023 +0200 i18npool: Add a test for sigma case folding This is one of the special case folding characters. Change-Id: Icfe986b216eb62ed595402b31908c2fd22cd475e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154821 Tested-by: Jenkins Reviewed-by: خالد حسني <[email protected]> diff --git a/i18npool/qa/cppunit/test_characterclassification.cxx b/i18npool/qa/cppunit/test_characterclassification.cxx index 7a66b0db361b..dc8b361fc53c 100644 --- a/i18npool/qa/cppunit/test_characterclassification.cxx +++ b/i18npool/qa/cppunit/test_characterclassification.cxx @@ -81,6 +81,40 @@ CPPUNIT_TEST_FIXTURE(TestCharacterClassification, testStringType) } +CPPUNIT_TEST_FIXTURE(TestCharacterClassification, testSigma) +{ + { + // From upper case + OUString sTest(u"ὈΔΥΣΣΕΎΣ"); + OUString sLowerCase = m_xCC->toLower(sTest, 0, sTest.getLength(), {}); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be lower", OUString(u"ὀδυσσεύς"), sLowerCase); + OUString sUpperCase = m_xCC->toUpper(sLowerCase, 0, sLowerCase.getLength(), {}); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be upper", sTest, sUpperCase); + } + + { + // From lower case + OUString sTest(u"ὀδυσσεύς"); + OUString sTitleCase = m_xCC->toTitle(sTest, 0, sTest.getLength(), {}); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be title", OUString(u"Ὀδυσσεύς"), sTitleCase); + OUString sUpperCase = m_xCC->toUpper(sTest, 0, sTest.getLength(), {}); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be upper", OUString(u"ὈΔΥΣΣΕΎΣ"), sUpperCase); + OUString sLowerCase = m_xCC->toLower(sUpperCase, 0, sUpperCase.getLength(), {}); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be lower", sTest, sLowerCase); + } + + { + // From title case + OUString sTest(u"Ὀδυσσεύς"); + OUString sTitleCase = m_xCC->toTitle(sTest, 0, sTest.getLength(), {}); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be title", OUString(u"Ὀδυσσεύς"), sTitleCase); + OUString sUpperCase = m_xCC->toUpper(sTest, 0, sTest.getLength(), {}); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be upper", OUString(u"ὈΔΥΣΣΕΎΣ"), sUpperCase); + OUString sLowerCase = m_xCC->toLower(sTest, 0, sTest.getLength(), {}); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be lower", OUString(u"ὀδυσσεύς"), sLowerCase); + } +} + void TestCharacterClassification::setUp() { BootstrapFixtureBase::setUp(); commit 9d6134508405a403612a3463bae3fadcceec9245 Author: Khaled Hosny <[email protected]> AuthorDate: Sun Jul 23 14:20:29 2023 +0300 Commit: خالد حسني <[email protected]> CommitDate: Mon Jul 24 07:35:22 2023 +0200 CppunitTest_i18npool_characterclassification: use CPPUNIT_TEST_FIXTURE() Change-Id: I6cc87255af385116b7e86ceaea67b26ca1f44709 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154806 Tested-by: Jenkins Reviewed-by: خالد حسني <[email protected]> diff --git a/i18npool/qa/cppunit/test_characterclassification.cxx b/i18npool/qa/cppunit/test_characterclassification.cxx index 846477d615f1..7a66b0db361b 100644 --- a/i18npool/qa/cppunit/test_characterclassification.cxx +++ b/i18npool/qa/cppunit/test_characterclassification.cxx @@ -19,21 +19,14 @@ public: virtual void setUp() override; virtual void tearDown() override; - void testTitleCase(); - void testStringType(); - - CPPUNIT_TEST_SUITE(TestCharacterClassification); - CPPUNIT_TEST(testTitleCase); - CPPUNIT_TEST(testStringType); - CPPUNIT_TEST_SUITE_END(); -private: +protected: uno::Reference<i18n::XCharacterClassification> m_xCC; }; //A test to ensure that our Title Case functionality is working //http://lists.freedesktop.org/archives/libreoffice/2012-June/032767.html //https://bz.apache.org/ooo/show_bug.cgi?id=30863 -void TestCharacterClassification::testTitleCase() +CPPUNIT_TEST_FIXTURE(TestCharacterClassification, testTitleCase) { lang::Locale aLocale; aLocale.Language = "en"; @@ -66,7 +59,7 @@ void TestCharacterClassification::testTitleCase() } //https://bugs.libreoffice.org/show_bug.cgi?id=69641 -void TestCharacterClassification::testStringType() +CPPUNIT_TEST_FIXTURE(TestCharacterClassification, testStringType) { lang::Locale aLocale; aLocale.Language = "en"; @@ -100,8 +93,6 @@ void TestCharacterClassification::tearDown() m_xCC.clear(); } -CPPUNIT_TEST_SUITE_REGISTRATION(TestCharacterClassification); - CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
