diff -r e5af45d51884 -r 31fccae4f8a7 uiaccelerator_plat/alf_core_toolkit_api/tsrc/src/testuialfcoretoolkithuiownedpointer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uiaccelerator_plat/alf_core_toolkit_api/tsrc/src/testuialfcoretoolkithuiownedpointer.cpp Wed Sep 01 12:16:53 2010 +0100 @@ -0,0 +1,238 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: test api of alf_core_toolkit +* +*/ + + + +// [INCLUDE FILES] +#include +#include + +#include "testuiaifcoretoolkit.h" +// ----------------------------------------------------------------------------- +// CTestUiAifCoreToolkit::TestHuiOwnerdPointerCloseL +// ----------------------------------------------------------------------------- +// +TInt CTestUiAifCoreToolkit::TestHuiOwnerdPointerCloseL( CStifItemParser& /*aItem*/ ) + { + + // Print to UI + _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); + _LIT( KTestHuiOwnerdPointerCloseL, "In TestHuiOwnerdPointerCloseL" ); + TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestHuiOwnerdPointerCloseL ); + // Print to log file + iLog->Log( KTestHuiOwnerdPointerCloseL ); + + RHuiOwnedPointer huiOwnedPointer; + CHuiBorderBrush* brush = CHuiBorderBrush::NewL( 0, 0, 0, 0 ); + CleanupStack::PushL( brush ); + huiOwnedPointer.Set( brush, EHuiDoesNotHaveOwnership ); + huiOwnedPointer.Close(); + CleanupStack::PopAndDestroy( brush ); + return KErrNone; + } +// ----------------------------------------------------------------------------- +// CTestUiAifCoreToolkit::TestHuiOwnerdPointerOperatorTL +// ----------------------------------------------------------------------------- +// +TInt CTestUiAifCoreToolkit::TestHuiOwnerdPointerOperatorTL( CStifItemParser& /*aItem*/ ) + { + + // Print to UI + _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); + _LIT( KTestHuiOwnerdPointerOperatorTL, "In TestHuiOwnerdPointerOperatorTL" ); + TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestHuiOwnerdPointerOperatorTL ); + // Print to log file + iLog->Log( KTestHuiOwnerdPointerOperatorTL ); + + RHuiOwnedPointer huiOwnedPointer; + + RHuiOwnedPointer huiTemp = huiOwnedPointer; + CHuiBorderBrush* temp= huiTemp; + + return KErrNone; + } +// ----------------------------------------------------------------------------- +// CTestUiAifCoreToolkit::TestHuiOwnerdPointerOperatorConstTL +// ----------------------------------------------------------------------------- +// +TInt CTestUiAifCoreToolkit::TestHuiOwnerdPointerOperatorConstTL( CStifItemParser& /*aItem*/ ) + { + + // Print to UI + _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); + _LIT( KTestHuiOwnerdPointerOperatorConstTL, "In TestHuiOwnerdPointerOperatorConstTL" ); + TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestHuiOwnerdPointerOperatorConstTL ); + // Print to log file + iLog->Log( KTestHuiOwnerdPointerOperatorConstTL ); + + RHuiOwnedPointer huiOwnedPointer; + CHuiBorderBrush* brush = CHuiBorderBrush::NewL( 0, 0, 0, 0 ); + CleanupStack::PushL( brush ); + huiOwnedPointer.Set( brush, EHuiDoesNotHaveOwnership ); + //test operator const T*() const + + const RHuiOwnedPointer huiTemp = huiOwnedPointer; + const CHuiBorderBrush* temp= huiTemp; + + CleanupStack::PopAndDestroy( brush ); + + return KErrNone; + } +// ----------------------------------------------------------------------------- +// CTestUiAifCoreToolkit::TestHuiOwnerdPointerOperatorL +// ----------------------------------------------------------------------------- +// +TInt CTestUiAifCoreToolkit::TestHuiOwnerdPointerOperatorL( CStifItemParser& /*aItem*/ ) + { + + // Print to UI + _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); + _LIT( KTestHuiOwnerdPointerOperatorL, "In TestHuiOwnerdPointerOperatorL" ); + TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestHuiOwnerdPointerOperatorL ); + // Print to log file + iLog->Log( KTestHuiOwnerdPointerOperatorL ); + + RHuiOwnedPointer huiOwnedPointer; + CHuiBorderBrush* brush = CHuiBorderBrush::NewL( 0, 0, 0, 0 ); + CleanupStack::PushL( brush ); + huiOwnedPointer.Set( brush, EHuiDoesNotHaveOwnership ); +// test T* operator -> () + RHuiOwnedPointer a = huiOwnedPointer; + a->SetChanged(); +// test const T* operator -> () const + THuiBrushLayer layer = + ( ( const RHuiOwnedPointer ) huiOwnedPointer )->Layer(); + CleanupStack::PopAndDestroy( brush ); + + return KErrNone; + } +// ----------------------------------------------------------------------------- +// CTestUiAifCoreToolkit::TestHuiOwnerdPointerPtrL +// ----------------------------------------------------------------------------- +// +TInt CTestUiAifCoreToolkit::TestHuiOwnerdPointerPtrL( CStifItemParser& /*aItem*/ ) + { + + // Print to UI + _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); + _LIT( KTestHuiOwnerdPointerPtrL, "In TestHuiOwnerdPointerPtrL" ); + TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestHuiOwnerdPointerPtrL ); + // Print to log file + iLog->Log( KTestHuiOwnerdPointerPtrL ); + + RHuiOwnedPointer huiOwnedPointer; + CHuiBorderBrush* brush = CHuiBorderBrush::NewL( 0, 0, 0, 0 ); + CleanupStack::PushL( brush ); + huiOwnedPointer.Set( brush, EHuiDoesNotHaveOwnership ); + huiOwnedPointer.Ptr(); + CleanupStack::PopAndDestroy( brush ); + + return KErrNone; + } +// ----------------------------------------------------------------------------- +// CTestUiAifCoreToolkit::TestHuiOwnerdPointerRefL +// ----------------------------------------------------------------------------- +// +TInt CTestUiAifCoreToolkit::TestHuiOwnerdPointerRefL( CStifItemParser& /*aItem*/ ) + { + + // Print to UI + _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); + _LIT( KTestHuiOwnerdPointerRefL, "In TestHuiOwnerdPointerRefL" ); + TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestHuiOwnerdPointerRefL ); + // Print to log file + iLog->Log( KTestHuiOwnerdPointerRefL ); + + RHuiOwnedPointer huiOwnedPointer; + CHuiBorderBrush* brush = CHuiBorderBrush::NewL( 0, 0, 0, 0 ); + CleanupStack::PushL( brush ); + huiOwnedPointer.Set( brush, EHuiDoesNotHaveOwnership ); + huiOwnedPointer.Ref(); + CleanupStack::PopAndDestroy( brush ); + + return KErrNone; + } +// ----------------------------------------------------------------------------- +// CTestUiAifCoreToolkit::TestHuiOwnerdPointerNonConstRefL +// ----------------------------------------------------------------------------- +// +TInt CTestUiAifCoreToolkit::TestHuiOwnerdPointerNonConstRefL( CStifItemParser& /*aItem*/ ) + { + + // Print to UI + _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); + _LIT( KTestHuiOwnerdPointerNonConstRefL, "In TestHuiOwnerdPointerNonConstRefL" ); + TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestHuiOwnerdPointerNonConstRefL ); + // Print to log file + iLog->Log( KTestHuiOwnerdPointerNonConstRefL ); + + RHuiOwnedPointer huiOwnedPointer; + CHuiBorderBrush* brush = CHuiBorderBrush::NewL( 0, 0, 0, 0 ); + CleanupStack::PushL( brush ); + huiOwnedPointer.Set( brush, EHuiDoesNotHaveOwnership ); + huiOwnedPointer.NonConstRef(); + CleanupStack::PopAndDestroy( brush ); + + return KErrNone; + } +// ----------------------------------------------------------------------------- +// CTestUiAifCoreToolkit::TestHuiOwnerdPointerSetL +// ----------------------------------------------------------------------------- +// +TInt CTestUiAifCoreToolkit::TestHuiOwnerdPointerSetL( CStifItemParser& /*aItem*/ ) + { + + // Print to UI + _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); + _LIT( KTestHuiOwnerdPointerSetL, "In TestHuiOwnerdPointerSetL" ); + TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestHuiOwnerdPointerSetL ); + // Print to log file + iLog->Log( KTestHuiOwnerdPointerSetL ); + + RHuiOwnedPointer huiOwnedPointer; + CHuiBorderBrush* brush = CHuiBorderBrush::NewL( 0, 0, 0, 0 ); + CleanupStack::PushL( brush ); + huiOwnedPointer.Set( brush, EHuiDoesNotHaveOwnership ); + CleanupStack::PopAndDestroy( brush ); + + return KErrNone; + } +// ----------------------------------------------------------------------------- +// CTestUiAifCoreToolkit::TestHuiOwnerdPointerOwnershipL +// ----------------------------------------------------------------------------- +// +TInt CTestUiAifCoreToolkit::TestHuiOwnerdPointerOwnershipL( CStifItemParser& /*aItem*/ ) + { + + // Print to UI + _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); + _LIT( KTestHuiOwnerdPointerOwnershipL, "In TestHuiOwnerdPointerOwnershipL" ); + TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestHuiOwnerdPointerOwnershipL ); + // Print to log file + iLog->Log( KTestHuiOwnerdPointerOwnershipL ); + + RHuiOwnedPointer huiOwnedPointer; + CHuiBorderBrush* brush = CHuiBorderBrush::NewL( 0, 0, 0, 0 ); + CleanupStack::PushL( brush ); + huiOwnedPointer.Set( brush, EHuiDoesNotHaveOwnership ); + THuiOwnership ownerShip = huiOwnedPointer.Ownership(); + CleanupStack::PopAndDestroy( brush ); + + return KErrNone; + } + +//End of file.