os/mm/mmlibs/mmfw/tsrc/mmfunittest/srtdecoder/src/testsrtdecoderlanguagefuncs.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/srtdecoder/src/testsrtdecoderlanguagefuncs.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,122 @@
1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include "srtdecoder.h"
1.20 +#include "srtreader.h"
1.21 +#include "testsrtdecoderlanguagefuncs.h"
1.22 +
1.23 +_LIT( KSampleSubtitleSRTFilepath1, "c:\\mm\\subtitle1.srt" );
1.24 +
1.25 +RTestSrtDecoderStep0100::RTestSrtDecoderStep0100()
1.26 + {
1.27 + iTestStepName = _L("MM-MMF-SUBTITLE-SRTDECODER-U-0100-HP");
1.28 + }
1.29 +
1.30 +TVerdict RTestSrtDecoderStep0100::DoTestStepPreambleL()
1.31 + {
1.32 + InitializeTestStepL(EFalse, KSampleSubtitleSRTFilepath1);
1.33 +
1.34 + return EPass;
1.35 + }
1.36 +
1.37 +TVerdict RTestSrtDecoderStep0100::DoTestStepPostambleL()
1.38 + {
1.39 + UnInitializeTestStep();
1.40 +
1.41 + return EPass;
1.42 + }
1.43 +
1.44 +TVerdict RTestSrtDecoderStep0100::DoTestStepL()
1.45 + {
1.46 + INFO_PRINTF1(_L("Enter DoTestStepL"));
1.47 + TVerdict result = EPass;
1.48 +
1.49 + result = TestSubtitleLanguage();
1.50 + if (EPass != result)
1.51 + {
1.52 + ERR_PRINTF1(_L("Error - RTestSrtDecoderStep0100::TestGetSubtitleLanguage failed. "));
1.53 + INFO_PRINTF1(_L("Exit DoTestStepL"));
1.54 + return result;
1.55 + }
1.56 +
1.57 + result = TestSetSubtitleLanguage();
1.58 + if (EPass != result)
1.59 + {
1.60 + ERR_PRINTF1(_L("Error - RTestSrtDecoderStep0100::TestSetSubtitleLanguage failed. "));
1.61 + INFO_PRINTF1(_L("Exit DoTestStepL"));
1.62 + return result;
1.63 + }
1.64 +
1.65 + result = TestGetSupportedSubtitleLanguages();
1.66 + if (EPass != result)
1.67 + {
1.68 + ERR_PRINTF1(_L("Error - RTestSrtDecoderStep0100::TestGetSubtitleLanguageSupport failed. "));
1.69 + INFO_PRINTF1(_L("Exit DoTestStepL"));
1.70 + return result;
1.71 + }
1.72 +
1.73 + INFO_PRINTF1(_L("Exit DoTestStepL"));
1.74 + return result;
1.75 + }
1.76 +
1.77 +
1.78 +TVerdict RTestSrtDecoderStep0100::TestSubtitleLanguage()
1.79 + {
1.80 + TInt err = KErrNone;
1.81 + TVerdict result = EPass;
1.82 +
1.83 + TRAP(err, iSrtDecoder->SubtitleLanguageL());
1.84 + if (err != KErrNotSupported)
1.85 + {
1.86 + ERR_PRINTF2(_L("Error - MSubtitleDecoder::SubtitleLanguageL returned %d. "), err);
1.87 + result = EFail;
1.88 + }
1.89 +
1.90 + return result;
1.91 + }
1.92 +
1.93 +TVerdict RTestSrtDecoderStep0100::TestSetSubtitleLanguage()
1.94 + {
1.95 + TInt err = KErrNone;
1.96 + TLanguage leng = ELangEnglish;
1.97 + TVerdict result = EPass;
1.98 +
1.99 + TRAP(err, iSrtDecoder->SetSubtitleLanguageL(leng));
1.100 + if (err != KErrNotSupported)
1.101 + {
1.102 + ERR_PRINTF2(_L("Error - MSubtitleDecoder::SetSubtitleLanguageL returned %d. "), err);
1.103 + result = EFail;
1.104 + }
1.105 +
1.106 + return result;
1.107 + }
1.108 +
1.109 +TVerdict RTestSrtDecoderStep0100::TestGetSupportedSubtitleLanguages()
1.110 + {
1.111 + TVerdict result = EPass;
1.112 + TInt err = KErrNone;
1.113 + RArray<TLanguage> data;
1.114 +
1.115 + TRAP(err, iSrtDecoder->GetSupportedSubtitleLanguagesL(data));
1.116 + if (err != KErrNotSupported)
1.117 + {
1.118 + ERR_PRINTF2(_L("Error - MSubtitleDecoder::GetSubtitleLanguageSupportL returned %d. "), err);
1.119 + result = EFail;
1.120 + }
1.121 +
1.122 + return result;
1.123 + }
1.124 +
1.125 +