// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
//

LOAD_SUITE tsu_mmf_devsubtitle.dll

//! @SYMTestCaseID          MM-MMF-DEVSUBTITLE-U-0001-HP
//! @SYMREQ                 REQ9902
//! @SYMTestCaseDesc         Test adding subtitle configuration to DevSubtitle
//! @SYMTestActions         	1) Create a CMMFDevSubtitle object
//!				2) Add a valid subtitle configuration to DevSubtitle
//!				3) Call CMMFDevSubtitle::GetCrpParametersL() to check that the configuration 
//! @SYMTestExpectedResults Adding a configuration prompts DevSubtitle to create various internal resources.  
//! API call completes with no errors
//! @SYMTestPriority        High
RUN_TEST_STEP 30000, tsu_mmf_devsubtitle, MM-MMF-DEVSUBTITLE-U-0001-HP
TEST_COMPLETE

//! @SYMTestCaseID          MM-MMF-DEVSUBTITLE-U-0002-HP
//! @SYMREQ                 REQ9902
//! @SYMTestCaseDesc        Test requesting subtitle configuration information from DevSubtitle
//! @SYMTestActions         	1) Create a CMMFDevSubtitle object
//!				2) Add a subtitle configuration to DevSubtitle
//!				3) Call CMMFDevSubtitle::GetCrpParametersL() to check that the configuration 
//!				4) Check UID returned
//! @SYMTestExpectedResults DevSubtitle returns the current CRP Id, API call completes with no errors
//! API call completes with no errors
//! @SYMTestPriority        High
RUN_TEST_STEP 30000, tsu_mmf_devsubtitle, MM-MMF-DEVSUBTITLE-U-0002-HP
TEST_COMPLETE

//! @SYMTestCaseID          MM-MMF-DEVSUBTITLE-U-0003-HP
//! @SYMREQ                 REQ9902, REQ9906
//! @SYMTestCaseDesc        Update the subtitle configuration with various combinations of rotation settings
//!			    before they are displayed
//! @SYMTestActions         	1) Create a CMMFDevSubtitle object
//!				2) Add a subtitle configuration to DevSubtitle
//!				3) Call CMMFDevSubtitle::GetCrpParametersL() to check that the configuration 
//!				4) Create RWindow and initialise CRP
//!				5) Update Rotation settings to EVideoRotationNone
//!				6) Set video position to 0
//!				7) Start subtitle playing
//!				8) Wait for eight seconds
//!				9) Check video position
//!			       10) Update Rotation settings to EVideoRotationClockwise90
//!			       11) Set video position to 0
//!			       12) Start subtitle playing
//!			       13) Wait for eight seconds
//!			       14) Check video position
//!			       15) Update Rotation settings to EVideoRotationClockwise180
//!			       16) Set video position to 0
//!			       17) Start subtitle playing
//!			       18) Wait for eight seconds
//!			       19) Check video position
//!			       20) Update Rotation settings to EVideoRotationClockwise270
//!			       21) Set video position to 0
//!			       22) Start subtitle playing
//!			       23) Wait for eight seconds
//!			       24) Check video position
//! @SYMTestExpectedResults Updating a configuration prompts DevSubtitle to first reset and then recreate various internal resources.  
//!			    DevSubtitle correctly rotates subtitle frames as required, API call completes with no errors
//! 			    API call completes with no errors
//! @SYMTestPriority        High
RUN_TEST_STEP 50000, tsu_mmf_devsubtitle, MM-MMF-DEVSUBTITLE-U-0003-HP
TEST_COMPLETE

//! @SYMTestCaseID          MM-MMF-DEVSUBTITLE-U-0004-HP
//! @SYMREQ                 REQ9902
//! @SYMTestCaseDesc        Request the current position from DevSubtitle
//! @SYMTestActions         	1) Requests the current video position from DevSubtitle in various playback states
//! @SYMTestExpectedResults DevSubtitle returns the current video position
//! @SYMTestPriority        High
RUN_TEST_STEP 30000, tsu_mmf_devsubtitle, MM-MMF-DEVSUBTITLE-U-0004-HP
TEST_COMPLETE

