phoneapp/phoneuistates/tsrc/ut_cphonesingleandalerting/Src/ut_cphonesingleandalerting.cpp
changeset 74 d1c62c765e48
equal deleted inserted replaced
65:2a5d4ab426d3 74:d1c62c765e48
       
     1 /*
       
     2 * Copyright (c) 2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 #include "ut_cphonesingleandalerting.h"
       
    19 #include <EUnitMacros.h>
       
    20 #include <EUnitDecorators.h>
       
    21 #include <featmgr.h>
       
    22 #include "CPhoneSingleAndAlerting.h"
       
    23 #include "PEVirtualEngine.h" 
       
    24 #include "CPhoneViewControllerStub.h"
       
    25 #include "CPhoneStateMachineStub.h"
       
    26 #include "MPhoneKeyEvents.h"
       
    27 #include "TPhoneCommandParam.h"
       
    28 #include "CPhoneMainResourceResolver.h"
       
    29 
       
    30 
       
    31 // - Construction -----------------------------------------------------------
       
    32 
       
    33 ut_cphonesingleandalerting* ut_cphonesingleandalerting::NewL()
       
    34     {
       
    35     ut_cphonesingleandalerting* self = ut_cphonesingleandalerting::NewLC();
       
    36     CleanupStack::Pop();
       
    37     return self;
       
    38     }
       
    39     
       
    40     ut_cphonesingleandalerting* ut_cphonesingleandalerting::NewLC()
       
    41     {
       
    42     ut_cphonesingleandalerting* self = new( ELeave ) ut_cphonesingleandalerting();
       
    43     CleanupStack::PushL( self );
       
    44     self->ConstructL();
       
    45     return self;
       
    46     }
       
    47 
       
    48 ut_cphonesingleandalerting::~ut_cphonesingleandalerting()
       
    49     {
       
    50     }
       
    51 
       
    52 ut_cphonesingleandalerting::ut_cphonesingleandalerting()
       
    53     {
       
    54     }
       
    55 
       
    56 void ut_cphonesingleandalerting::ConstructL()
       
    57     {
       
    58     CEUnitTestSuiteClass::ConstructL();
       
    59     }
       
    60 
       
    61 // - Test methods -----------------------------------------------------------
       
    62 
       
    63 
       
    64 
       
    65 void ut_cphonesingleandalerting::SetupL(  )
       
    66     {
       
    67     iViewCommandHandle = CPhoneViewController::NewL();
       
    68     iStateMachine = CPhoneStateMachineStub::NewL(); 
       
    69     iViewCommandHandle->iCallId = 2; 
       
    70     
       
    71     iStateSingleAndAlerting  = CPhoneSingleAndAlerting::NewL(
       
    72            iStateMachine, iViewCommandHandle, NULL );
       
    73     
       
    74     }
       
    75     
       
    76 
       
    77 void ut_cphonesingleandalerting::Teardown(  )
       
    78     {
       
    79     delete CPhoneMainResourceResolver::Instance();
       
    80     delete iStateSingleAndAlerting;
       
    81     delete iViewCommandHandle;
       
    82     delete iStateMachine;
       
    83     }
       
    84  
       
    85 // -----------------------------------------------------------------------------
       
    86 // Test  conference idle
       
    87 // -check commands
       
    88 // -----------------------------------------------------------------------------
       
    89 //  
       
    90 void ut_cphonesingleandalerting::TestCallHeaderIsRemovedWhenCallGoesIdleL( )
       
    91     {
       
    92     
       
    93     iViewCommandHandle->SetViewGetCountOfActiveCalls(1);
       
    94     
       
    95     iStateSingleAndAlerting->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageIdle, 0 );
       
    96    
       
    97     iViewCommandHandle->VerifyViewCommand(EPhoneViewRemoveCallHeader);
       
    98           
       
    99     }
       
   100 
       
   101 // - EUnit test table -------------------------------------------------------
       
   102 
       
   103 EUNIT_BEGIN_TEST_TABLE(
       
   104         ut_cphonesingleandalerting,
       
   105     "Add test suite description here.",
       
   106     "UNIT" )
       
   107      
       
   108 EUNIT_TEST(
       
   109     "1- CPhoneSingleAndAlerting: Test idle",
       
   110     "",
       
   111     "Test0",
       
   112     "FUNCTIONALITY",
       
   113     SetupL, TestCallHeaderIsRemovedWhenCallGoesIdleL, Teardown)    
       
   114     
       
   115 EUNIT_END_TEST_TABLE