localisation/apparchitecture/tef/TAppInstall/TestAppInstall.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Source file for the testing T_AppListFileUpdateStep test step.
       
    15 // TestAppInstall.cpp is a simple Hello World GUI application.
       
    16 // In test build of ..\..\apparc\group TestAppInstall.RSC is created.
       
    17 // T_SyncAppListAndFileUpdate installs the RSC file into C:\private\10003a3f\import\apps
       
    18 // and Tests that Modified time after installation of RSC is more than 
       
    19 // Modified time before installation.
       
    20 // 
       
    21 //
       
    22 
       
    23 
       
    24 
       
    25 /**
       
    26  @file
       
    27  @test
       
    28  @internalComponent - Internal Symbian test code
       
    29 */
       
    30 
       
    31 #include <eikstart.h>
       
    32 
       
    33 
       
    34 #include "TestAppInstall.h"
       
    35 
       
    36 const TUid KUidTestAppInstall = { 0x102826DD };
       
    37 
       
    38 
       
    39 ////////////////////////////////////////////////////////////////////////
       
    40 //
       
    41 // Implementation of the application class - CExampleApplication
       
    42 //
       
    43 ////////////////////////////////////////////////////////////////////////
       
    44 
       
    45 TUid CExampleApplication::AppDllUid() const
       
    46 	{
       
    47 	return KUidTestAppInstall;
       
    48 	}
       
    49 
       
    50 CApaDocument* CExampleApplication::CreateDocumentL()
       
    51 	{
       
    52 	return new (ELeave) CExampleDocument(*this);
       
    53 	}
       
    54 	
       
    55 
       
    56 ////////////////////////////////////////////////////////////////////////
       
    57 //
       
    58 // Implementation of the appui class - CExampleAppUi
       
    59 //
       
    60 ////////////////////////////////////////////////////////////////////////
       
    61 
       
    62 void CExampleAppUi::ConstructL()
       
    63     {
       
    64     BaseConstructL();
       
    65 	iAppView = CExampleAppView::NewL(ClientRect());
       
    66 	}
       
    67 
       
    68 CExampleAppUi::~CExampleAppUi()
       
    69 	{
       
    70 	delete iAppView;
       
    71 	}
       
    72 
       
    73 void CExampleAppUi::HandleCommandL(TInt aCommand)
       
    74 	{
       
    75 	switch (aCommand)
       
    76 		{
       
    77 		case EEikCmdExit: 
       
    78 			Exit();
       
    79 			break;
       
    80 		}
       
    81 	}
       
    82 
       
    83 
       
    84 
       
    85 ////////////////////////////////////////////////////////////////////////
       
    86 //
       
    87 // Implementation of the view class - CExampleAppView
       
    88 //
       
    89 ////////////////////////////////////////////////////////////////////////
       
    90 
       
    91 CExampleAppView::CExampleAppView()
       
    92 	{
       
    93 	}
       
    94 
       
    95 CExampleAppView* CExampleAppView::NewL(const TRect& aRect)
       
    96 	{
       
    97 	CExampleAppView* self = new(ELeave) CExampleAppView();
       
    98 	CleanupStack::PushL(self);
       
    99 	self->ConstructL(aRect);
       
   100 	CleanupStack::Pop();
       
   101 	return self;
       
   102 	}
       
   103 
       
   104 CExampleAppView::~CExampleAppView()
       
   105 	{
       
   106 	delete iExampleText;
       
   107 	}
       
   108 
       
   109 void CExampleAppView::ConstructL(const TRect& aRect)
       
   110     {
       
   111    	// Fetch the text from the resource file.
       
   112 	iExampleText = iEikonEnv->AllocReadResourceL(R_EXAMPLE_TEXT_TESTAPP);
       
   113 
       
   114     // Control is a window owning control
       
   115 	CreateWindowL();
       
   116 
       
   117    // Extent of the control. This is
       
   118    // the whole rectangle available to application.
       
   119    // The rectangle is passed to us from the application UI.
       
   120 	SetRect(aRect);
       
   121 
       
   122    // At this stage, the control is ready to draw so
       
   123    // we tell the UI framework by activating it.
       
   124 	ActivateL();
       
   125 	}
       
   126 
       
   127 
       
   128 void CExampleAppView::Draw(const TRect& /*aRect*/) const
       
   129 	{
       
   130 	CWindowGc& gc = SystemGc();			// Window graphics context
       
   131 	TRect      drawRect = Rect();		// Area in which we shall draw	
       
   132 	const CFont*     fontUsed;			// Font used for drawing text
       
   133 	
       
   134 	// Start with a clear screen
       
   135 	gc.Clear();
       
   136 	
       
   137 	// Draw an outline rectangle (the default pen and brush styles ensure this) slightly smaller than the drawing area.
       
   138 	drawRect.Shrink(10,10);		   	
       
   139 	gc.DrawRect(drawRect);
       
   140     
       
   141     // Use the title font supplied by the UI
       
   142 	fontUsed = iEikonEnv->TitleFont();
       
   143 	gc.UseFont(fontUsed);
       
   144 	
       
   145 	// Draw the text in the middle of the rectangle.
       
   146 	TInt   baselineOffset=(drawRect.Height() - fontUsed->HeightInPixels())/2; 
       
   147 	gc.DrawText(*iExampleText,drawRect,baselineOffset,CGraphicsContext::ECenter, 0);
       
   148     
       
   149     // Finished using the font
       
   150 	gc.DiscardFont();
       
   151 	}
       
   152 
       
   153 
       
   154 
       
   155 ////////////////////////////////////////////////////////////////////////
       
   156 //
       
   157 // Implementation of the document class - CExampleDocument
       
   158 //
       
   159 ////////////////////////////////////////////////////////////////////////
       
   160 
       
   161 CExampleDocument::CExampleDocument(CEikApplication& aApp)
       
   162 		: CEikDocument(aApp)
       
   163 	{
       
   164 	}
       
   165 
       
   166 CEikAppUi* CExampleDocument::CreateAppUiL()
       
   167 	{
       
   168     return new(ELeave) CExampleAppUi;
       
   169 	}
       
   170 
       
   171 
       
   172 LOCAL_C CApaApplication* NewApplication()
       
   173 	{
       
   174 	return new CExampleApplication;
       
   175 	}
       
   176 	
       
   177 GLDEF_C TInt E32Main()
       
   178 	{
       
   179 	return EikStart::RunApplication(NewApplication);
       
   180 	}
       
   181