uifw/AvKon/tsrc/bc/S60_SDK5.0/bctestappfrm/src/bctestaknapplication.cpp
changeset 0 2f259fa3e83a
child 10 3d340a0166ff
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2009 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:
       
    15 *
       
    16 */
       
    17 #include <aknserverapp.h>
       
    18 #include <aknapp.h>
       
    19 #include <eikenv.h>
       
    20 #include <eikappui.h>
       
    21 #include "bctestaknapplication.h"
       
    22 #include "bctestappfrm.hrh"
       
    23 #include "streamlogger.h"
       
    24 
       
    25 // ----------------------------------------------------------------------------
       
    26 // ctor, do nothing.
       
    27 // ----------------------------------------------------------------------------
       
    28 //
       
    29 CBCTestAknApplication::CBCTestAknApplication()
       
    30     {
       
    31     }
       
    32 
       
    33 // ----------------------------------------------------------------------------
       
    34 // dtor, do nothing.
       
    35 // ----------------------------------------------------------------------------
       
    36 //
       
    37 CBCTestAknApplication::~CBCTestAknApplication()
       
    38     {
       
    39     }
       
    40 
       
    41 // ----------------------------------------------------------------------------
       
    42 // symbian 2nd phase ctor.
       
    43 // ----------------------------------------------------------------------------
       
    44 //
       
    45 void CBCTestAknApplication::ConstructL()
       
    46     {
       
    47     BuildScriptL();
       
    48     }
       
    49 
       
    50 // ----------------------------------------------------------------------------
       
    51 // symbian NewL.
       
    52 // ----------------------------------------------------------------------------
       
    53 //
       
    54 CBCTestAknApplication* CBCTestAknApplication::NewL()
       
    55     {
       
    56     CBCTestAknApplication* self = new ( ELeave ) CBCTestAknApplication();
       
    57     CleanupStack::PushL(self);
       
    58     self->ConstructL();
       
    59     CleanupStack::Pop(self);
       
    60     return self;
       
    61     }
       
    62 
       
    63 // ----------------------------------------------------------------------------
       
    64 // override the CBCTestCase::RunL, only response to the related command ID.
       
    65 // ----------------------------------------------------------------------------
       
    66 //
       
    67 void CBCTestAknApplication::RunL(int aCmd)
       
    68     {
       
    69     if(aCmd != EBCTestCmdApplication) return;
       
    70     SetupL();
       
    71     TestL();
       
    72     TearDownL();
       
    73     }
       
    74 
       
    75 // ----------------------------------------------------------------------------
       
    76 // build the test scripts for this test case.
       
    77 // ----------------------------------------------------------------------------
       
    78 //
       
    79 void CBCTestAknApplication::BuildScriptL()
       
    80     {
       
    81     const TInt scripts[] =
       
    82         {
       
    83         DELAY(1),        // delay between commands is 1*0.1 seconds = 0.1 seconds
       
    84         LeftCBA, 
       
    85         //REP(Down, n),
       
    86         LeftCBA
       
    87         };
       
    88     AddTestScriptL(scripts, sizeof(scripts)/sizeof(TInt));
       
    89     }
       
    90 
       
    91 void CBCTestAknApplication::TestIniFileL(CAknApplication* aApp, RFs& aFs)
       
    92 {
       
    93 	// In fact OpenIniFileLC do nothing with clean up stack, but leave with
       
    94 	// not supported error.
       
    95 	aApp->OpenIniFileLC(aFs);
       
    96 }
       
    97 
       
    98 // ----------------------------------------------------------------------------
       
    99 // test the volume setting page creation api.
       
   100 // ----------------------------------------------------------------------------
       
   101 //
       
   102 void CBCTestAknApplication::TestL()
       
   103     {
       
   104     CAknApplication* app = static_cast<CAknApplication*>(CEikonEnv::Static()->EikAppUi()->Application());
       
   105 
       
   106     //app->PreDocConstructL();    //TO DO: need a release, but dono
       
   107     //AssertTrueL(ETrue, _L("CAknApplication::PreDocConstructL() invoked."));
       
   108 
       
   109     RFs& fs = CEikonEnv::Static()->FsSession();
       
   110     TRAPD( err, TestIniFileL(app, fs));
       
   111     if(err == KErrNotSupported){
       
   112         AssertTrueL(ETrue, _L("CAknApplication::OpenIniFileLC () isn't supported in S60"));
       
   113     }
       
   114 
       
   115     CApaAppServer* server = NULL;
       
   116     app->NewAppServerL(server);
       
   117     CleanupStack::PushL(server);
       
   118     AssertNotNullL(server, _L("CAknApplication::NewAppServerL() invoked."));
       
   119     CleanupStack::PopAndDestroy(server);    //server
       
   120     }
       
   121 
       
   122 // ----------------------------------------------------------------------------
       
   123 // prepare for the test.
       
   124 // ----------------------------------------------------------------------------
       
   125 //
       
   126 void CBCTestAknApplication::SetupL()
       
   127     {
       
   128     }
       
   129 
       
   130 // ----------------------------------------------------------------------------
       
   131 // do release jobs.
       
   132 // ----------------------------------------------------------------------------
       
   133 //
       
   134 void CBCTestAknApplication::TearDownL()
       
   135     {
       
   136     }
       
   137 
       
   138 //end of file