LCOV - code coverage report
Current view: top level - unotools/qa/unit - testGetEnglishSearchName.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 23 23 100.0 %
Date: 2015-06-13 12:38:46 Functions: 14 15 93.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  */
      10             : 
      11             : #include "cppunit/TestCase.h"
      12             : #include "cppunit/TestFixture.h"
      13             : #include "cppunit/TestSuite.h"
      14             : #include "cppunit/extensions/HelperMacros.h"
      15             : #include "cppunit/plugin/TestPlugIn.h"
      16             : #include <unotools/fontdefs.hxx>
      17             : 
      18           3 : class Test: public CppUnit::TestFixture
      19             : {
      20             : public:
      21             :     virtual void setUp() SAL_OVERRIDE;
      22             :     void testSingleElement();
      23             : 
      24           2 :     CPPUNIT_TEST_SUITE(Test);
      25           1 :     CPPUNIT_TEST(testSingleElement);
      26             : 
      27           5 :     CPPUNIT_TEST_SUITE_END();
      28             : };
      29             : 
      30           1 : void Test::setUp()
      31             : {
      32           1 : }
      33             : 
      34           1 : void Test::testSingleElement()
      35             : {
      36             :     {   // lowercase
      37           1 :         OUString test1 = GetEnglishSearchFontName( "SYMBOL" );
      38           1 :         CPPUNIT_ASSERT_EQUAL( OUString("symbol"),test1);
      39             :         //trailingWhitespaces
      40           1 :         test1 = GetEnglishSearchFontName( "Symbol    " );
      41           1 :         CPPUNIT_ASSERT_EQUAL(OUString("symbol"),test1);
      42             :         //no longer remove script suffixes
      43           1 :         test1 = GetEnglishSearchFontName( "Symbol(SIP)" );
      44           1 :         CPPUNIT_ASSERT_EQUAL(OUString("symbol(sip)"),test1);
      45           1 :         test1 = GetEnglishSearchFontName( "CM Roman CE" );
      46           1 :         CPPUNIT_ASSERT_EQUAL( OUString("cmromance"),test1);
      47             :         //remove special characters; leave semicolon, numbers
      48           1 :         test1 = GetEnglishSearchFontName( "sy;mb?=ol129" );
      49           1 :         CPPUNIT_ASSERT_EQUAL( OUString("sy;mbol129"),test1);
      50             : 
      51             :         //transformation
      52             : 
      53           1 :         sal_Unicode const transfor[] ={ 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o','n',0};
      54             : 
      55           1 :         test1 = GetEnglishSearchFontName(transfor );
      56           1 :         CPPUNIT_ASSERT_EQUAL( OUString("hiraginomarugothicpron"),test1);
      57             :     }
      58           1 : }
      59             : 
      60           1 : CPPUNIT_TEST_SUITE_REGISTRATION(Test);
      61           4 : CPPUNIT_PLUGIN_IMPLEMENT();
      62             : 
      63             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11