os/mm/mmlibs/mmfw/tsrc/mmfunittest/srtdecoder/src/testsrtdecoderlanguagefuncs.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2008-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 "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include "srtdecoder.h"
    17 #include "srtreader.h"
    18 #include "testsrtdecoderlanguagefuncs.h"
    19 
    20 _LIT( KSampleSubtitleSRTFilepath1, "c:\\mm\\subtitle1.srt" );
    21 
    22 RTestSrtDecoderStep0100::RTestSrtDecoderStep0100()
    23 	{
    24 	iTestStepName = _L("MM-MMF-SUBTITLE-SRTDECODER-U-0100-HP");
    25 	}
    26 	
    27 TVerdict RTestSrtDecoderStep0100::DoTestStepPreambleL()
    28     {
    29     InitializeTestStepL(EFalse, KSampleSubtitleSRTFilepath1);
    30     
    31     return EPass;
    32     }
    33 
    34 TVerdict RTestSrtDecoderStep0100::DoTestStepPostambleL()
    35     {
    36     UnInitializeTestStep();
    37     
    38     return EPass;
    39     }
    40 
    41 TVerdict RTestSrtDecoderStep0100::DoTestStepL()
    42 	{
    43 	INFO_PRINTF1(_L("Enter DoTestStepL"));
    44 	TVerdict result = EPass;
    45 	
    46 	result = TestSubtitleLanguage();
    47     if (EPass != result)
    48         {
    49         ERR_PRINTF1(_L("Error - RTestSrtDecoderStep0100::TestGetSubtitleLanguage failed. "));
    50         INFO_PRINTF1(_L("Exit DoTestStepL"));
    51 	    return result;
    52         }
    53         
    54     result = TestSetSubtitleLanguage();
    55     if (EPass != result)
    56         {
    57         ERR_PRINTF1(_L("Error - RTestSrtDecoderStep0100::TestSetSubtitleLanguage failed. "));
    58         INFO_PRINTF1(_L("Exit DoTestStepL"));
    59 	    return result;
    60         }
    61         
    62     result = TestGetSupportedSubtitleLanguages();
    63     if (EPass != result)
    64         {
    65         ERR_PRINTF1(_L("Error - RTestSrtDecoderStep0100::TestGetSubtitleLanguageSupport failed. "));
    66         INFO_PRINTF1(_L("Exit DoTestStepL"));
    67 	    return result;
    68         }
    69        
    70     INFO_PRINTF1(_L("Exit DoTestStepL"));
    71 	return result;
    72 	}
    73 
    74 
    75 TVerdict RTestSrtDecoderStep0100::TestSubtitleLanguage()
    76     {
    77     TInt err = KErrNone;
    78     TVerdict result = EPass;
    79     
    80     TRAP(err, iSrtDecoder->SubtitleLanguageL());
    81     if (err != KErrNotSupported)
    82         {
    83         ERR_PRINTF2(_L("Error - MSubtitleDecoder::SubtitleLanguageL returned %d. "), err);
    84         result = EFail;
    85         }
    86     
    87     return result;
    88     }
    89 
    90 TVerdict RTestSrtDecoderStep0100::TestSetSubtitleLanguage()
    91     {
    92     TInt err = KErrNone;
    93     TLanguage leng = ELangEnglish;
    94     TVerdict result = EPass;
    95     
    96     TRAP(err, iSrtDecoder->SetSubtitleLanguageL(leng));
    97     if (err != KErrNotSupported)
    98         {
    99         ERR_PRINTF2(_L("Error - MSubtitleDecoder::SetSubtitleLanguageL returned %d. "), err);
   100         result = EFail;
   101         }
   102     
   103     return result;
   104     }
   105 	
   106 TVerdict RTestSrtDecoderStep0100::TestGetSupportedSubtitleLanguages()
   107     {
   108     TVerdict result = EPass;
   109     TInt err = KErrNone;
   110     RArray<TLanguage> data;
   111     
   112     TRAP(err, iSrtDecoder->GetSupportedSubtitleLanguagesL(data));
   113     if (err != KErrNotSupported)
   114         {
   115         ERR_PRINTF2(_L("Error - MSubtitleDecoder::GetSubtitleLanguageSupportL returned %d. "), err);
   116         result = EFail;
   117         }
   118     
   119     return result;
   120     }
   121     
   122