//! @SYMTestCaseID          MM-MMF-DEVSUBTITLE-U-0005-HP
//! @SYMREQ                 REQ9902
//! @SYMTestCaseDesc        Request that DevSubtitle removes the current configuration.  
//! @SYMTestActions         	1) Test removing a subtitle configuration from DevSubtitle
//!				2) Following RemoveSubtitleConfig read the configuration to ensure correct operation
//! @SYMTestExpectedResults Removing a configuration prompts DevSubtitle to cancel and clear any current subtitle frames and and pending frames.
//!			    API calls completes with no errors
//!			    Updating a configuration prompts DevSubtitle to first reset and then recreate various internal resources.  
//!			    API call completes with no errors
//! @SYMTestPriority        High
RUN_TEST_STEP 30000, tsu_mmf_devsubtitle, MM-MMF-DEVSUBTITLE-U-0005-HP
TEST_COMPLETE

//! @SYMTestCaseID          MM-MMF-DEVSUBTITLE-U-0007-HP
//! @SYMREQ                 REQ9902
//! @SYMTestCaseDesc        Request that DevSubtitle sets the current video position.  
//!			    Test various valid video positions - 0, 50% and 75% of test SRT files length
//! @SYMTestActions         	1) Set a valid video position at the start of the subtitle stream
//!				2) Set a valid video position in the middle of the subtitle stream
//! @SYMTestExpectedResults DevSubtitle sets the current video position
//!		             API call completes with no errors
//! @SYMTestPriority         High
RUN_TEST_STEP 30000, tsu_mmf_devsubtitle, MM-MMF-DEVSUBTITLE-U-0007-HP
TEST_COMPLETE

//! @SYMTestCaseID          MM-MMF-DEVSUBTITLE-U-0009-HP
//! @SYMREQ                 REQ9902
//! @SYMTestCaseDesc         Request DevSubtitle stops playback in various different use-cases
//! @SYMTestActions         	1) Requests that DevSubtitle stops displaying subtitles in a the middle of a valid subtitle stream.  
//!				2) The current subtitle frame is cleared from the screen
//! 				3) Requests that DevSubtitle stops displaying subtitles after the end of a subtitle stream.
//!				4) API call completes with no errors
//! @SYMTestExpectedResults DevSubtitle stops displaying subtitles.  The current subtitle frame is cleared from the screen
//!                         DevSubtitle stops displaying subtitles after the end position of the subtitle stream i.e. 
//!			    simulating a stop command after a video has completed playing
//!                         API call completes with no errors
//! @SYMTestPriority        High
RUN_TEST_STEP 30000, tsu_mmf_devsubtitle, MM-MMF-DEVSUBTITLE-U-0009-HP
TEST_COMPLETE

//! @SYMTestCaseID          MM-MMF-DEVSUBTITLE-U-0010-HP
//! @SYMREQ                 REQ9902, PREQ9906
//! @SYMTestCaseDesc        Update the subtitle configuration
//! @SYMTestActions         	1) API call completes with no errors
//! @SYMTestExpectedResults Updating a configuration prompts DevSubtitle to first reset and then recreate various internal 
//!			    resources.  API call completes with no errors
//! @SYMTestPriority        High
RUN_TEST_STEP 30000, tsu_mmf_devsubtitle, MM-MMF-DEVSUBTITLE-U-0010-HP
TEST_COMPLETE

//! @SYMTestCaseID          MM-MMF-DEVSUBTITLE-U-0011-HP
//! @SYMREQ                 REQ9902, PREQ9906
//! @SYMTestCaseDesc        Update the subtitle configuration during playback
//! @SYMTestActions         	1) Requests that Devsubtitle adds a valid configuration and starts playing.  
//!                             2) This configuration is removed and a new valid configuration is added.  
//!				3) SetVideoPosition is called and start() called.  
//!				4) DevSubtitle is expected to resume playback from the time mentioned in SetVideoPosition()
//! @SYMTestExpectedResults Updating a configuration prompts DevSubtitle to first reset and then recreate various internal resources.  
//!                         Subtitles are displayed after Start(). Removing the subtitle configuration stops playback and the current
//!			    subtitle frame is cleared from the screen.  After adding a new configuration and setting the video posiiton 
//!			    DevSubtitle starts displaying subtitles from the stream position set by the call to SetVideoPosition()
//!                         API call completes with no errors
//! @SYMTestPriority        High
RUN_TEST_STEP 30000, tsu_mmf_devsubtitle, MM-MMF-DEVSUBTITLE-U-0011-HP
TEST_COMPLETE

