tdf#132853 - UI: fix different sizes in Image tabs Type & Crop
[LibreOffice.git] / unotools / qa / unit / testGetEnglishSearchName.cxx
bloba33f4d96bd25b7fb7e65eb232b751c6ec8dc6cae
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 */
11 #include <cppunit/TestFixture.h>
12 #include <cppunit/extensions/HelperMacros.h>
13 #include <cppunit/plugin/TestPlugIn.h>
14 #include <unotools/fontdefs.hxx>
16 class Test: public CppUnit::TestFixture
18 public:
19 void testSingleElement();
21 CPPUNIT_TEST_SUITE(Test);
22 CPPUNIT_TEST(testSingleElement);
24 CPPUNIT_TEST_SUITE_END();
27 void Test::testSingleElement()
29 // lowercase
30 OUString test1 = GetEnglishSearchFontName( u"SYMBOL" );
31 CPPUNIT_ASSERT_EQUAL( u"symbol"_ustr,test1);
32 //trailing whitespaces
33 test1 = GetEnglishSearchFontName( u"Symbol " );
34 CPPUNIT_ASSERT_EQUAL(u"symbol"_ustr,test1);
35 //no longer remove script suffixes
36 test1 = GetEnglishSearchFontName( u"Symbol(SIP)" );
37 CPPUNIT_ASSERT_EQUAL(u"symbol(sip)"_ustr,test1);
38 test1 = GetEnglishSearchFontName( u"CM Roman CE" );
39 CPPUNIT_ASSERT_EQUAL( u"cmromance"_ustr,test1);
40 //remove special characters; leave semicolon, numbers
41 test1 = GetEnglishSearchFontName( u"sy;mb?=ol129" );
42 CPPUNIT_ASSERT_EQUAL( u"sy;mbol129"_ustr,test1);
44 //transformation
46 //for Japanese fontname
47 // IPAMincho
48 static constexpr OUStringLiteral aIPAMincho=u"ipa\u660e\u671d";
49 OUString test_ja_JP1 = GetEnglishSearchFontName(aIPAMincho);
50 CPPUNIT_ASSERT_EQUAL( u"ipamincho"_ustr,test_ja_JP1);
51 // IPAGothic
52 static constexpr OUStringLiteral aIPAGothic=u"ipa\u30b4\u30b7\u30c3\u30af";
53 OUString test_ja_JP2 = GetEnglishSearchFontName(aIPAGothic);
54 CPPUNIT_ASSERT_EQUAL( u"ipagothic"_ustr,test_ja_JP2);
55 // HiraginoKakuGothic
56 static constexpr OUStringLiteral aHiraginoKakuGothic=u"\u30D2\u30E9\u30AE\u30CE\u89D2\u30B4\u30B7\u30C3\u30AF";
57 OUString test_ja_JP3 = GetEnglishSearchFontName(aHiraginoKakuGothic);
58 CPPUNIT_ASSERT_EQUAL( u"hiraginosans"_ustr,test_ja_JP3);
59 // HiraginoMincho Pro N
60 static constexpr OUStringLiteral aHiraginoMinchoProN=u"\u30D2\u30E9\u30AE\u30CE\u660E\u671Dpron";
61 OUString test_ja_JP4 = GetEnglishSearchFontName(aHiraginoMinchoProN);
62 CPPUNIT_ASSERT_EQUAL( u"hiraginominchopron"_ustr,test_ja_JP4);
63 // HiraginoMaruGothic Pro N
64 static constexpr OUStringLiteral aHiraginoMaruGothicProN
65 =u"\u30D2\u30E9\u30AE\u30CE\u4E38\u30B4pron";
66 OUString test_ja_JP5 = GetEnglishSearchFontName(aHiraginoMaruGothicProN);
67 CPPUNIT_ASSERT_EQUAL( u"hiraginomarugothicpron"_ustr,test_ja_JP5);
70 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
71 CPPUNIT_PLUGIN_IMPLEMENT();
73 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */