uiaccelerator_plat/alf_core_toolkit_api/tsrc/src/testuialfcoretoolkithuiownedpointer.cpp
branchRCL_3
changeset 20 31fccae4f8a7
parent 10 7c5dd702d6d3
equal deleted inserted replaced
19:e5af45d51884 20:31fccae4f8a7
       
     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 api of alf_core_toolkit
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // [INCLUDE FILES]
       
    21 #include <uiacceltk/huiownedpointer.h>
       
    22 #include <uiacceltk/HuiBorderBrush.h>
       
    23 
       
    24 #include "testuiaifcoretoolkit.h"
       
    25 // -----------------------------------------------------------------------------
       
    26 // CTestUiAifCoreToolkit::TestHuiOwnerdPointerCloseL
       
    27 // -----------------------------------------------------------------------------
       
    28 //
       
    29 TInt CTestUiAifCoreToolkit::TestHuiOwnerdPointerCloseL( CStifItemParser& /*aItem*/ )
       
    30     {
       
    31 
       
    32     // Print to UI
       
    33     _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
    34     _LIT( KTestHuiOwnerdPointerCloseL, "In TestHuiOwnerdPointerCloseL" );
       
    35     TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestHuiOwnerdPointerCloseL );
       
    36     // Print to log file
       
    37     iLog->Log( KTestHuiOwnerdPointerCloseL );
       
    38 
       
    39     RHuiOwnedPointer<CHuiBorderBrush> huiOwnedPointer;
       
    40     CHuiBorderBrush* brush = CHuiBorderBrush::NewL( 0, 0, 0, 0 );
       
    41     CleanupStack::PushL( brush );
       
    42     huiOwnedPointer.Set( brush, EHuiDoesNotHaveOwnership );
       
    43     huiOwnedPointer.Close();
       
    44     CleanupStack::PopAndDestroy( brush );
       
    45     return KErrNone;
       
    46     }
       
    47 // -----------------------------------------------------------------------------
       
    48 // CTestUiAifCoreToolkit::TestHuiOwnerdPointerOperatorTL
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 TInt CTestUiAifCoreToolkit::TestHuiOwnerdPointerOperatorTL( CStifItemParser& /*aItem*/ )
       
    52     {
       
    53 
       
    54     // Print to UI
       
    55     _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
    56     _LIT( KTestHuiOwnerdPointerOperatorTL, "In TestHuiOwnerdPointerOperatorTL" );
       
    57     TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestHuiOwnerdPointerOperatorTL );
       
    58     // Print to log file
       
    59     iLog->Log( KTestHuiOwnerdPointerOperatorTL );
       
    60 
       
    61     RHuiOwnedPointer<CHuiBorderBrush> huiOwnedPointer;
       
    62 
       
    63     RHuiOwnedPointer<CHuiBorderBrush> huiTemp = huiOwnedPointer;
       
    64     CHuiBorderBrush* temp= huiTemp;
       
    65     
       
    66     return KErrNone;
       
    67     }
       
    68 // -----------------------------------------------------------------------------
       
    69 // CTestUiAifCoreToolkit::TestHuiOwnerdPointerOperatorConstTL
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 TInt CTestUiAifCoreToolkit::TestHuiOwnerdPointerOperatorConstTL( CStifItemParser& /*aItem*/ )
       
    73     {
       
    74 
       
    75     // Print to UI
       
    76     _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
    77     _LIT( KTestHuiOwnerdPointerOperatorConstTL, "In TestHuiOwnerdPointerOperatorConstTL" );
       
    78     TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestHuiOwnerdPointerOperatorConstTL );
       
    79     // Print to log file
       
    80     iLog->Log( KTestHuiOwnerdPointerOperatorConstTL );
       
    81 
       
    82     RHuiOwnedPointer<CHuiBorderBrush> huiOwnedPointer;
       
    83     CHuiBorderBrush* brush = CHuiBorderBrush::NewL( 0, 0, 0, 0 );
       
    84     CleanupStack::PushL( brush );
       
    85     huiOwnedPointer.Set( brush, EHuiDoesNotHaveOwnership );
       
    86     //test operator const T*() const
       
    87     
       
    88     const RHuiOwnedPointer<CHuiBorderBrush> huiTemp = huiOwnedPointer;
       
    89     const CHuiBorderBrush* temp= huiTemp;
       
    90     
       
    91     CleanupStack::PopAndDestroy( brush );
       
    92 
       
    93     return KErrNone;
       
    94     }
       
    95 // -----------------------------------------------------------------------------
       
    96 // CTestUiAifCoreToolkit::TestHuiOwnerdPointerOperatorL
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 TInt CTestUiAifCoreToolkit::TestHuiOwnerdPointerOperatorL( CStifItemParser& /*aItem*/ )
       
   100     {
       
   101 
       
   102     // Print to UI
       
   103     _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   104     _LIT( KTestHuiOwnerdPointerOperatorL, "In TestHuiOwnerdPointerOperatorL" );
       
   105     TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestHuiOwnerdPointerOperatorL );
       
   106     // Print to log file
       
   107     iLog->Log( KTestHuiOwnerdPointerOperatorL );
       
   108 
       
   109     RHuiOwnedPointer<CHuiBorderBrush> huiOwnedPointer;
       
   110     CHuiBorderBrush* brush = CHuiBorderBrush::NewL( 0, 0, 0, 0 );
       
   111     CleanupStack::PushL( brush );
       
   112     huiOwnedPointer.Set( brush, EHuiDoesNotHaveOwnership );
       
   113 //    test T* operator -> ()
       
   114     RHuiOwnedPointer<CHuiBorderBrush> a = huiOwnedPointer;
       
   115     a->SetChanged();
       
   116 //    test const T* operator -> () const
       
   117     THuiBrushLayer layer = 
       
   118     ( ( const RHuiOwnedPointer<CHuiBorderBrush> ) huiOwnedPointer )->Layer();
       
   119     CleanupStack::PopAndDestroy( brush );
       
   120     
       
   121     return KErrNone;
       
   122     }
       
   123 // -----------------------------------------------------------------------------
       
   124 // CTestUiAifCoreToolkit::TestHuiOwnerdPointerPtrL
       
   125 // -----------------------------------------------------------------------------
       
   126 //
       
   127 TInt CTestUiAifCoreToolkit::TestHuiOwnerdPointerPtrL( CStifItemParser& /*aItem*/ )
       
   128     {
       
   129 
       
   130     // Print to UI
       
   131     _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   132     _LIT( KTestHuiOwnerdPointerPtrL, "In TestHuiOwnerdPointerPtrL" );
       
   133     TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestHuiOwnerdPointerPtrL );
       
   134     // Print to log file
       
   135     iLog->Log( KTestHuiOwnerdPointerPtrL );
       
   136 
       
   137     RHuiOwnedPointer<CHuiBorderBrush> huiOwnedPointer;
       
   138     CHuiBorderBrush* brush = CHuiBorderBrush::NewL( 0, 0, 0, 0 );
       
   139     CleanupStack::PushL( brush );
       
   140     huiOwnedPointer.Set( brush, EHuiDoesNotHaveOwnership );
       
   141     huiOwnedPointer.Ptr();
       
   142     CleanupStack::PopAndDestroy( brush );
       
   143 
       
   144     return KErrNone;
       
   145     }
       
   146 // -----------------------------------------------------------------------------
       
   147 // CTestUiAifCoreToolkit::TestHuiOwnerdPointerRefL
       
   148 // -----------------------------------------------------------------------------
       
   149 //
       
   150 TInt CTestUiAifCoreToolkit::TestHuiOwnerdPointerRefL( CStifItemParser& /*aItem*/ )
       
   151     {
       
   152 
       
   153     // Print to UI
       
   154     _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   155     _LIT( KTestHuiOwnerdPointerRefL, "In TestHuiOwnerdPointerRefL" );
       
   156     TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestHuiOwnerdPointerRefL );
       
   157     // Print to log file
       
   158     iLog->Log( KTestHuiOwnerdPointerRefL );
       
   159 
       
   160     RHuiOwnedPointer<CHuiBorderBrush> huiOwnedPointer;
       
   161     CHuiBorderBrush* brush = CHuiBorderBrush::NewL( 0, 0, 0, 0 );
       
   162     CleanupStack::PushL( brush );
       
   163     huiOwnedPointer.Set( brush, EHuiDoesNotHaveOwnership );
       
   164     huiOwnedPointer.Ref();
       
   165     CleanupStack::PopAndDestroy( brush );
       
   166     
       
   167     return KErrNone;
       
   168     }
       
   169 // -----------------------------------------------------------------------------
       
   170 // CTestUiAifCoreToolkit::TestHuiOwnerdPointerNonConstRefL
       
   171 // -----------------------------------------------------------------------------
       
   172 //
       
   173 TInt CTestUiAifCoreToolkit::TestHuiOwnerdPointerNonConstRefL( CStifItemParser& /*aItem*/ )
       
   174     {
       
   175 
       
   176     // Print to UI
       
   177     _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   178     _LIT( KTestHuiOwnerdPointerNonConstRefL, "In TestHuiOwnerdPointerNonConstRefL" );
       
   179     TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestHuiOwnerdPointerNonConstRefL );
       
   180     // Print to log file
       
   181     iLog->Log( KTestHuiOwnerdPointerNonConstRefL );
       
   182 
       
   183     RHuiOwnedPointer<CHuiBorderBrush> huiOwnedPointer;
       
   184     CHuiBorderBrush* brush = CHuiBorderBrush::NewL( 0, 0, 0, 0 );
       
   185     CleanupStack::PushL( brush );
       
   186     huiOwnedPointer.Set( brush, EHuiDoesNotHaveOwnership );
       
   187     huiOwnedPointer.NonConstRef();
       
   188     CleanupStack::PopAndDestroy( brush );
       
   189 
       
   190     return KErrNone;
       
   191     }
       
   192 // -----------------------------------------------------------------------------
       
   193 // CTestUiAifCoreToolkit::TestHuiOwnerdPointerSetL
       
   194 // -----------------------------------------------------------------------------
       
   195 //
       
   196 TInt CTestUiAifCoreToolkit::TestHuiOwnerdPointerSetL( CStifItemParser& /*aItem*/ )
       
   197     {
       
   198 
       
   199     // Print to UI
       
   200     _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   201     _LIT( KTestHuiOwnerdPointerSetL, "In TestHuiOwnerdPointerSetL" );
       
   202     TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestHuiOwnerdPointerSetL );
       
   203     // Print to log file
       
   204     iLog->Log( KTestHuiOwnerdPointerSetL );
       
   205 
       
   206     RHuiOwnedPointer<CHuiBorderBrush> huiOwnedPointer;
       
   207     CHuiBorderBrush* brush = CHuiBorderBrush::NewL( 0, 0, 0, 0 );
       
   208     CleanupStack::PushL( brush );
       
   209     huiOwnedPointer.Set( brush, EHuiDoesNotHaveOwnership );
       
   210     CleanupStack::PopAndDestroy( brush );
       
   211 
       
   212     return KErrNone;
       
   213     }
       
   214 // -----------------------------------------------------------------------------
       
   215 // CTestUiAifCoreToolkit::TestHuiOwnerdPointerOwnershipL
       
   216 // -----------------------------------------------------------------------------
       
   217 //
       
   218 TInt CTestUiAifCoreToolkit::TestHuiOwnerdPointerOwnershipL( CStifItemParser& /*aItem*/ )
       
   219     {
       
   220 
       
   221     // Print to UI
       
   222     _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" );
       
   223     _LIT( KTestHuiOwnerdPointerOwnershipL, "In TestHuiOwnerdPointerOwnershipL" );
       
   224     TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestHuiOwnerdPointerOwnershipL );
       
   225     // Print to log file
       
   226     iLog->Log( KTestHuiOwnerdPointerOwnershipL );
       
   227 
       
   228     RHuiOwnedPointer<CHuiBorderBrush> huiOwnedPointer;
       
   229     CHuiBorderBrush* brush = CHuiBorderBrush::NewL( 0, 0, 0, 0 );
       
   230     CleanupStack::PushL( brush );
       
   231     huiOwnedPointer.Set( brush, EHuiDoesNotHaveOwnership );
       
   232     THuiOwnership ownerShip = huiOwnedPointer.Ownership();
       
   233     CleanupStack::PopAndDestroy( brush );
       
   234     
       
   235     return KErrNone;
       
   236     }
       
   237 
       
   238 //End of file.