// Negative tests

//! @SYMTestCaseID          MM-MMF-DEVSUBTITLE-U-0101-HP
//! @SYMREQ                 REQ9902
//! @SYMTestCaseDesc        Request that DevSubtitle sets the subtitle language to ELangEnglish, request the current language from DevSubtitle
//! @SYMTestActions         	1) Test setting a new language for the decoder
//!				2) Request the current languge from DevSubtitle
//! @SYMTestExpectedResults Attempting to set the subtitle language results in the call retuning KErrNotSupported.
//!			    Attempting to get the current subtitle language results in the call returning KErrNotSupported.
//! @SYMTestPriority        High
RUN_TEST_STEP 30000, tsu_mmf_devsubtitle, MM-MMF-DEVSUBTITLE-U-0101-HP
TEST_COMPLETE

//! @SYMTestCaseID          MM-MMF-DEVSUBTITLE-U-0102-HP
//! @SYMREQ                 REQ9902
//! @SYMTestCaseDesc        Test adding subtitle configuration to DevSubtitle multiple times
//! @SYMTestActions         	1) Test application calls DevSubtitle API to add a new subtitle configuration
//!				2) Make a second call to DevSubtitle::AddSubtitleConfig with the same configuration 
//!				3) Make a third call to DevSubtitle::AddSubtitleConfig with a different window ID
//!				4) Start DevSubtitle to ensure the first sucessful call to DevSubtitle::AddSubtitleConfig is still valid
//! @SYMTestExpectedResults Adding a configuration prompts DevSubtitle to create various internal resources.  
//!		            First API call completes with no errors
//!		            Second attempt at adding a configuration leaves with KErrArgument
//!		            Third attempt at adding a configuration leaves with KErrInUse
//!		            Attempt to start DevSubtitle functions correctly
//! @SYMTestPriority        High
RUN_TEST_STEP 30000, tsu_mmf_devsubtitle, MM-MMF-DEVSUBTITLE-U-0102-HP
TEST_COMPLETE

//! @SYMTestCaseID          MM-MMF-DEVSUBTITLE-U-0103-HP
//! @SYMREQ                 REQ9902
//! @SYMTestCaseDesc        Test requesting subtitle configuration information from DevSubtitle before any configuration 
//!			    information has been added
//! @SYMTestActions         	1) Request the current CRP id from DevSubtitle before any configuration information has 
//!				   been submitted to DevSubtitle
//! @SYMTestExpectedResults DevSubtitle panics with user::Invariant (0) to indicate a programming error.
//! @SYMTestPriority        High
RUN_TEST_STEP 30000, tsu_mmf_devsubtitle, MM-MMF-DEVSUBTITLE-U-0103-HP
TEST_COMPLETE

//! @SYMTestCaseID          MM-MMF-DEVSUBTITLE-U-0104-HP
//! @SYMREQ                 REQ9902
//! @SYMTestCaseDesc        Request the current supported languages from DevSubtitle before a decoder has been loaded
//! @SYMTestActions         	1) Request all languages supported by the current decoder/source from DevSubtitle before 
//!			           a decoder has been loaded
//! @SYMTestExpectedResults DevSubtitle leaves with KErrNotReady
//! @SYMTestPriority        High
RUN_TEST_STEP 30000, tsu_mmf_devsubtitle, MM-MMF-DEVSUBTITLE-U-0104-HP
TEST_COMPLETE

//! @SYMTestCaseID          MM-MMF-DEVSUBTITLE-U-0105-HP
//! @SYMREQ                 REQ9902
//! @SYMTestCaseDesc        Request that DevSubtitle removes a configuration before one has been added
//! @SYMTestActions         	1) Test removing a subtitle configuration from DevSubtitle before a configuration is added
//! @SYMTestExpectedResults API call results in DevSubtitle raising a panic (User::Invariant()) 0
//! @SYMTestPriority        High
RUN_TEST_STEP 30000, tsu_mmf_devsubtitle, MM-MMF-DEVSUBTITLE-U-0105-HP
TEST_COMPLETE

