profilesservices/ProfileEngine/tsrc/public/basic/EngineMdlTest/src/T_MProfileExtraTones.cpp
changeset 0 8c5d936e5675
equal deleted inserted replaced
-1:000000000000 0:8c5d936e5675
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation of the T_MProfileExtraTones test class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 ////////////////////////////////////////////////////////////////////////
       
    20 // T_MProfileExtraTonesExtraTones.cpp
       
    21 //
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32math.h>
       
    25 #include <e32svr.h>
       
    26 
       
    27 #include <EUnitMacros.h>
       
    28 #include <TEUnitAssertionInfo.h>
       
    29 
       
    30 #include <BAMDESCA.H>
       
    31 #include <MProfileEngine.h>
       
    32 #include <MProfile.h>
       
    33 #include <MProfileName.h>
       
    34 #include <MProfileExtraTones.h>
       
    35 #include <MProfileTones.h>
       
    36 #include <TProfileToneSettings.h>
       
    37 //#include "T_ProfileTestTools.h"
       
    38 #include <centralrepository.h>
       
    39 #include <ProfileEngineSDKCRKeys.h>
       
    40 
       
    41 // the header for the tested class
       
    42 #include "T_MProfileExtraTones.h"
       
    43 
       
    44 //CONSTS
       
    45 
       
    46 // create the testing class
       
    47 T_MProfileExtraTones* T_MProfileExtraTones::NewLC()
       
    48     {
       
    49     T_MProfileExtraTones* self = new(ELeave) T_MProfileExtraTones;
       
    50 
       
    51     CleanupStack::PushL( self );
       
    52     // need to generate the table, so call base classes
       
    53     // second phase constructor
       
    54     self->ConstructL();
       
    55     return self;
       
    56     }
       
    57 
       
    58 void T_MProfileExtraTones::ConstructL()
       
    59     {
       
    60     CEUnitTestSuiteClass::ConstructL();
       
    61     }
       
    62 
       
    63 T_MProfileExtraTones::~T_MProfileExtraTones()
       
    64     {
       
    65     iFs.Close();
       
    66     if( iProfileEngine )
       
    67         {
       
    68         iProfileEngine->Release();
       
    69         }
       
    70     iArray.Close();
       
    71     if( iProfile )
       
    72         {
       
    73         iProfile->Release();
       
    74         }
       
    75     }
       
    76 
       
    77 /**
       
    78  * Assistance methods
       
    79  */
       
    80 
       
    81 
       
    82 /**
       
    83  * Setup
       
    84  */
       
    85 void T_MProfileExtraTones::EmptySetupL()
       
    86     {
       
    87     }
       
    88 
       
    89 
       
    90 
       
    91 void T_MProfileExtraTones::SetupL()
       
    92     {
       
    93     iFs.Connect();
       
    94     iCenRep = CRepository::NewL( KCRUidProfileEngine );
       
    95     iCenRep->Reset();
       
    96 
       
    97     iArray.Reset();
       
    98     iProfileEngine = CreateProfileEngineL();
       
    99 
       
   100     iProfileEngine->SetActiveProfileL( iActiveId );
       
   101     iProfile = iProfileEngine->ActiveProfileL();
       
   102 
       
   103     iProfileExtraTones = &( iProfile->ProfileExtraTones() );
       
   104     }
       
   105 
       
   106 void T_MProfileExtraTones::Setup0L()
       
   107     {
       
   108     iActiveId = 0;
       
   109     SetupL();
       
   110     }
       
   111 
       
   112 void T_MProfileExtraTones::Setup1L()
       
   113     {
       
   114     iActiveId = 1;
       
   115     SetupL();
       
   116     }
       
   117 
       
   118 void T_MProfileExtraTones::Setup2L()
       
   119     {
       
   120     iActiveId = 2;
       
   121     SetupL();
       
   122     }
       
   123 
       
   124 void T_MProfileExtraTones::Setup3L()
       
   125     {
       
   126     iActiveId = 3;
       
   127     SetupL();
       
   128     }
       
   129 
       
   130 void T_MProfileExtraTones::Setup4L()
       
   131     {
       
   132     iActiveId = 4;
       
   133     SetupL();
       
   134     }
       
   135 
       
   136 
       
   137 /**
       
   138  * Teardown
       
   139  */
       
   140 void T_MProfileExtraTones::EmptyTeardown()
       
   141     {
       
   142 
       
   143     }
       
   144 
       
   145 void T_MProfileExtraTones::Teardown()
       
   146     {
       
   147     iFs.Close();
       
   148     iArray.Reset();
       
   149     if( iProfile )
       
   150         {
       
   151         iProfile->Release();
       
   152         iProfile = NULL;
       
   153         }
       
   154     if( iProfileEngine )
       
   155         {
       
   156         iProfileEngine->Release();
       
   157         iProfileEngine = NULL;
       
   158         }
       
   159     delete iCenRep;
       
   160 
       
   161     }
       
   162 
       
   163 /**
       
   164  * Tests
       
   165  */
       
   166 void T_MProfileExtraTones::EmptyTestL()
       
   167     {
       
   168     //EUNIT_ASSERT( ETrue );
       
   169     }
       
   170 
       
   171 void T_MProfileExtraTones::GetIMMessageAlertToneTestL()
       
   172     {
       
   173     __UHEAP_MARK;
       
   174     const TDesC& des = iProfileExtraTones->IMMessageAlertTone();
       
   175     __UHEAP_MARKEND;
       
   176 
       
   177     //EUNIT_ASSERT( des.CompareF( T_ProfileTestTools::ProfileIMMessageAlertTone( iActiveId ) ) == 0 );
       
   178     }
       
   179 
       
   180 void T_MProfileExtraTones::GetEmailAlertToneTestL()
       
   181     {
       
   182     __UHEAP_MARK;
       
   183     const TDesC& des = iProfileExtraTones->EmailAlertTone();
       
   184     __UHEAP_MARKEND;
       
   185 
       
   186     //EUNIT_ASSERT( des.CompareF( T_ProfileTestTools::ProfileEmailAlertTone( iActiveId ) ) == 0 );
       
   187     }
       
   188 
       
   189 void T_MProfileExtraTones::GetVideoCallRingingToneTestL()
       
   190     {
       
   191     __UHEAP_MARK;
       
   192     const TDesC& des = iProfileExtraTones->VideoCallRingingTone();
       
   193     __UHEAP_MARKEND;
       
   194 
       
   195     //EUNIT_ASSERT( des.CompareF( T_ProfileTestTools::ProfileVideoCallRingingTone( iActiveId ) ) == 0 );
       
   196     }
       
   197 
       
   198 // Test case table for this test suite class
       
   199 EUNIT_BEGIN_TEST_TABLE( T_MProfileExtraTones, "T_MProfileExtraTones test suite", "MODULE" )
       
   200 
       
   201     EUNIT_TESTCASE("0: Get IM msg alert tone test ", Setup0L, GetIMMessageAlertToneTestL, Teardown)
       
   202 
       
   203     EUNIT_TESTCASE("1: Get IM msg alert tone test ", Setup1L, GetIMMessageAlertToneTestL, Teardown)
       
   204 
       
   205     EUNIT_TESTCASE("2: Get IM msg alert tone test ", Setup2L, GetIMMessageAlertToneTestL, Teardown)
       
   206 
       
   207     EUNIT_TESTCASE("3: Get IM msg alert tone test ", Setup3L, GetIMMessageAlertToneTestL, Teardown)
       
   208 
       
   209     EUNIT_TESTCASE("4: Get IM msg alert tone test ", Setup4L, GetIMMessageAlertToneTestL, Teardown)
       
   210 
       
   211     EUNIT_TESTCASE("0: Get Email alert tone test ", Setup0L, GetEmailAlertToneTestL, Teardown)
       
   212 
       
   213     EUNIT_TESTCASE("1: Get Email alert tone test ", Setup1L, GetEmailAlertToneTestL, Teardown)
       
   214 
       
   215     EUNIT_TESTCASE("2: Get Email alert tone test ", Setup2L, GetEmailAlertToneTestL, Teardown)
       
   216 
       
   217     EUNIT_TESTCASE("3: Get Email alert tone test ", Setup3L, GetEmailAlertToneTestL, Teardown)
       
   218 
       
   219     EUNIT_TESTCASE("4: Get Email alert tone test ", Setup4L, GetEmailAlertToneTestL, Teardown)
       
   220 
       
   221     EUNIT_TESTCASE("0: Get Video call ringing tone test ", Setup0L, GetVideoCallRingingToneTestL, Teardown)
       
   222 
       
   223     EUNIT_TESTCASE("1: Get Video call ringing tone test ", Setup1L, GetVideoCallRingingToneTestL, Teardown)
       
   224 
       
   225     EUNIT_TESTCASE("2: Get Video call ringing tone test ", Setup2L, GetVideoCallRingingToneTestL, Teardown)
       
   226 
       
   227     EUNIT_TESTCASE("3: Get Video call ringing tone test ", Setup3L, GetVideoCallRingingToneTestL, Teardown)
       
   228 
       
   229     EUNIT_TESTCASE("4: Get Video call ringing tone test ", Setup4L, GetVideoCallRingingToneTestL, Teardown)
       
   230 
       
   231 EUNIT_END_TESTCASE_TABLE
       
   232 
       
   233 //  End of File