LCOV - code coverage report
Current view: top level - unotools/qa/unit - testGetEnglishSearchName.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 23 23 100.0 %
Date: 2014-11-03 Functions: 11 12 91.7 %
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           6 : class Test: public CppUnit::TestFixture
      19             : {
      20             : public:
      21             :     virtual void setUp() SAL_OVERRIDE;
      22             :     void testSingleElement();
      23             : 
      24           4 :     CPPUNIT_TEST_SUITE(Test);
      25           2 :     CPPUNIT_TEST(testSingleElement);
      26             : 
      27           4 :     CPPUNIT_TEST_SUITE_END();
      28             : };
      29             : 
      30           2 : void Test::setUp()
      31             : {
      32           2 : }
      33             : 
      34           2 : void Test::testSingleElement()
      35             : {
      36             :     {   // lowercase
      37           2 :         OUString test1 = GetEnglishSearchFontName( "SYMBOL" );
      38           2 :         CPPUNIT_ASSERT_EQUAL( OUString("symbol"),test1);
      39             :         //trailingWhitespaces
      40           2 :         test1 = GetEnglishSearchFontName( "Symbol    " );
      41           2 :         CPPUNIT_ASSERT_EQUAL(OUString("symbol"),test1);
      42             :         //removing Skripts
      43           2 :         test1 = GetEnglishSearchFontName( "Symbol(SIP)" );
      44           2 :         CPPUNIT_ASSERT_EQUAL(OUString("symbol(sip)"),test1);
      45             :         //remove Whitespaces between
      46           2 :         test1 = GetEnglishSearchFontName( "Symbol (thai)" );
      47           2 :         CPPUNIT_ASSERT_EQUAL( OUString("symbol"),test1);
      48             :         //remove special characters; leave semicolon, numbers
      49           2 :         test1 = GetEnglishSearchFontName( "sy;mb?=ol129" );
      50           2 :         CPPUNIT_ASSERT_EQUAL( OUString("sy;mbol129"),test1);
      51             : 
      52             :         //transformation
      53             : 
      54           2 :         sal_Unicode const transfor[] ={ 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o','n',0};
      55             : 
      56           2 :         test1 = GetEnglishSearchFontName(transfor );
      57           2 :         CPPUNIT_ASSERT_EQUAL( OUString("hiraginomarugothicpron"),test1);
      58             :     }
      59           2 : }
      60             : 
      61           2 : CPPUNIT_TEST_SUITE_REGISTRATION(Test);
      62           8 : CPPUNIT_PLUGIN_IMPLEMENT();
      63             : 
      64             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10