//! @SYMTestCaseID          MM-MMF-DEVSUBTITLE-U-0106-HP
//! @SYMREQ                 REQ9902
//! @SYMTestCaseDesc        Test that a configuration cannot be added before a valid decoder has been loaded
//! @SYMTestActions         	1) Test that DevSubtitle can raise an error when prompted to add a valid configuration 
//!				   before a valid decoder has been loaded
//! @SYMTestExpectedResults API call results in DevSubtitle leaving with KErrNotReady
//! @SYMTestPriority        High
RUN_TEST_STEP 30000, tsu_mmf_devsubtitle, MM-MMF-DEVSUBTITLE-U-0106-HP
TEST_COMPLETE

//! @SYMTestCaseID          MM-MMF-DEVSUBTITLE-U-0107-HP
//! @SYMREQ                 REQ9902
//! @SYMTestCaseDesc        Request that DevSubtitle loads an non-existent decoder
//! @SYMTestActions         	1) Test that DevSubtitle can throw an error when prompted to load an non-existent decoder
//! @SYMTestExpectedResults API call results in DevSubtitle leaving with KErrNotFound
//! @SYMTestPriority        High
RUN_TEST_STEP 30000, tsu_mmf_devsubtitle, MM-MMF-DEVSUBTITLE-U-0107-HP
TEST_COMPLETE

//! @SYMTestCaseID          MM-MMF-DEVSUBTITLE-U-0111-HP
//! @SYMREQ                 REQ9902
//! @SYMTestCaseDesc        Request DevSubtitle stops playback while in an invalid state - i.e. no valid configuration has been set
//! @SYMTestActions         	1) Requests that DevSubtitle stops displaying subtitles while in an invalid state
//! @SYMTestExpectedResults API call results in DevSubtitle raising a panic (User::Invariant()) 0
//! @SYMTestPriority        High
RUN_TEST_STEP 30000, tsu_mmf_devsubtitle, MM-MMF-DEVSUBTITLE-U-0111-HP
TEST_COMPLETE

//! @SYMTestCaseID          MM-MMF-DEVSUBTITLE-U-0112-HP
//! @SYMREQ                 REQ9902
//! @SYMTestCaseDesc        Test adding various invalid subtitle configurations to DevSubtitle
//! @SYMTestActions         	1) Test calls DevSubtitle API to add a new subtitle configuration with a configuration with
//!				   an invalid clip rectangle
//!				2) Test calls DevSubtitle API to add a new subtitle configuration with a configuration with
//!				   an invalid display mode 
//!				3) Test calls DevSubtitle API to add a new subtitle configuration with a configuration with
//!				   an invalid video rotation setting
//! @SYMTestExpectedResults Adding a configuration prompts DevSubtitle to leave with KErrArgument 
//!			    Adding a configuration prompts DevSubtitle to leave with KErrArgument 
//!			    Adding a configuration prompts DevSubtitle to leave with KErrArgument 
//! @SYMTestPriority        High
RUN_TEST_STEP 30000, tsu_mmf_devsubtitle, MM-MMF-DEVSUBTITLE-U-0112-HP
TEST_COMPLETE

//! @SYMTestCaseID          MM-MMF-DEVSUBTITLE-U-0113-HP
//! @SYMREQ                 REQ9902
//! @SYMTestCaseDesc        Update the subtitle configuration
//! @SYMTestActions         	1) Test calls DevSubtitle API to add a new subtitle configuration with a valid configuration
//!				2) Test removes configuration
//!				3) Test attempts to remove configuration for a second time
//! @SYMTestExpectedResults Attempting to remove a configuration for a second time prompts DevSubtitle to leave with KErrNotReady
//! @SYMTestPriority        High
RUN_TEST_STEP 30000, tsu_mmf_devsubtitle, MM-MMF-DEVSUBTITLE-U-0113-HP
TEST_COMPLETE