uifw/AvKon/tsrc/bc/S60_SDK3.0/bctestcmdlg/src/bctestmemselitem.cpp
changeset 22 75713bee6484
parent 21 558113899881
child 26 62ef28f7b435
child 28 d33307312dfe
equal deleted inserted replaced
21:558113899881 22:75713bee6484
     1 /*
       
     2 * Copyright (c) 2006 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:  test case
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <w32std.h>
       
    20 #include <coecntrl.h>
       
    21 #include <AknLists.h>
       
    22 #include <aknsettingitemlist.h>
       
    23 #include <bctestcmdlg.rsg>
       
    24 
       
    25 #include "BCTestMemSelItem.h"
       
    26 #include "BCTestCmDlg.hrh"
       
    27 #include "streamlogger.h"
       
    28 #include "CVRSettingsDialogMMCSupported.h"
       
    29 
       
    30 // ======== MEMBER FUNCTIONS ========
       
    31 
       
    32 const TInt KItemPosition = 5;// Menu position of the test item
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // Symbian 2nd static Constructor
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 CBCTestMemSelSettingItem* CBCTestMemSelSettingItem::NewL()
       
    39     {
       
    40     CBCTestMemSelSettingItem* self = new( ELeave ) CBCTestMemSelSettingItem();
       
    41     CleanupStack::PushL( self );
       
    42     self->ConstructL();
       
    43     CleanupStack::Pop( self );
       
    44     return self;
       
    45     }
       
    46     
       
    47 // ---------------------------------------------------------------------------
       
    48 // C++ default constructor
       
    49 // ---------------------------------------------------------------------------
       
    50 //
       
    51 CBCTestMemSelSettingItem::CBCTestMemSelSettingItem():iItem(NULL)
       
    52     {    
       
    53     }
       
    54     
       
    55 // ---------------------------------------------------------------------------
       
    56 // Destructor
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 CBCTestMemSelSettingItem::~CBCTestMemSelSettingItem()
       
    60     {  
       
    61 	Teardown();
       
    62     }
       
    63     
       
    64 // ---------------------------------------------------------------------------
       
    65 // Symbian 2nd Constructor
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 void CBCTestMemSelSettingItem::ConstructL()
       
    69     {    
       
    70     BuildScriptL();    
       
    71     }
       
    72     
       
    73 // ---------------------------------------------------------------------------
       
    74 // CBCTestMemSelSettingItem::BuildScriptL
       
    75 // ---------------------------------------------------------------------------
       
    76 //
       
    77 void CBCTestMemSelSettingItem::BuildScriptL()
       
    78     { 
       
    79 	AddTestL( DELAY(1), TEND);
       
    80 
       
    81     // Add script as your need.   
       
    82 	for(int i=0; i<EBCTestCmdMemSelSettingItemEnd - EBCTestCmdMemSelSettingItemBegin -1; ++i)
       
    83 		{
       
    84 		AddTestL( LeftCBA, REP( Down, KItemPosition ), Right, TEND );
       
    85 		for(int j=0; j<i; ++j)
       
    86 			AddTestL( Down, TEND);
       
    87 		AddTestL( LeftCBA, TEND );
       
    88 		if(i == 1)
       
    89 			{
       
    90 			AddTestL( LeftCBA, WAIT(2),LeftCBA, WAIT(2), LeftCBA, WAIT(2), RightCBA, TEND);
       
    91 			}
       
    92 		AddOKL();
       
    93 		}
       
    94     }
       
    95     
       
    96 void CBCTestMemSelSettingItem::AddOKL()
       
    97 	{
       
    98 	// add dlg response sciprts
       
    99 	for(int i=0; i<1; ++i)
       
   100 		AddTestL( WAIT(5), KeyOK, TEND);
       
   101 	}
       
   102 
       
   103 void CBCTestMemSelSettingItem::AddCancelL()
       
   104 	{
       
   105 	// add dlg response sciprts
       
   106 	for(int i=0; i<1; ++i)
       
   107 		AddTestL( WAIT(5), RightCBA, TEND);
       
   108 	}
       
   109 
       
   110 // ---------------------------------------------------------------------------
       
   111 // CBCTestMemSelSettingItem::RunL
       
   112 // ---------------------------------------------------------------------------
       
   113 //
       
   114 void CBCTestMemSelSettingItem::RunL( TInt aCmd )
       
   115     {
       
   116 	SetupL();
       
   117 	switch(aCmd){
       
   118 	case EBCTestCmdMemSelSettingItemCreate:
       
   119 		TestCreateL();
       
   120 		break;
       
   121 	case EBCTestCmdMemSelSettingItemEdit:
       
   122 		TestEditL();
       
   123 		break;
       
   124 	case EBCTestCmdMemSelSettingItemStore:
       
   125 		TestStoreL();
       
   126 		break;
       
   127 	case EBCTestCmdMemSelSettingItemSetting:
       
   128 		TestSettingL();
       
   129 		break;
       
   130 	default:
       
   131 		break;
       
   132 	}
       
   133     Teardown();
       
   134     }
       
   135 
       
   136 // ---------------------------------------------------------------------------
       
   137 // CBCTestMemSelSettingItem::ReleaseCaseL
       
   138 // ---------------------------------------------------------------------------
       
   139 //   
       
   140 void CBCTestMemSelSettingItem::Teardown()
       
   141     {
       
   142 	delete iItem;
       
   143 	iItem = NULL;
       
   144     }
       
   145 
       
   146 void CBCTestMemSelSettingItem::TestCreateL()
       
   147 	{
       
   148 	iItem = new (ELeave) CAknMemorySelectionSettingItem(0, iMemory);
       
   149 	AssertNotNullL(iItem, _L("Create in Heap"));
       
   150 	iItem->CompleteConstructionL();
       
   151 	AssertTrueL(ETrue, _L("complete construction"));
       
   152 	}
       
   153 
       
   154 void CBCTestMemSelSettingItem::TestEditL()
       
   155 	{
       
   156 	CVRSettingsDialog* settingsDlg = CVRSettingsDialog::NewL();
       
   157 	settingsDlg->ExecuteLD( R_VR_SETTINGS_DIALOG );
       
   158 	}
       
   159 
       
   160 void CBCTestMemSelSettingItem::TestStoreL()
       
   161 	{
       
   162 	iItem = new (ELeave) CAknMemorySelectionSettingItem(0, iMemory);
       
   163 	iItem->StoreL();
       
   164 	AssertTrueL(ETrue, _L("store"));
       
   165 	iItem->LoadL();
       
   166 	AssertTrueL(ETrue, _L("laod"));
       
   167 	}
       
   168 
       
   169 void CBCTestMemSelSettingItem::TestSettingL()
       
   170 	{
       
   171 	iItem = new (ELeave) CAknMemorySelectionSettingItem(0, iMemory);
       
   172 	TFileName text(iItem->SettingTextL());
       
   173 	text.ZeroTerminate();
       
   174 	AssertTrueL(ETrue, text);
       
   175 	}
       
   176 
       
   177 void CBCTestMemSelSettingItem::SetupL()
       
   178 	{
       
   179 	iMemory = CAknMemorySelectionDialog::EPhoneMemory;
       
   180 	}
       
   181 
       
   182 
       
   183