classicui_pub/sounds_api/tsrc/src/testsdksoundsblocksaknsoundinfo.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002 - 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:  Test sounds_api 
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 // [INCLUDE FILES]
       
    20 #include <e32svr.h>
       
    21 #include <stifparser.h>
       
    22 #include <stiftestinterface.h>
       
    23 
       
    24 #include <aknsoundinfo.h>
       
    25 #include <s32mem.h>
       
    26 
       
    27 #include "testsdksounds.h"
       
    28 
       
    29 // CONSTANTS
       
    30 const TInt KHBufSize = 1000;
       
    31 
       
    32 // ============================ MEMBER FUNCTIONS ===============================
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CTestSDKSounds::TestSINewL
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 TInt CTestSDKSounds::TestSINewL( CStifItemParser& /*aItem*/ )
       
    39     {
       
    40     CAknSoundInfo *aknsoundinfo = CAknSoundInfo::NewL();
       
    41     CleanupStack::PushL( aknsoundinfo );
       
    42     STIF_ASSERT_NOT_NULL( aknsoundinfo );
       
    43     CleanupStack::PopAndDestroy( aknsoundinfo );
       
    44 
       
    45     return KErrNone;
       
    46     }
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // CTestSDKSounds::TestSIInternalizeL
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 TInt CTestSDKSounds::TestSIInternalizeL( CStifItemParser& /*aItem*/ )
       
    53     {
       
    54     CAknSoundInfo *aknsoundinfo = CAknSoundInfo::NewL();
       
    55     CleanupStack::PushL( aknsoundinfo );
       
    56 
       
    57     HBufC8* buf = HBufC8::NewL( KHBufSize );
       
    58     CleanupStack::PushL( buf );
       
    59     TPtr8 ptr = buf->Des();
       
    60 
       
    61     RDesReadStream readstream;
       
    62     readstream.Open( ptr );
       
    63     CleanupClosePushL( readstream );
       
    64     aknsoundinfo->InternalizeL( readstream );
       
    65     readstream.Close();
       
    66 
       
    67     CleanupStack::PopAndDestroy( 3);
       
    68     return KErrNone;
       
    69 
       
    70     }
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // CTestSDKSounds::TestSIExternalizeL
       
    74 // -----------------------------------------------------------------------------
       
    75 //
       
    76 TInt CTestSDKSounds::TestSIExternalizeL( CStifItemParser& /*aItem*/ )
       
    77     {
       
    78     CAknSoundInfo *aknsoundinfo = CAknSoundInfo::NewL();
       
    79     CleanupStack::PushL( aknsoundinfo );
       
    80     HBufC8* buf = HBufC8::NewL( KHBufSize );
       
    81     CleanupStack::PushL( buf );
       
    82     TPtr8 ptr = buf->Des();
       
    83     RDesWriteStream writestream;
       
    84     CleanupClosePushL(writestream);
       
    85     writestream.Open( ptr );
       
    86     aknsoundinfo->ExternalizeL( writestream );
       
    87     writestream.CommitL();
       
    88     writestream.Close();
       
    89     CleanupStack::PopAndDestroy( 3 );
       
    90     return KErrNone;
       
    91     }
       
    92 
       
    93 // End of file
       
    94 
       
    95