symbianunittestfw/sutfw/sutfwcore/sutfwframework/src/symbianunittestfailure.cpp
branchRCL_3
changeset 3 9397a16b6eb8
parent 1 6edeef394eb7
equal deleted inserted replaced
1:6edeef394eb7 3:9397a16b6eb8
     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 
       
    18 #include "symbianunittestfailure.h"
       
    19 #include <utf.h>
       
    20 
       
    21 // -----------------------------------------------------------------------------
       
    22 //
       
    23 // -----------------------------------------------------------------------------
       
    24 //
       
    25 CSymbianUnitTestFailure* CSymbianUnitTestFailure::NewL(
       
    26     const TDesC& aTestName,
       
    27     const TDesC8& aFailureMessage,
       
    28     TInt aLineNumber,
       
    29     const TDesC8& aFileName )
       
    30     {
       
    31     CSymbianUnitTestFailure* self = 
       
    32         CSymbianUnitTestFailure::NewLC( 
       
    33             aTestName, aFailureMessage, aLineNumber, aFileName );
       
    34     CleanupStack::Pop( self );
       
    35     return self;
       
    36     }
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 CSymbianUnitTestFailure* CSymbianUnitTestFailure::NewLC(
       
    43     const TDesC& aTestName,
       
    44     const TDesC8& aFailureMessage,
       
    45     TInt aLineNumber,
       
    46     const TDesC8& aFileName )
       
    47     {
       
    48     CSymbianUnitTestFailure* self = 
       
    49         new( ELeave )CSymbianUnitTestFailure( aLineNumber );
       
    50     CleanupStack::PushL( self );
       
    51     self->ConstructL( aTestName, aFailureMessage, aFileName );
       
    52     return self;
       
    53     }
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 CSymbianUnitTestFailure::CSymbianUnitTestFailure( TInt aLineNumber )
       
    60     : iLineNumber( aLineNumber )
       
    61 	{
       
    62 	}
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 //
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 void CSymbianUnitTestFailure::ConstructL(
       
    69     const TDesC& aTestName,
       
    70     const TDesC8& aFailureMessage,
       
    71     const TDesC8& aFileName )
       
    72     {
       
    73     iTestName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( aTestName );   
       
    74     iFailureMessage = aFailureMessage.AllocL();
       
    75     iFileName = aFileName.AllocL();
       
    76     }
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 CSymbianUnitTestFailure::~CSymbianUnitTestFailure()
       
    83     {
       
    84     delete iFileName;
       
    85     delete iFailureMessage;
       
    86     delete iTestName;
       
    87     }
       
    88 
       
    89 // -----------------------------------------------------------------------------
       
    90 //
       
    91 // -----------------------------------------------------------------------------
       
    92 //
       
    93 const TDesC8& CSymbianUnitTestFailure::TestName()
       
    94     {
       
    95     return *iTestName;
       
    96     }
       
    97     
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 // -----------------------------------------------------------------------------
       
   101 //
       
   102 const TDesC8& CSymbianUnitTestFailure::FailureMessage()
       
   103     {
       
   104     return *iFailureMessage;
       
   105     }
       
   106 
       
   107 // -----------------------------------------------------------------------------
       
   108 //
       
   109 // -----------------------------------------------------------------------------
       
   110 //
       
   111 TInt CSymbianUnitTestFailure::LineNumber()
       
   112     {
       
   113     return iLineNumber;
       
   114     }
       
   115 
       
   116 // -----------------------------------------------------------------------------
       
   117 //
       
   118 // -----------------------------------------------------------------------------
       
   119 //
       
   120 const TDesC8& CSymbianUnitTestFailure::FileName()
       
   121     {
       
   122     return *iFileName;
       
   123     }