profilesservices/ProfileEngine/tsrc/public/basic/EngineMdlTest/src/T_MProfileFeedbackSettings.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_MProfileFeedbackSettings test class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 ////////////////////////////////////////////////////////////////////////
       
    20 // T_MProfileFeedbackSettings.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 <MProfileExtraSettings.h>
       
    35 //#include "T_ProfileTestTools.h"
       
    36 #include <centralrepository.h>
       
    37 #include <ProfileEngineSDKCRKeys.h>
       
    38 
       
    39 // the header for the tested class
       
    40 #include <MProfileFeedbackSettings.h>
       
    41 // the header for the tester class
       
    42 #include "T_MProfileFeedbackSettings.h"
       
    43 
       
    44 //CONSTS
       
    45 
       
    46 // create the testing class
       
    47 T_MProfileFeedbackSettings* T_MProfileFeedbackSettings::NewLC()
       
    48     {
       
    49     T_MProfileFeedbackSettings* self = new(ELeave) T_MProfileFeedbackSettings;
       
    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_MProfileFeedbackSettings::ConstructL()
       
    59     {
       
    60     CEUnitTestSuiteClass::ConstructL();
       
    61     }
       
    62 
       
    63 T_MProfileFeedbackSettings::~T_MProfileFeedbackSettings()
       
    64     {
       
    65     iFs.Close();
       
    66     if( iProfileEngine )
       
    67         {
       
    68         iProfileEngine->Release();
       
    69         }
       
    70     if( iProfile )
       
    71         {
       
    72         iProfile->Release();
       
    73         }
       
    74     }
       
    75 
       
    76 /**
       
    77  * Assistance methods
       
    78  */
       
    79 
       
    80 
       
    81 /**
       
    82  * Setup
       
    83  */
       
    84 void T_MProfileFeedbackSettings::EmptySetupL()
       
    85     {
       
    86     }
       
    87 
       
    88 
       
    89 
       
    90 void T_MProfileFeedbackSettings::SetupL()
       
    91     {
       
    92     iFs.Connect();
       
    93     iCenRep = CRepository::NewL( KCRUidProfileEngine );
       
    94     iCenRep->Reset();
       
    95 
       
    96     iProfileEngine = CreateProfileEngineL();
       
    97     iProfileEngine->SetActiveProfileL( iActiveId );
       
    98     iProfile = iProfileEngine->ActiveProfileL();
       
    99 
       
   100     iProfileExtraSettings = &( iProfile->ProfileExtraSettings() );
       
   101     iProfileFeedbackSettings = &( iProfileExtraSettings->ProfileFeedbackSettings() );
       
   102     }
       
   103 
       
   104 
       
   105 /**
       
   106  * Teardown
       
   107  */
       
   108 void T_MProfileFeedbackSettings::EmptyTeardown()
       
   109     {
       
   110 
       
   111     }
       
   112 
       
   113 void T_MProfileFeedbackSettings::Teardown()
       
   114     {
       
   115     iFs.Close();
       
   116     if( iProfile )
       
   117         {
       
   118         iProfile->Release();
       
   119         iProfile = NULL;
       
   120         iProfileFeedbackSettings = NULL;
       
   121         iProfileExtraSettings = NULL;
       
   122         }
       
   123     if( iProfileEngine )
       
   124         {
       
   125         iProfileEngine->Release();
       
   126         iProfileEngine = NULL;
       
   127         }
       
   128     delete iCenRep;
       
   129 
       
   130     }
       
   131 
       
   132 /**
       
   133  * Tests
       
   134  */
       
   135 void T_MProfileFeedbackSettings::EmptyTestL()
       
   136     {
       
   137     //EUNIT_ASSERT( ETrue );
       
   138     }
       
   139 
       
   140 void T_MProfileFeedbackSettings::GetTactileFeedbackTestL()
       
   141     {
       
   142     __UHEAP_MARK;
       
   143     TProfileTactileFeedback tac( iProfileFeedbackSettings->TactileFeedback() );
       
   144     __UHEAP_MARKEND;
       
   145     }
       
   146 
       
   147 void T_MProfileFeedbackSettings::GetAudioFeedbackTestL()
       
   148     {
       
   149     __UHEAP_MARK;
       
   150     TProfileAudioFeedback aud( iProfileFeedbackSettings->AudioFeedback() );
       
   151     __UHEAP_MARKEND;
       
   152     }
       
   153 
       
   154 // Test case table for this test suite class
       
   155 EUNIT_BEGIN_TEST_TABLE( T_MProfileFeedbackSettings, "T_MProfileFeedbackSettings test suite", "MODULE" )
       
   156 
       
   157     EUNIT_TESTCASE("Get Tactile feedback test ", SetupL, GetTactileFeedbackTestL, Teardown)
       
   158 
       
   159     EUNIT_TESTCASE("Get Audio feedback test ", SetupL, GetAudioFeedbackTestL, Teardown)
       
   160 
       
   161 EUNIT_END_TESTCASE_TABLE
       
   162 
       
   163 //  End of File
       
   164