common/tools/ats/smoketest/localisation/apparchitecture/tef/TIconLoaderAndIconArrayForLeaks.cpp
changeset 793 0c32c669a39d
child 872 17498133d9ad
equal deleted inserted replaced
792:893b85cda81b 793:0c32c669a39d
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Test for PDEF104113: This method is for memory leaks test when iconArray is created and deleted. 
       
    15 // This method is put in a separate dll in order to avoid exporting methods 
       
    16 // in server side classes (e.g., APPARC\apgrfx\CApaAppList) for test code. 
       
    17 // It is called by void CT_RApaLsSessionTestStep::TestIconLoaderAndIconArrayMemoryLeaksL() 
       
    18 // in apparctestserver
       
    19 // 
       
    20 //
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @file
       
    26  @test
       
    27  @internalComponent - Internal Symbian test code
       
    28 */
       
    29 
       
    30 
       
    31 #include <APGAPLST.H>
       
    32 #include <bautils.h>
       
    33 #include <APGICNFL.H> 
       
    34 #include <APFDEF.H>
       
    35 #include "APGAIR.H"
       
    36 #include <APGICNFL.H> 
       
    37 #include "apprivate.h"
       
    38 #include <barsc2.h>
       
    39 #include <barsread2.h>
       
    40 #include <e32uid.h>
       
    41 #include "APGSTD.H"
       
    42 #include "TIconLoaderAndIconArrayForLeaks.h"
       
    43 #include "apsiconcaptionoverride.h"
       
    44 
       
    45 
       
    46 EXPORT_C void TIconLoaderAndIconArrayForLeaks::TestIconLoaderAndIconArrayL()
       
    47 	{
       
    48 	RFs tempFs;
       
    49 	User::LeaveIfError(tempFs.Connect());
       
    50 	CleanupClosePushL(tempFs);
       
    51 
       
    52 	CApaIconLoader* iconLoader = CApaIconLoader::NewLC(tempFs);
       
    53 	CApaAppIconArray* icons = CApaAppIconArray::NewRealDefaultIconsLC(KNumberOfIconsInDefaultMbm,KDefaultAppIconMbm, *iconLoader);
       
    54 	CleanupStack::PopAndDestroy(2,iconLoader);
       
    55 	CleanupStack::PopAndDestroy(&tempFs);
       
    56 	}
       
    57 
       
    58 EXPORT_C void TIconLoaderAndIconArrayForLeaks::TestIconCaptionOverridesL()
       
    59 	{
       
    60 	CApaIconCaptionOverrides* iconcap = NULL;
       
    61 	CApaIconCaptionOverridesForApp* iconCapOverride = CApaIconCaptionOverridesForApp::NewL();
       
    62 	CleanupStack::PushL(iconCapOverride);
       
    63 	CActiveScheduler* sched = NULL;
       
    64 	sched = new(ELeave) CActiveScheduler;
       
    65 	CleanupStack::PushL(sched);
       
    66 	CActiveScheduler::Install(sched);
       
    67 	CApaIconCaptionCenrepObserver* observer = CApaIconCaptionCenrepObserver::NewL(*iconcap);
       
    68 	CleanupStack::PushL(observer);
       
    69 	CleanupStack::PopAndDestroy(3,iconCapOverride);
       
    70 	}