classicui_pub/grids_api/tsrc/src/testsdkgridsblocksakngrid.cpp
branchRCL_3
changeset 20 d48ab3b357f1
parent 0 2f259fa3e83a
equal deleted inserted replaced
19:aecbbf00d063 20:d48ab3b357f1
       
     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 akngrid.h
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 /*
       
    20  * Include files
       
    21  */
       
    22 #include <coedef.h>
       
    23 #include <akngrid.h>
       
    24 #include <akngridm.h>
       
    25 #include <stifparser.h>
       
    26 #include <barsread.h>
       
    27 #include <akngrid.h>
       
    28 #include <aknlists.h>
       
    29 #include <w32std.h>
       
    30 #include <testsdkgrids.rsg>
       
    31 
       
    32 #include "testsdkgridscontainer.h"
       
    33 #include "testsdkgridsext.h"
       
    34 #include "testsdkgrids.h"
       
    35 #include "scrolbarsbserver.h"
       
    36 #include "testsdkgridsview.h"
       
    37 
       
    38 const TInt KColumnWidthZero = 0;
       
    39 const TInt KColumnWidthTwo = 2;
       
    40 const TInt KPointX = 1;
       
    41 const TInt KPointY = 1;
       
    42 const TInt KZero = 0;
       
    43 const TInt KOne = 1;
       
    44 const TInt KTwo = 2;
       
    45 const TInt KThree = 3;
       
    46 const TInt KMinusone = -1;
       
    47 const TInt KTen = 10;
       
    48 const TInt KThousand = 1000;
       
    49 
       
    50 // ============================ MEMBER FUNCTIONS ===============================
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // Ctestsdkgrids::TestGridsGridConstructionL
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 TInt CTestSDKGrids::TestGridsGridConstructionL( CStifItemParser& /*aItem*/)
       
    57     {
       
    58     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
    59     _LIT( KTestGridsGridConstructionL, "In TestGridsGridConstructionL" );
       
    60     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGridConstructionL );
       
    61     iLog->Log( KTestGridsGridConstructionL );
       
    62 
       
    63     iGrid = new( ELeave ) CAknGrid();
       
    64     STIF_ASSERT_NOT_NULL( iGrid );
       
    65 
       
    66     return KErrNone;
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // Ctestsdkgrids::TestGridsGridDelete
       
    71 // -----------------------------------------------------------------------------
       
    72 //
       
    73 TInt CTestSDKGrids::TestGridsGridDelete( CStifItemParser& /*aItem*/)
       
    74     {
       
    75     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
    76     _LIT( KTestGridsGridDelete, "In KTestGridsGridDelete" );
       
    77     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGridDelete );
       
    78     iLog->Log( KTestGridsGridDelete );
       
    79 
       
    80     delete iGrid;
       
    81     iGrid = NULL;
       
    82 
       
    83     return KErrNone;
       
    84     }
       
    85 
       
    86 // -----------------------------------------------------------------------------
       
    87 // Ctestsdkgrids::TestGridsGridSetModelL
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 TInt CTestSDKGrids::TestGridsGridSetModelL( CStifItemParser& /*aItem*/)
       
    91     {
       
    92     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
    93     _LIT( KTestGridsGridSetModelL, "In TestGridsGridSetModelL" );
       
    94     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGridSetModelL );
       
    95     iLog->Log( KTestGridsGridSetModelL );
       
    96 
       
    97     CAknGridM* model = new( ELeave ) CAknGridM();
       
    98     CleanupStack::PushL( model );
       
    99     iGrid->SetModel( model );
       
   100     CleanupStack::Pop( model );
       
   101 
       
   102     STIF_ASSERT_NOT_NULL( iGrid );
       
   103 
       
   104     return KErrNone;
       
   105     }
       
   106 
       
   107 // -----------------------------------------------------------------------------
       
   108 // Ctestsdkgrids::TestGridsGridConstructL
       
   109 // -----------------------------------------------------------------------------
       
   110 //
       
   111 TInt CTestSDKGrids::TestGridsGridConstructL( CStifItemParser& /*aItem*/)
       
   112     {
       
   113     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   114     _LIT( KTestGridsGridConstructL, "In KTestGridsGridConstructL" );
       
   115     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGridConstructL );
       
   116     iLog->Log( KTestGridsGridConstructL );
       
   117 
       
   118     iGrid->ConstructL( iContainer, 0 );
       
   119 
       
   120     return KErrNone;
       
   121     }
       
   122 
       
   123 // -----------------------------------------------------------------------------
       
   124 // Ctestsdkgrids::TestGridsGridConstructFromResourceL
       
   125 // -----------------------------------------------------------------------------
       
   126 //
       
   127 TInt CTestSDKGrids::TestGridsGridConstructFromResourceL( CStifItemParser& /*aItem*/)
       
   128     {
       
   129     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   130     _LIT( KTestGridsGridConstructFromResourceL, "In KTestGridsGridConstructFromResourceL" );
       
   131     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGridConstructFromResourceL );
       
   132     iLog->Log( KTestGridsGridConstructFromResourceL );
       
   133 
       
   134     TInt err = KErrNone;
       
   135     TResourceReader reader;
       
   136     iGrid->SetContainerWindowL( *iContainer );
       
   137     CEikonEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDKGRIDS_GRID );
       
   138 
       
   139     TRAP( err, iGrid->ConstructFromResourceL( reader ) );
       
   140 
       
   141     CleanupStack::Pop( );
       
   142     return KErrNone;
       
   143     }
       
   144 
       
   145 // -----------------------------------------------------------------------------
       
   146 // Ctestsdkgrids::TestGridsGridSetLayoutL
       
   147 // -----------------------------------------------------------------------------
       
   148 //
       
   149 TInt CTestSDKGrids::TestGridsGridSetLayoutL( CStifItemParser& /*aItem*/)
       
   150     {
       
   151     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   152     _LIT( KTestGridsGMSSGConstructionWithTBoolL, "In TestGridsGMSSGConstructionWithTBoolL" );
       
   153     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGConstructionWithTBoolL );
       
   154     iLog->Log( KTestGridsGMSSGConstructionWithTBoolL );
       
   155 
       
   156     TSize size = iContainer->Rect().Size( );
       
   157 
       
   158     iGrid->SetLayoutL( ETrue, ETrue, ETrue, KOne, KOne, size, KZero, KZero );
       
   159     iGrid->SetLayoutL( EFalse, ETrue, ETrue, KOne, KOne, size, KZero, KZero );
       
   160 
       
   161     return KErrNone;
       
   162     }
       
   163 
       
   164 // -----------------------------------------------------------------------------
       
   165 // Ctestsdkgrids::TestGridsGridSetLayoutFromResourceL
       
   166 // -----------------------------------------------------------------------------
       
   167 //
       
   168 TInt CTestSDKGrids::TestGridsGridSetLayoutFromResourceL( CStifItemParser& /*aItem*/)
       
   169     {
       
   170     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   171     _LIT( KTestGridsGMSSGConstructL, "In TestGridsGMSSGConstructL" );
       
   172     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGConstructL );
       
   173     iLog->Log( KTestGridsGMSSGConstructL );
       
   174 
       
   175     TInt err = KErrNone;
       
   176     TResourceReader reader;
       
   177     CEikonEnv::Static()->CreateResourceReaderLC( reader, R_AVKON_GRID_STYLE_DEFAULT );
       
   178     TRAP( err, iGrid->SetLayoutFromResourceL( reader ) );
       
   179 
       
   180     CleanupStack::PopAndDestroy( );
       
   181 
       
   182     return err;
       
   183     }
       
   184 
       
   185 // -----------------------------------------------------------------------------
       
   186 // Ctestsdkgrids::TestGridsGridSetPrimaryScrollingType
       
   187 // -----------------------------------------------------------------------------
       
   188 //
       
   189 TInt CTestSDKGrids::TestGridsGridSetPrimaryScrollingType( CStifItemParser& /*aItem*/)
       
   190     {
       
   191     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   192     _LIT( KTestGridsGMSSGDelete, "In TestGridsGMSSGDelete" );
       
   193     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGDelete );
       
   194     iLog->Log( KTestGridsGMSSGDelete );
       
   195 
       
   196     iGrid->SetPrimaryScrollingType( CAknGridView::EScrollStops );
       
   197 
       
   198     return KErrNone;
       
   199     }
       
   200 
       
   201 // -----------------------------------------------------------------------------
       
   202 // Ctestsdkgrids::TestGridsGridSetSecondaryScrollingType
       
   203 // -----------------------------------------------------------------------------
       
   204 //
       
   205 TInt CTestSDKGrids::TestGridsGridSetSecondaryScrollingType( CStifItemParser& /*aItem*/)
       
   206     {
       
   207     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   208     _LIT( KTestGridsGMSSGSetupLayout, "In TestGridsGMSSGSetupLayout" );
       
   209     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGSetupLayout );
       
   210     iLog->Log( KTestGridsGMSSGSetupLayout );
       
   211 
       
   212     iGrid->SetSecondaryScrollingType( CAknGridView::EScrollStops );
       
   213 
       
   214     return KErrNone;
       
   215     }
       
   216 
       
   217 // -----------------------------------------------------------------------------
       
   218 // Ctestsdkgrids::TestGridsGridSetStartPositionL
       
   219 // -----------------------------------------------------------------------------
       
   220 //
       
   221 TInt CTestSDKGrids::TestGridsGridSetStartPositionL( CStifItemParser& /*aItem*/)
       
   222     {
       
   223     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   224     _LIT( KTestGridsGMSSGHandlePointerEventL, "In TestGridsGMSSGHandlePointerEventL" );
       
   225     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGHandlePointerEventL );
       
   226     iLog->Log( KTestGridsGMSSGHandlePointerEventL );
       
   227 
       
   228     TInt err = KErrNone;
       
   229     TPoint point( KPointX, KPointY);
       
   230 
       
   231     TRAP( err, iGrid->SetStartPositionL( point ) );
       
   232 
       
   233     return err;
       
   234     }
       
   235 
       
   236 // -----------------------------------------------------------------------------
       
   237 // Ctestsdkgrids::TestGridsGridCurrentDataIndex
       
   238 // -----------------------------------------------------------------------------
       
   239 //
       
   240 TInt CTestSDKGrids::TestGridsGridCurrentDataIndex( CStifItemParser& /*aItem*/)
       
   241     {
       
   242     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   243     _LIT( KTestGridsGMSSGSizeChanged, "In TestGridsGMSSGSizeChanged" );
       
   244     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGSizeChanged );
       
   245     iLog->Log( KTestGridsGMSSGSizeChanged );
       
   246 
       
   247     const TInt expected = 0;
       
   248     TInt dataIndex = iGrid->CurrentDataIndex( );
       
   249     STIF_ASSERT_EQUALS( expected, dataIndex );
       
   250 
       
   251     return KErrNone;
       
   252     }
       
   253 
       
   254 // -----------------------------------------------------------------------------
       
   255 // Ctestsdkgrids::TestGridsGridSetCurrentDataIndex
       
   256 // -----------------------------------------------------------------------------
       
   257 //
       
   258 TInt CTestSDKGrids::TestGridsGridSetCurrentDataIndex( CStifItemParser& /*aItem*/)
       
   259     {
       
   260     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   261     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGMSSGMinimumSize" );
       
   262     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   263     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   264 
       
   265     TInt dataIndex = iGrid->CurrentDataIndex( );
       
   266     iGrid->SetCurrentDataIndex( dataIndex );
       
   267 
       
   268     return KErrNone;
       
   269     }
       
   270 
       
   271 // -----------------------------------------------------------------------------
       
   272 // Ctestsdkgrids::TestGridsGridIndexOfPosition
       
   273 // -----------------------------------------------------------------------------
       
   274 //
       
   275 TInt CTestSDKGrids::TestGridsGridIndexOfPosition( CStifItemParser& /*aItem*/)
       
   276     {
       
   277     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   278     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGMSSGMinimumSize" );
       
   279     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   280     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   281 
       
   282     TInt expected = 0;
       
   283     TPoint point( KPointX, KPointY);
       
   284     TInt indexOfPosition = iGrid->IndexOfPosition( point );
       
   285     STIF_ASSERT_NOT_EQUALS( expected, indexOfPosition );
       
   286 
       
   287     return KErrNone;
       
   288     }
       
   289 
       
   290 // -----------------------------------------------------------------------------
       
   291 // Ctestsdkgrids::TestGridsGridPositionAtIndex
       
   292 // -----------------------------------------------------------------------------
       
   293 //
       
   294 TInt CTestSDKGrids::TestGridsGridPositionAtIndex( CStifItemParser& /*aItem*/ )
       
   295     {
       
   296     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   297     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGMSSGMinimumSize" );
       
   298     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   299     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   300 
       
   301     TPoint point( KPointX, KPointY);
       
   302     TInt indexOfPosition = iGrid->IndexOfPosition( point );
       
   303     TPoint positionAtIndex = iGrid->PositionAtIndex( indexOfPosition );
       
   304 
       
   305     return KErrNone;
       
   306     }
       
   307 
       
   308 // -----------------------------------------------------------------------------
       
   309 // Ctestsdkgrids::TestGridsGridItemDrawer
       
   310 // -----------------------------------------------------------------------------
       
   311 //
       
   312 TInt CTestSDKGrids::TestGridsGridItemDrawer( CStifItemParser& /*aItem*/ )
       
   313     {
       
   314     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   315     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGMSSGMinimumSize" );
       
   316     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   317     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   318 
       
   319     CFormattedCellListBoxItemDrawer* intemFrawer = iGrid->ItemDrawer();
       
   320 
       
   321     return KErrNone;
       
   322     }
       
   323 
       
   324 // -----------------------------------------------------------------------------
       
   325 // Ctestsdkgrids::TestGridsGridSetEmptyGridTextL
       
   326 // -----------------------------------------------------------------------------
       
   327 //
       
   328 TInt CTestSDKGrids::TestGridsGridSetEmptyGridTextL( CStifItemParser& /*aItem*/ )
       
   329     {
       
   330     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   331     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGMSSGMinimumSize" );
       
   332     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   333     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   334 
       
   335     TInt err = KErrNone;
       
   336     _LIT( text, "xxxxxxxxxxx" );
       
   337     TRAP( err, iGrid->SetEmptyGridTextL( text ) );
       
   338 
       
   339     return err;
       
   340     }
       
   341 
       
   342 // -----------------------------------------------------------------------------
       
   343 // Ctestsdkgrids::TestGridsGridEmptyGridText
       
   344 // -----------------------------------------------------------------------------
       
   345 //
       
   346 TInt CTestSDKGrids::TestGridsGridEmptyGridText( CStifItemParser& /*aItem*/ )
       
   347     {
       
   348     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   349     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGMSSGMinimumSize" );
       
   350     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   351     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   352 
       
   353     iGrid->EmptyGridText();
       
   354 
       
   355     return KErrNone;
       
   356     }
       
   357 
       
   358 // -----------------------------------------------------------------------------
       
   359 // CTestSDKGrids::TestGridsGridMakeViewClassInstanceL
       
   360 // -----------------------------------------------------------------------------
       
   361 //
       
   362 TInt CTestSDKGrids::TestGridsGridMakeViewClassInstanceL( CStifItemParser& /*aItem*/ )
       
   363     {
       
   364     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   365     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGMSSGMinimumSize" );
       
   366     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   367     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   368 
       
   369     CListBoxView* boxView = iGrid->MakeViewClassInstanceL();
       
   370     CleanupStack::PushL( boxView );
       
   371     STIF_ASSERT_NOT_NULL( iGrid );
       
   372     CleanupStack::PopAndDestroy( boxView );
       
   373 
       
   374     return KErrNone;
       
   375     }
       
   376 
       
   377 // -----------------------------------------------------------------------------
       
   378 // CTestSDKGrids::TestGridsGridSetColumnWidth
       
   379 // -----------------------------------------------------------------------------
       
   380 //
       
   381 TInt CTestSDKGrids::TestGridsGridSetColumnWidth( CStifItemParser& /*aItem*/ )
       
   382     {
       
   383     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   384     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGMSSGMinimumSize" );
       
   385     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   386     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   387 
       
   388     iGrid->SetColumnWidth( KColumnWidthTwo );
       
   389     iGrid->SetColumnWidth( KColumnWidthZero );
       
   390 
       
   391     return KErrNone;
       
   392     }
       
   393 
       
   394 // -----------------------------------------------------------------------------
       
   395 // CTestSDKGrids::TestGridsGridColumnWidth
       
   396 // -----------------------------------------------------------------------------
       
   397 //
       
   398 TInt CTestSDKGrids::TestGridsGridColumnWidth( CStifItemParser& /*aItem*/ )
       
   399     {
       
   400     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   401     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGMSSGMinimumSize" );
       
   402     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   403     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   404 
       
   405     TInt width = iGrid->ColumnWidth();
       
   406     STIF_ASSERT_EQUALS( KColumnWidthTwo, width );
       
   407 
       
   408     return KErrNone;
       
   409     }
       
   410 
       
   411 // -----------------------------------------------------------------------------
       
   412 // CTestSDKGrids::TestGridsGridUpdateScrollBarsL
       
   413 // -----------------------------------------------------------------------------
       
   414 //
       
   415 TInt CTestSDKGrids::TestGridsGridUpdateScrollBarsL( CStifItemParser& /*aItem*/ )
       
   416     {
       
   417     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   418     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGMSSGMinimumSize" );
       
   419     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   420     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   421 
       
   422     TInt err = KErrNone;
       
   423     TRAP( err, iGrid->UpdateScrollBarsL() );
       
   424 
       
   425     return err;
       
   426     }
       
   427 
       
   428 // -----------------------------------------------------------------------------
       
   429 // CTestSDKGrids::TestGridsGridHandleItemAdditionL
       
   430 // -----------------------------------------------------------------------------
       
   431 //
       
   432 TInt CTestSDKGrids::TestGridsGridHandleItemAdditionL( CStifItemParser& /*aItem*/ )
       
   433     {
       
   434     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   435     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGMSSGMinimumSize" );
       
   436     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   437     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   438 
       
   439     TInt err = KErrNone;
       
   440     TRAP( err, iGrid->HandleItemAdditionL() );
       
   441 
       
   442     return err;
       
   443     }
       
   444 
       
   445 // -----------------------------------------------------------------------------
       
   446 // CTestSDKGrids::TestGridsGridHandleItemRemovalL
       
   447 // -----------------------------------------------------------------------------
       
   448 //
       
   449 TInt CTestSDKGrids::TestGridsGridHandleItemRemovalL( CStifItemParser& /*aItem*/ )
       
   450     {
       
   451     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   452     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGMSSGMinimumSize" );
       
   453     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   454     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   455 
       
   456     TInt err = KErrNone;
       
   457     TRAP( err, iGrid->HandleItemRemovalL() );
       
   458 
       
   459     return err;
       
   460     }
       
   461 
       
   462 // -----------------------------------------------------------------------------
       
   463 // CTestSDKGrids::TestGridsGridOfferKeyEventL
       
   464 // -----------------------------------------------------------------------------
       
   465 //
       
   466 TInt CTestSDKGrids::TestGridsGridOfferKeyEventL( CStifItemParser& /*aItem*/ )
       
   467     {
       
   468     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   469     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGMSSGMinimumSize" );
       
   470     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   471     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   472 
       
   473     TKeyEvent keyEvent1 = { EKeyPause, EStdKeySpace, 0, 0  };
       
   474     TKeyResponse response = iGrid->OfferKeyEventL( keyEvent1, EEventNull );
       
   475     TKeyEvent keyEvent2 = { EKeyUpArrow, EStdKeySpace, 0, 0  };
       
   476     response = iGrid->OfferKeyEventL( keyEvent2, EEventNull );
       
   477     TKeyEvent keyEvent3 = { EKeyDownArrow, EStdKeySpace, 0, 0  };
       
   478     response = iGrid->OfferKeyEventL( keyEvent3, EEventNull );
       
   479     TKeyEvent keyEvent4 = { EKeyLeftArrow, EStdKeySpace, 0, 0  };
       
   480     response = iGrid->OfferKeyEventL( keyEvent4, EEventNull );
       
   481     TKeyEvent keyEvent5 = { EKeyRightArrow, EStdKeySpace, 0, 0  };
       
   482     response = iGrid->OfferKeyEventL( keyEvent5, EEventNull );
       
   483     TKeyEvent keyEvent6 = { EKeyPageUp, EStdKeySpace, 0, 0  };
       
   484     response = iGrid->OfferKeyEventL( keyEvent6, EEventNull );
       
   485     TKeyEvent keyEvent7 = { EKeyPageDown, EStdKeySpace, 0, 0  };
       
   486     response = iGrid->OfferKeyEventL( keyEvent7, EEventNull );
       
   487     TKeyEvent keyEvent8 = { EKeyHome, EStdKeySpace, 0, 0  };
       
   488     response = iGrid->OfferKeyEventL( keyEvent8, EEventNull );
       
   489     TKeyEvent keyEvent9 = { EKeyEnd, EStdKeySpace, 0, 0  };
       
   490     response = iGrid->OfferKeyEventL( keyEvent9, EEventNull );
       
   491 
       
   492     return KErrNone;
       
   493     }
       
   494 
       
   495 // -----------------------------------------------------------------------------
       
   496 // CTestSDKGrids::TestGridsGridSetItemHeightL
       
   497 // -----------------------------------------------------------------------------
       
   498 //
       
   499 TInt CTestSDKGrids::TestGridsGridSetItemHeightL( CStifItemParser& /*aItem*/ )
       
   500     {
       
   501     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   502     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGMSSGMinimumSize" );
       
   503     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   504     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   505 
       
   506     iGrid->SetItemHeightL( KZero );
       
   507     iGrid->SetItemHeightL( KTwo );
       
   508 
       
   509     return KErrNone;
       
   510     }
       
   511 
       
   512 // -----------------------------------------------------------------------------
       
   513 // CTestSDKGrids::TestGridsGridSizeChanged
       
   514 // -----------------------------------------------------------------------------
       
   515 //
       
   516 TInt CTestSDKGrids::TestGridsGridSizeChanged( CStifItemParser& /*aItem*/ )
       
   517     {
       
   518     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   519     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGMSSGMinimumSize" );
       
   520     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   521     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   522 
       
   523     iGrid->SizeChanged();
       
   524     
       
   525     return KErrNone;
       
   526     }
       
   527 
       
   528 // -----------------------------------------------------------------------------
       
   529 // CTestSDKGrids::TestGridsGridModel
       
   530 // -----------------------------------------------------------------------------
       
   531 //
       
   532 TInt CTestSDKGrids::TestGridsGridModel( CStifItemParser& /*aItem*/ )
       
   533     {
       
   534     _LIT( Ktestsdkgrid, "testsdkgrid" );
       
   535     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGMSSGMinimumSize" );
       
   536     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   537     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   538 
       
   539     CTextListBoxModel* listBoxModel = iGrid->Model();
       
   540 
       
   541     return KErrNone;
       
   542     }
       
   543 
       
   544 // -----------------------------------------------------------------------------
       
   545 // CTestSDKGrids::TestGridsGridSetRect
       
   546 // -----------------------------------------------------------------------------
       
   547 //
       
   548 TInt CTestSDKGrids::TestGridsGridSetRectL( CStifItemParser& /*aItem*/ )
       
   549     {
       
   550     _LIT( Ktestsdkgrid, "testsetrect" );
       
   551     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGridSetRect" );
       
   552     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   553     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   554     
       
   555     CAknGrid* grid = new( ELeave ) CAknGrid();
       
   556     CleanupStack::PushL( grid );
       
   557     
       
   558     CAknGridM* model = new( ELeave ) CAknGridM();
       
   559     CleanupStack::PushL( model );
       
   560     grid->SetModel( model );
       
   561     CleanupStack::Pop( model );
       
   562     
       
   563     grid->SetContainerWindowL( *iContainer );
       
   564     
       
   565     TResourceReader reader;
       
   566     CEikonEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDKGRIDS_GRID );
       
   567     grid->ConstructFromResourceL( reader );
       
   568     
       
   569     TPoint topleftpoint( 0, 0 );
       
   570     TPoint bottomrightpoint( 10, 10 );
       
   571     TRect rect( topleftpoint, bottomrightpoint );
       
   572     grid->SetRect( rect );
       
   573     
       
   574     CleanupStack::PopAndDestroy( 2 );
       
   575     return KErrNone;
       
   576     }
       
   577 
       
   578 // -----------------------------------------------------------------------------
       
   579 // CTestSDKGrids::TestGridsGridHandleViewRectSizeChangeL
       
   580 // -----------------------------------------------------------------------------
       
   581 //
       
   582 TInt CTestSDKGrids::TestGridsGridHandleViewRectSizeChangeL( CStifItemParser& /*aItem*/ )
       
   583     {
       
   584     _LIT( Ktestsdkgrid, "testsetrect" );
       
   585     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGridSetRect" );
       
   586     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   587     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   588     
       
   589     CAknGrid* grid = new( ELeave ) CAknGrid();
       
   590     CleanupStack::PushL( grid );
       
   591     
       
   592     CAknGridM* model = new( ELeave ) CAknGridM();
       
   593     CleanupStack::PushL( model );
       
   594     grid->SetModel( model );
       
   595     CleanupStack::Pop( model );
       
   596     
       
   597     grid->SetContainerWindowL( *iContainer );
       
   598     
       
   599     TResourceReader reader;
       
   600     CEikonEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDKGRIDS_GRID );
       
   601     grid->ConstructFromResourceL( reader );
       
   602     
       
   603     TInt err;
       
   604     TRAP( err, grid->HandleViewRectSizeChangeL() );
       
   605     
       
   606     CleanupStack::PopAndDestroy( 2 );
       
   607     return err;
       
   608     }
       
   609 
       
   610 // -----------------------------------------------------------------------------
       
   611 // CTestSDKGrids::TestGridsGridSetTopItemIndexL
       
   612 // -----------------------------------------------------------------------------
       
   613 //
       
   614 TInt CTestSDKGrids::TestGridsGridSetTopItemIndexL( CStifItemParser& /*aItem*/ )
       
   615     {
       
   616     _LIT( Ktestsdkgrid, "testsetrect" );
       
   617     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGridSetRect" );
       
   618     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   619     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   620     
       
   621     CAknGrid* grid = new( ELeave ) CAknGrid();
       
   622     CleanupStack::PushL( grid );
       
   623     
       
   624     CAknGridM* model = new( ELeave ) CAknGridM();
       
   625     CleanupStack::PushL( model );
       
   626     grid->SetModel( model );
       
   627     CleanupStack::Pop( model );
       
   628     
       
   629     grid->SetContainerWindowL( *iContainer );
       
   630     
       
   631     TResourceReader reader;
       
   632     CEikonEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDKGRIDS_GRID );
       
   633     grid->ConstructFromResourceL( reader );
       
   634         
       
   635     grid->SetTopItemIndex( KOne );
       
   636     CleanupStack::PopAndDestroy( 2 );
       
   637     
       
   638     return KErrNone;
       
   639     }
       
   640 
       
   641 // -----------------------------------------------------------------------------
       
   642 // CTestSDKGrids::TestGridsGridHandleResourceChangeL
       
   643 // -----------------------------------------------------------------------------
       
   644 //
       
   645 TInt CTestSDKGrids::TestGridsGridHandleResourceChangeL( CStifItemParser& /*aItem*/ )
       
   646     {
       
   647     _LIT( Ktestsdkgrid, "testsetrect" );
       
   648     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGridSetRect" );
       
   649     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   650     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   651     
       
   652     CAknGrid* grid = new( ELeave ) CAknGrid();
       
   653     CleanupStack::PushL( grid );
       
   654     
       
   655     CAknGridM* model = new( ELeave ) CAknGridM();
       
   656     CleanupStack::PushL( model );
       
   657     grid->SetModel( model );
       
   658     CleanupStack::Pop( model );
       
   659     
       
   660     grid->SetContainerWindowL( *iContainer );
       
   661         
       
   662     TResourceReader reader;
       
   663     CEikonEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDKGRIDS_GRID );
       
   664     grid->ConstructFromResourceL( reader );
       
   665         
       
   666     grid->HandleResourceChange( KEikMessageFadeAllWindows );
       
   667     
       
   668     CleanupStack::PopAndDestroy( KTwo );
       
   669     return KErrNone;
       
   670     }
       
   671 
       
   672 // -----------------------------------------------------------------------------
       
   673 // CTestSDKGrids::TestGridsGridFocusChangedL
       
   674 // -----------------------------------------------------------------------------
       
   675 //
       
   676 TInt CTestSDKGrids::TestGridsGridFocusChangedL( CStifItemParser& )
       
   677     {
       
   678     _LIT( Ktestsdkgrid, "testsetrect" );
       
   679     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGridSetRect" );
       
   680     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   681     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   682     
       
   683     CAknGrid* grid = new( ELeave ) CAknGrid();
       
   684     CleanupStack::PushL( grid );
       
   685     
       
   686     CAknGridM* model = new( ELeave ) CAknGridM();
       
   687     CleanupStack::PushL( model );
       
   688     grid->SetModel( model );
       
   689     CleanupStack::Pop( model );
       
   690     
       
   691     grid->SetContainerWindowL( *iContainer );
       
   692         
       
   693     TResourceReader reader;
       
   694     CEikonEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDKGRIDS_GRID );
       
   695     grid->ConstructFromResourceL( reader );
       
   696     
       
   697     grid->SetFocus( ETrue );
       
   698     grid->FocusChanged( EDrawNow );
       
   699     grid->FocusChanged( ENoDrawNow );
       
   700     
       
   701     grid->SetFocus( EFalse );
       
   702     grid->FocusChanged( EDrawNow );
       
   703     grid->FocusChanged( ENoDrawNow );
       
   704     
       
   705     CleanupStack::PopAndDestroy( KTwo );
       
   706     return KErrNone;
       
   707     }
       
   708 
       
   709 // -----------------------------------------------------------------------------
       
   710 // CTestSDKGrids::TestGridsGridHorizontalNudgeValueL
       
   711 // -----------------------------------------------------------------------------
       
   712 //
       
   713 TInt CTestSDKGrids::TestGridsGridHorizontalNudgeValueL( CStifItemParser& /*aItem*/ )
       
   714     {
       
   715     _LIT( Ktestsdkgrid, "testsetrect" );
       
   716     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGridSetRect" );
       
   717     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   718     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   719     
       
   720     CAknGridExt* grid = new( ELeave ) CAknGridExt();
       
   721     CleanupStack::PushL( grid );
       
   722     
       
   723     CAknGridM* model = new( ELeave ) CAknGridM();
       
   724     CleanupStack::PushL( model );
       
   725     grid->SetModel( model );
       
   726     CleanupStack::Pop( model );
       
   727     
       
   728     grid->SetContainerWindowL( *iContainer );
       
   729         
       
   730     TResourceReader reader;
       
   731     CEikonEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDKGRIDS_GRID );
       
   732     grid->ConstructFromResourceL( reader );
       
   733     
       
   734     TInt returnvalue = grid->HorizontalNudgeValue();
       
   735     STIF_ASSERT_EQUALS( KOne, returnvalue );
       
   736     
       
   737     CleanupStack::PopAndDestroy( KTwo );
       
   738     return KErrNone;
       
   739     }
       
   740 
       
   741 // -----------------------------------------------------------------------------
       
   742 // CTestSDKGrids::TestGridsGridHorizScrollGranularityInPixels
       
   743 // -----------------------------------------------------------------------------
       
   744 //
       
   745 TInt CTestSDKGrids::TestGridsGridHorizScrollGranularityInPixelsL( CStifItemParser& /*aItem*/ )
       
   746     {
       
   747     _LIT( Ktestsdkgrid, "testsetrect" );
       
   748     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGridSetRect" );
       
   749     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   750     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   751     
       
   752     CAknGridExt* grid = new( ELeave ) CAknGridExt();
       
   753     CleanupStack::PushL( grid );
       
   754     
       
   755     CAknGridM* model = new( ELeave ) CAknGridM();
       
   756     CleanupStack::PushL( model );
       
   757     grid->SetModel( model );
       
   758     CleanupStack::Pop( model );
       
   759     
       
   760     grid->SetContainerWindowL( *iContainer );
       
   761         
       
   762     TResourceReader reader;
       
   763     CEikonEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDKGRIDS_GRID );
       
   764     grid->ConstructFromResourceL( reader );
       
   765     
       
   766     grid->SetColumnWidth( KThree );
       
   767     TInt returnvalue = grid->HorizScrollGranularityInPixels();
       
   768     STIF_ASSERT_EQUALS( KThree, returnvalue );
       
   769     
       
   770     CleanupStack::PopAndDestroy( KTwo );
       
   771     return KErrNone;
       
   772     }
       
   773 
       
   774 // -----------------------------------------------------------------------------
       
   775 // CTestSDKGrids::TestGridsGridAdjustTopItemIndex
       
   776 // -----------------------------------------------------------------------------
       
   777 //
       
   778 TInt CTestSDKGrids::TestGridsGridAdjustTopItemIndexL( CStifItemParser& /*aItem*/ )
       
   779     {
       
   780     _LIT( Ktestsdkgrid, "testsetrect" );
       
   781     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGridSetRect" );
       
   782     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   783     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   784     
       
   785     CAknGridExt* grid = new( ELeave ) CAknGridExt();
       
   786     CleanupStack::PushL( grid );
       
   787     
       
   788     CAknGridM* model = new( ELeave ) CAknGridM();
       
   789     CleanupStack::PushL( model );
       
   790     grid->SetModel( model );
       
   791     CleanupStack::Pop( model );
       
   792     
       
   793     grid->SetContainerWindowL( *iContainer );
       
   794         
       
   795     TResourceReader reader;
       
   796     CEikonEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDKGRIDS_GRID );
       
   797     grid->ConstructFromResourceL( reader );
       
   798     
       
   799     grid->SetTopItemIndex( KThree );
       
   800     grid->AdjustTopItemIndex();
       
   801     CleanupStack::PopAndDestroy( KTwo );
       
   802     
       
   803     return KErrNone;
       
   804     }
       
   805 
       
   806 // -----------------------------------------------------------------------------
       
   807 // CTestSDKGrids::TestGridsGridHandleDragEventL
       
   808 // -----------------------------------------------------------------------------
       
   809 //
       
   810 TInt CTestSDKGrids::TestGridsGridHandleDragEventL( CStifItemParser& /*aItem*/ )
       
   811     {
       
   812     _LIT( Ktestsdkgrid, "testsetrect" );
       
   813     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGridSetRect" );
       
   814     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   815     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   816     
       
   817     CAknGridExt* grid = new( ELeave ) CAknGridExt();
       
   818     CleanupStack::PushL( grid );
       
   819     
       
   820     
       
   821     CAknGridM* model = new( ELeave ) CAknGridM();
       
   822     CleanupStack::PushL( model );
       
   823     grid->SetModel( model );
       
   824     CleanupStack::Pop( model );
       
   825     
       
   826     grid->SetContainerWindowL( *iContainer );
       
   827         
       
   828     TResourceReader reader;
       
   829     CEikonEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDKGRIDS_GRID );
       
   830     grid->ConstructFromResourceL( reader );
       
   831     
       
   832     grid->ConstructL( iContainer, KOne );
       
   833     TInt err;
       
   834     TRAP( err, grid->HandleDragEventL( TPoint( KMinusone, KOne )));
       
   835     TRAP( err, grid->HandleDragEventL( TPoint( KMinusone, KMinusone )));
       
   836     TRAP( err, grid->HandleDragEventL( TPoint( KOne, KOne )));
       
   837     CleanupStack::PopAndDestroy( KTwo );
       
   838     
       
   839     return KErrNone;
       
   840     }
       
   841 
       
   842 // -----------------------------------------------------------------------------
       
   843 // CTestSDKGrids::TestGridsGridRestoreClientRectFromViewRectL
       
   844 // -----------------------------------------------------------------------------
       
   845 //
       
   846 TInt CTestSDKGrids::TestGridsGridRestoreClientRectFromViewRectL( CStifItemParser& /*aItem*/ )
       
   847     {
       
   848     _LIT( Ktestsdkgrid, "testsetrect" );
       
   849     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGridSetRect" );
       
   850     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   851     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   852     
       
   853     CAknGridExt* grid = new( ELeave ) CAknGridExt();
       
   854     CleanupStack::PushL( grid );
       
   855     
       
   856     CAknGridM* model = new( ELeave ) CAknGridM();
       
   857     CleanupStack::PushL( model );
       
   858     grid->SetModel( model );
       
   859     CleanupStack::Pop( model );
       
   860         
       
   861     grid->SetContainerWindowL( *iContainer );
       
   862         
       
   863     TResourceReader reader;
       
   864     CEikonEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDKGRIDS_GRID );
       
   865     grid->ConstructFromResourceL( reader );
       
   866     
       
   867     TPoint point( KZero, KZero );
       
   868     TRect rect( point, point );
       
   869     
       
   870     TInt err;
       
   871     TRAP( err, grid->RestoreClientRectFromViewRect( rect ));
       
   872     
       
   873     CleanupStack::PopAndDestroy( KTwo );
       
   874     return err;
       
   875     }
       
   876 
       
   877 // -----------------------------------------------------------------------------
       
   878 // CTestSDKGrids::TestGridsGridAdjustRectHeightToWholeNumberOfItemsL
       
   879 // -----------------------------------------------------------------------------
       
   880 //
       
   881 TInt CTestSDKGrids::TestGridsGridAdjustRectHeightToWholeNumberOfItemsL( CStifItemParser& /*aItem*/ )
       
   882     {
       
   883     _LIT( Ktestsdkgrid, "testsetrect" );
       
   884     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGridSetRect" );
       
   885     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   886     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   887     
       
   888     CAknGridExt* grid = new( ELeave ) CAknGridExt();
       
   889     CleanupStack::PushL( grid );
       
   890     
       
   891     CAknGridM* model = new( ELeave ) CAknGridM();
       
   892     CleanupStack::PushL( model );
       
   893     grid->SetModel( model );
       
   894     CleanupStack::Pop( model );
       
   895     
       
   896     grid->SetContainerWindowL( *iContainer );
       
   897     
       
   898     TResourceReader reader;
       
   899     CEikonEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDKGRIDS_GRID );
       
   900     grid->ConstructFromResourceL( reader );
       
   901     
       
   902     grid->SetRect( iContainer->Rect());
       
   903     TPoint topleftpoint( KZero, KZero );
       
   904     TPoint rightbottompoint( KTwo, KTwo );
       
   905     TRect rect( topleftpoint, rightbottompoint );
       
   906     TInt returnvalue = grid->AdjustRectHeightToWholeNumberOfItems( rect );
       
   907     STIF_ASSERT_NOT_EQUALS( KZero, returnvalue );
       
   908     
       
   909     CleanupStack::PopAndDestroy( KTwo );
       
   910     return KErrNone;
       
   911     }
       
   912 
       
   913 // -----------------------------------------------------------------------------
       
   914 // CTestSDKGrids::TestGridsGridUpdateScrollBarThumbsL
       
   915 // -----------------------------------------------------------------------------
       
   916 //
       
   917 TInt CTestSDKGrids::TestGridsGridUpdateScrollBarThumbsL( CStifItemParser& /*aItem*/ )
       
   918     {
       
   919     _LIT( Ktestsdkgrid, "testsetrect" );
       
   920     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGridSetRect" );
       
   921     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   922     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   923     
       
   924     CAknGridExt* grid = new( ELeave ) CAknGridExt();
       
   925     CleanupStack::PushL( grid );
       
   926     
       
   927     CAknGridM* model = new( ELeave ) CAknGridM();
       
   928     CleanupStack::PushL( model );
       
   929     grid->SetModel( model );
       
   930     CleanupStack::Pop( model );
       
   931     
       
   932     grid->SetContainerWindowL( *iContainer );
       
   933     
       
   934     TResourceReader reader;
       
   935     CEikonEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDKGRIDS_GRID );
       
   936     grid->ConstructFromResourceL( reader );
       
   937     
       
   938     CStifScrollBarObserver* scrollbarobserver = new( ELeave ) CStifScrollBarObserver();
       
   939     CleanupStack::PushL( scrollbarobserver );
       
   940     CEikScrollBarFrame* scrollbarframe = new( ELeave ) CEikScrollBarFrame( iContainer,scrollbarobserver );
       
   941     CleanupStack::PushL( scrollbarframe );
       
   942     grid->SetScrollBarFrame( scrollbarframe, CEikListBox::ENotOwnedExternally );
       
   943     CleanupStack::Pop( scrollbarframe );
       
   944     CleanupStack::Pop( scrollbarobserver );
       
   945     
       
   946     grid->UpdateScrollBarThumbs();
       
   947     CleanupStack::PopAndDestroy( KTwo );
       
   948     
       
   949     return KErrNone;
       
   950     }
       
   951 
       
   952 // -----------------------------------------------------------------------------
       
   953 // CTestSDKGrids::TestGridsGridCountComponentControlsL
       
   954 // -----------------------------------------------------------------------------
       
   955 //
       
   956 TInt CTestSDKGrids::TestGridsGridCountComponentControlsL( CStifItemParser& /*aItem*/ )
       
   957     {
       
   958     _LIT( Ktestsdkgrid, "testsetrect" );
       
   959     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGridSetRect" );
       
   960     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   961     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   962     
       
   963     CAknGridExt* grid = new( ELeave ) CAknGridExt();
       
   964     CleanupStack::PushL( grid );
       
   965     
       
   966     CAknGridM* model = new( ELeave ) CAknGridM();
       
   967     CleanupStack::PushL( model );
       
   968     grid->SetModel( model );
       
   969     CleanupStack::Pop( model );
       
   970         
       
   971     grid->SetContainerWindowL( *iContainer );
       
   972     
       
   973     TResourceReader reader;
       
   974     CEikonEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDKGRIDS_GRID );
       
   975     grid->ConstructFromResourceL( reader );
       
   976     
       
   977     grid->CountComponentControls();
       
   978     
       
   979     CleanupStack::PopAndDestroy( KTwo );
       
   980     return KErrNone;
       
   981     }
       
   982 
       
   983 // -----------------------------------------------------------------------------
       
   984 // CTestSDKGrids::TestGridsGridMoveToNextOrPreviousItemL
       
   985 // -----------------------------------------------------------------------------
       
   986 //
       
   987 TInt CTestSDKGrids::TestGridsGridMoveToNextOrPreviousItemL( CStifItemParser& /*aItem*/ )
       
   988     {
       
   989     _LIT( Ktestsdkgrid, "testsetrect" );
       
   990     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGridSetRect" );
       
   991     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
   992     iLog->Log( KTestGridsGMSSGMinimumSize );
       
   993     
       
   994     CAknGridExt* grid = new( ELeave ) CAknGridExt();
       
   995     CleanupStack::PushL( grid );
       
   996     
       
   997     CAknGridM* model = new( ELeave ) CAknGridM();
       
   998     CleanupStack::PushL( model );
       
   999     grid->SetModel( model );
       
  1000     CleanupStack::Pop( model );
       
  1001     
       
  1002     grid->SetContainerWindowL( *iContainer );
       
  1003         
       
  1004     TResourceReader reader;
       
  1005     CEikonEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDKGRIDS_GRID );
       
  1006     grid->ConstructFromResourceL( reader );
       
  1007     
       
  1008     
       
  1009     TInt err( KErrNone );
       
  1010     TRAP( err, grid->MoveToNextOrPreviousItemL( TPoint( KMinusone, KMinusone )));
       
  1011     TRAP( err, grid->MoveToNextOrPreviousItemL( TPoint( KOne, KTwo )));
       
  1012     TRAP( err, grid->MoveToNextOrPreviousItemL( TPoint( KTen, KThousand )));
       
  1013     
       
  1014     CleanupStack::PopAndDestroy( KTwo );
       
  1015     return err;
       
  1016     }
       
  1017 
       
  1018 // -----------------------------------------------------------------------------
       
  1019 // CTestSDKGrids::TestGridsGridCalcGridSizeL
       
  1020 // -----------------------------------------------------------------------------
       
  1021 //
       
  1022 TInt CTestSDKGrids::TestGridsGridCalcGridSizeL( CStifItemParser& /*aItem*/ )
       
  1023     {
       
  1024     _LIT( Ktestsdkgrid, "testsetrect" );
       
  1025     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGridSetRect" );
       
  1026     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
  1027     iLog->Log( KTestGridsGMSSGMinimumSize );
       
  1028     
       
  1029     CAknGridExt* grid = new( ELeave ) CAknGridExt();
       
  1030     CleanupStack::PushL( grid );
       
  1031     
       
  1032     CAknGridM* model = new( ELeave ) CAknGridM();
       
  1033     CleanupStack::PushL( model );
       
  1034     grid->SetModel( model );
       
  1035     CleanupStack::Pop( model );
       
  1036         
       
  1037     grid->SetContainerWindowL( *iContainer );
       
  1038     
       
  1039     TResourceReader reader;
       
  1040     CEikonEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDKGRIDS_GRID );
       
  1041     grid->ConstructFromResourceL( reader );
       
  1042     
       
  1043     TSize size = iContainer->Rect().Size( );
       
  1044     grid->SetLayoutL( ETrue, ETrue, ETrue, KOne, KOne, size, KZero, KZero );
       
  1045     TInt err( KErrNone );
       
  1046     TRAP( err, grid->CalcGridSizeL());
       
  1047     
       
  1048     CleanupStack::PopAndDestroy( KTwo );
       
  1049     return err;
       
  1050     }
       
  1051 
       
  1052 // -----------------------------------------------------------------------------
       
  1053 // CTestSDKGrids::TestGridsGridCreateItemDrawerL
       
  1054 // -----------------------------------------------------------------------------
       
  1055 //
       
  1056 TInt CTestSDKGrids::TestGridsGridCreateItemDrawerL( CStifItemParser& /*aItem*/ )
       
  1057     {
       
  1058     _LIT( Ktestsdkgrid, "testsetrect" );
       
  1059     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGridSetRect" );
       
  1060     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
  1061     iLog->Log( KTestGridsGMSSGMinimumSize );
       
  1062     
       
  1063     CAknGridExt* grid = new( ELeave ) CAknGridExt();
       
  1064     CleanupStack::PushL( grid );
       
  1065     
       
  1066     CAknGridM* model = new( ELeave ) CAknGridM();
       
  1067     CleanupStack::PushL( model );
       
  1068     grid->SetModel( model );
       
  1069     CleanupStack::Pop( model );
       
  1070     
       
  1071     grid->SetContainerWindowL( *iContainer );
       
  1072         
       
  1073     TResourceReader reader;
       
  1074     CEikonEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDKGRIDS_GRID );
       
  1075     grid->ConstructFromResourceL( reader );
       
  1076     
       
  1077     grid->SetContainerWindowL( *iContainer );
       
  1078     grid->SetRect( iContainer->Rect() );
       
  1079     
       
  1080     TInt err( KErrNone );
       
  1081     TRAP( err, grid->CreateItemDrawerL() );
       
  1082     
       
  1083     CleanupStack::PopAndDestroy( KTwo );
       
  1084     return KErrNone;
       
  1085     }
       
  1086 
       
  1087 // -----------------------------------------------------------------------------
       
  1088 // CTestSDKGrids::TestGridsGridHandleScrollEventL
       
  1089 // -----------------------------------------------------------------------------
       
  1090 //
       
  1091 TInt CTestSDKGrids::TestGridsGridHandleScrollEventL( CStifItemParser& /*aItem*/ )
       
  1092     {
       
  1093     _LIT( Ktestsdkgrid, "testsetrect" );
       
  1094     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGridSetRect" );
       
  1095     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
  1096     iLog->Log( KTestGridsGMSSGMinimumSize );
       
  1097     
       
  1098     CAknGridExt* grid = new( ELeave ) CAknGridExt();
       
  1099     CleanupStack::PushL( grid );
       
  1100     
       
  1101     CAknGridM* model = new( ELeave ) CAknGridM();
       
  1102     CleanupStack::PushL( model );
       
  1103     grid->SetModel( model );
       
  1104     CleanupStack::Pop( model );
       
  1105     
       
  1106     grid->SetContainerWindowL( *iContainer );
       
  1107         
       
  1108     TResourceReader reader;
       
  1109     CEikonEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDKGRIDS_GRID );
       
  1110     grid->ConstructFromResourceL( reader );
       
  1111     
       
  1112     grid->SetRect( iContainer->Rect() );
       
  1113     
       
  1114     CEikScrollBar *scrollbar = new( ELeave ) CEikScrollBar();
       
  1115     CleanupStack::PushL( scrollbar );
       
  1116     
       
  1117     grid->HandleScrollEventL( scrollbar, EEikScrollLeft );
       
  1118     grid->HandleScrollEventL( scrollbar, EEikScrollUp );
       
  1119     grid->HandleScrollEventL( scrollbar, EEikScrollRight );
       
  1120     grid->HandleScrollEventL( scrollbar, EEikScrollDown );
       
  1121     grid->HandleScrollEventL( scrollbar, EEikScrollPageLeft );
       
  1122     grid->HandleScrollEventL( scrollbar, EEikScrollPageUp );
       
  1123     grid->HandleScrollEventL( scrollbar, EEikScrollPageRight );
       
  1124     grid->HandleScrollEventL( scrollbar, EEikScrollPageDown );
       
  1125     grid->HandleScrollEventL( scrollbar, EEikScrollHome );
       
  1126     grid->HandleScrollEventL( scrollbar, EEikScrollTop );
       
  1127     grid->HandleScrollEventL( scrollbar, EEikScrollEnd );
       
  1128     grid->HandleScrollEventL( scrollbar, EEikScrollBottom );
       
  1129     grid->HandleScrollEventL( scrollbar, EEikScrollThumbDragHoriz );
       
  1130     grid->HandleScrollEventL( scrollbar, EEikScrollThumbDragVert );
       
  1131     grid->HandleScrollEventL( scrollbar, EEikScrollThumbReleaseHoriz );
       
  1132     grid->HandleScrollEventL( scrollbar, EEikScrollThumbReleaseVert );
       
  1133     
       
  1134     CleanupStack::PopAndDestroy( scrollbar );
       
  1135     CleanupStack::PopAndDestroy( KTwo );
       
  1136     return KErrNone;
       
  1137     }
       
  1138 
       
  1139 // -----------------------------------------------------------------------------
       
  1140 // CTestSDKGrids::TestGridsGridMopSupplyObjectL
       
  1141 // -----------------------------------------------------------------------------
       
  1142 //
       
  1143 TInt CTestSDKGrids::TestGridsGridMopSupplyObjectL( CStifItemParser& /*aItem*/ )
       
  1144     {
       
  1145     _LIT( Ktestsdkgrid, "testsetrect" );
       
  1146     _LIT( KTestGridsGMSSGMinimumSize, "In TestGridsGridSetRect" );
       
  1147     TestModuleIf().Printf( 0, Ktestsdkgrid, KTestGridsGMSSGMinimumSize );
       
  1148     iLog->Log( KTestGridsGMSSGMinimumSize );
       
  1149     
       
  1150     CAknGridExt* grid = new( ELeave ) CAknGridExt;
       
  1151     CleanupStack::PushL( grid );
       
  1152     
       
  1153     CAknGridM* model = new( ELeave ) CAknGridM();
       
  1154     CleanupStack::PushL( model );
       
  1155     grid->SetModel( model );
       
  1156     CleanupStack::Pop( model );
       
  1157         
       
  1158     grid->SetContainerWindowL( *iContainer );
       
  1159     TResourceReader reader;
       
  1160     CEikonEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDKGRIDS_GRID );
       
  1161     grid->ConstructFromResourceL( reader );
       
  1162     
       
  1163     const TTypeUid KTestUid = 0x1000008D;
       
  1164     TTypeUid::Ptr returnptr = grid->MopSupplyObject( KTestUid );
       
  1165     STIF_ASSERT_NOT_NULL( &returnptr );
       
  1166     
       
  1167     CleanupStack::PopAndDestroy( KTwo );
       
  1168     return KErrNone;
       
  1169     }
       
  1170 
       
  1171 /*
       
  1172  * End files
       
  1173  */