profilesservices/ProfileEngine/tsrc/public/basic/EngineMdlTest/src/T_MProfileName.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_MProfileName test class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 ////////////////////////////////////////////////////////////////////////
       
    20 // T_MProfileName.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 "T_ProfileTestTools.h"
       
    35 
       
    36 // the header for the tested class
       
    37 #include "T_MProfileName.h"
       
    38 
       
    39 //CONSTS
       
    40 
       
    41 // create the testing class
       
    42 T_MProfileName* T_MProfileName::NewLC()
       
    43     {
       
    44     T_MProfileName* self = new(ELeave) T_MProfileName;
       
    45 
       
    46     CleanupStack::PushL( self );
       
    47     // need to generate the table, so call base classes
       
    48     // second phase constructor
       
    49     self->ConstructL();
       
    50     return self;
       
    51     }
       
    52 
       
    53 void T_MProfileName::ConstructL()
       
    54     {
       
    55     CEUnitTestSuiteClass::ConstructL();
       
    56     }
       
    57 
       
    58 T_MProfileName::~T_MProfileName()
       
    59     {
       
    60     iFs.Close();
       
    61     if( iProfileEngine )
       
    62         {
       
    63         iProfileEngine->Release();
       
    64         }
       
    65     if( iProfile )
       
    66         {
       
    67         iProfile->Release();
       
    68         }
       
    69     }
       
    70 
       
    71 /**
       
    72  * Assistance methods
       
    73  */
       
    74 
       
    75 
       
    76 /**
       
    77  * Setup
       
    78  */
       
    79 void T_MProfileName::EmptySetupL()
       
    80     {
       
    81     }
       
    82 
       
    83 
       
    84 
       
    85 void T_MProfileName::SetupL()
       
    86     {
       
    87     iFs.Connect();
       
    88 
       
    89     iProfileEngine = CreateProfileEngineL();
       
    90 
       
    91     iProfileEngine->SetActiveProfileL( iActiveId );
       
    92     iProfile = iProfileEngine->ActiveProfileL();
       
    93 
       
    94     iProfileName = &( iProfile->ProfileName() );
       
    95     }
       
    96 
       
    97 
       
    98 /**
       
    99  * Teardown
       
   100  */
       
   101 void T_MProfileName::EmptyTeardown()
       
   102     {
       
   103 
       
   104     }
       
   105 
       
   106 void T_MProfileName::Teardown()
       
   107     {
       
   108     iFs.Close();
       
   109     if( iProfile )
       
   110         {
       
   111         iProfile->Release();
       
   112         iProfile = NULL;
       
   113         }
       
   114     if( iProfileEngine )
       
   115         {
       
   116         iProfileEngine->Release();
       
   117         iProfileEngine = NULL;
       
   118         }
       
   119 
       
   120     }
       
   121 
       
   122 /**
       
   123  * Tests
       
   124  */
       
   125 void T_MProfileName::EmptyTestL()
       
   126     {
       
   127     //EUNIT_ASSERT( ETrue );
       
   128     }
       
   129 
       
   130 void T_MProfileName::GetIdTestL()
       
   131     {
       
   132     __UHEAP_MARK;
       
   133     TInt id = iProfileName->Id();
       
   134     __UHEAP_MARKEND;
       
   135     EUNIT_ASSERT( id == iActiveId );
       
   136     }
       
   137 
       
   138 void T_MProfileName::GetNameTestL()
       
   139     {
       
   140     __UHEAP_MARK;
       
   141     const TDesC& des = iProfileName->Name();
       
   142     __UHEAP_MARKEND;
       
   143     //EUNIT_ASSERT( des.Compare( T_ProfileTestTools::ProfileName( iActiveId ) ) == 0 );
       
   144     }
       
   145 
       
   146 void T_MProfileName::GetShortNameTestL()
       
   147     {
       
   148     __UHEAP_MARK;
       
   149     const TDesC& des = iProfileName->ShortName();
       
   150     __UHEAP_MARKEND;
       
   151     //EUNIT_ASSERT( des.Compare( T_ProfileTestTools::ProfileName( iActiveId ) ) == 0 );
       
   152     }
       
   153 void T_MProfileName::GetNaviNameTestL()
       
   154     {
       
   155     __UHEAP_MARK;
       
   156     const TDesC& des = iProfileName->NaviName();
       
   157     __UHEAP_MARKEND;
       
   158     //EUNIT_ASSERT( des.Compare( T_ProfileTestTools::ProfileName( iActiveId ) ) == 0 );
       
   159     }
       
   160 void T_MProfileName::GetTitleNameTestL()
       
   161     {
       
   162     __UHEAP_MARK;
       
   163     const TDesC& des = iProfileName->TitleName();
       
   164     __UHEAP_MARKEND;
       
   165     //EUNIT_ASSERT( des.Compare( T_ProfileTestTools::ProfileName( iActiveId ) ) == 0 );
       
   166     }
       
   167 
       
   168 // Test case table for this test suite class
       
   169 EUNIT_BEGIN_TEST_TABLE( T_MProfileName, "T_MProfileName test suite", "MODULE" )
       
   170 
       
   171     EUNIT_TESTCASE("Get ID test ", SetupL, GetIdTestL, Teardown)
       
   172     EUNIT_TESTCASE("Get Name test ", SetupL, GetNameTestL, Teardown)
       
   173     EUNIT_TESTCASE("Get ShortName test ", SetupL, GetShortNameTestL, Teardown)
       
   174     EUNIT_TESTCASE("Get NaviName test ", SetupL, GetNaviNameTestL, Teardown)
       
   175     EUNIT_TESTCASE("Get TitleName test ", SetupL, GetTitleNameTestL, Teardown)
       
   176 
       
   177 EUNIT_END_TESTCASE_TABLE
       
   178 
       
   179 //  End of File