//
// Copyright (c) 2005-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: 
//
//
//! @file
//! @SYMTestSuiteName   t_sipcodecapi
//! @SYMScriptTestEnvironment This test script requires a basic ROM. An SIP server listening on ports 5060.
//        The communicaion to the server is established using the default connection.
//        The supplied commsdat is set up to use NTRAS on Emulator as well as on H/W.
//! @SYMScriptAutomation  The test suites are fully automated using TestDriver and Testexecute

/////////////////////////////////////////////////////////////////////
// t_csipacceptlanguageheader
//
// Tests all public elements of the t_csipacceptlanguageheader
// classes as a means of confidence that the APIs work as expected.
//
// The purpose is to provide a regression test suite of PublishedAll APIs for CSIPAcceptLanguageHeader
// The tests are fully automated.
/////////////////////////////////////////////////////////////////////

LOAD_SUITE  t_sipcodecapi
DELAY   2000

START_TESTCASE              t_csipacceptlanguageheader-0001
//! @SYMTestCaseID          t_csipacceptlanguageheader-0001
//! @SYMAuthor              Jeffery Zhao
//! @SYMCreationDate        28/10/2009
//! @SYMAPI                 CSIPAcceptLanguageHeader::NewL(const TDesC8{ref}) 
//! @SYMTestCaseDesc        Construct and destruct CSIPAcceptLanguageHeader object.
//! @SYMTestActions         1. Create a CSIP object and a CSIPAcceptLanguageHeader object.
//!                         2. Construct CSIP and CSIPAcceptLanguageHeader object.
//!                         3. Delete the CSIPAcceptLanguageHeader object.
//!                         4. Delete the CSIP object.
//! @SYMTestStatus          Implemented
//! @SYMTestPriority        High
//! @SYMTestExpectedResults The SIP Codec can start and close successfully without causing any panic
//! @SYMTestType            CIT
    START_TEST_BLOCK    100 t_sipcodecapi                      \SIP\sipcodec\t_csipacceptlanguageheader.ini
        CREATE_OBJECT       CSIP                        sip
        CREATE_OBJECT       CSIPAcceptLanguageHeader    sipacceptlanguageheader
        COMMAND             sip                         NewL            t_csipacceptlanguageheader-0001-NewL_Command01
        COMMAND             sipacceptlanguageheader     NewL            t_csipacceptlanguageheader-0001-NewL_Command02
        COMMAND             sipacceptlanguageheader     ~
        COMMAND             sip                         ~
    END_TEST_BLOCK
END_TESTCASE      t_csipacceptlanguageheader-0001

START_TESTCASE              t_csipacceptlanguageheader-0002
//! @SYMTestCaseID          t_csipacceptlanguageheader-0002
//! @SYMAuthor              Jeffery Zhao
//! @SYMCreationDate        28/10/2009
//! @SYMAPI                 CSIPAcceptLanguageHeader::NewLC(const TDesC8{ref})
//! @SYMTestCaseDesc        Constructs a CSIPAcceptLanguageHeader object.
//! @SYMTestActions         1. Create a CSIP object and a CSIPAcceptLanguageHeader object.
//!                         2. Construct CSIP, and construct CSIPAcceptLanguageHeader object.
//!                         3. Delete the CSIPAcceptLanguageHeader object.
//!                         4. Delete the CSIP object.
//! @SYMTestStatus          Implemented
//! @SYMTestPriority        High
//! @SYMTestExpectedResults The SIP Codec can start and close successfully without causing any panic
//! @SYMTestType            CIT
    START_TEST_BLOCK    100 t_sipcodecapi                      \SIP\sipcodec\t_csipacceptlanguageheader.ini
        CREATE_OBJECT       CSIP                        sip
        CREATE_OBJECT       CSIPAcceptLanguageHeader    sipacceptlanguageheader
        COMMAND             sip                         NewL            t_csipacceptlanguageheader-0002-NewL_Command01
        COMMAND             sipacceptlanguageheader     NewLC           t_csipacceptlanguageheader-0002-NewLC_Command02
        COMMAND             sipacceptlanguageheader     ~
        COMMAND             sip                         ~
    END_TEST_BLOCK
END_TESTCASE      t_csipacceptlanguageheader-0002

START_TESTCASE              t_csipacceptlanguageheader-0003
//! @SYMTestCaseID          t_csipacceptlanguageheader-0003
//! @SYMAuthor              Jeffery Zhao
//! @SYMCreationDate        28/10/2009
//! @SYMAPI                 CSIPAcceptLanguageHeader::DecodeL(const TDesC8{ref})
//! @SYMTestCaseDesc        Constructs a CSIPAcceptLanguageHeader object from textual presentation.
//! @SYMTestActions         1. Create a CSIP object and 2 CSIPAcceptLanguageHeader objects.
//!                         2. Construct CSIP object.
//!                         3. Construct CSIPAcceptLanguageHeader objects from textual presentation.
//!                         4. Delete all objects
//! @SYMTestStatus          Implemented
//! @SYMTestPriority        High
//! @SYMTestExpectedResults The CSIPAcceptLanguageHeader can be decoded successfully.
//! @SYMTestType            CIT
    START_TEST_BLOCK    100 t_sipcodecapi                      \SIP\sipcodec\t_csipacceptlanguageheader.ini
        CREATE_OBJECT       CSIP                        sip
        CREATE_OBJECT       CSIPAcceptLanguageHeader    sipacceptlanguageheader
        CREATE_OBJECT       CSIPAcceptLanguageHeader    sipacceptlanguageheader1
        COMMAND             sip                         NewL                        t_csipacceptlanguageheader-0003-NewL_Command01
        COMMAND             sipacceptlanguageheader     DecodeL                     t_csipacceptlanguageheader-0003-DecodeL_Command02
        COMMAND             sipacceptlanguageheader     ~
        COMMAND             sipacceptlanguageheader1    ~
        COMMAND             sip                         ~
    END_TEST_BLOCK
END_TESTCASE      t_csipacceptlanguageheader-0003

START_TESTCASE              t_csipacceptlanguageheader-0004
//! @SYMTestCaseID          t_csipacceptlanguageheader-0004
//! @SYMAuthor              Jeffery Zhao
//! @SYMCreationDate        28/10/2009
//! @SYMAPI                 CSIPAcceptLanguageHeader::LanguageRange() const
//!                         CSIPAcceptLanguageHeader::SetLanguageRangeL(const TDesC8{ref})
//! @SYMTestCaseDesc        Gets the language-range from the "Accept-Language" header and then set.
//! @SYMTestActions         1. Create a CSIP object and CSIPAcceptLanguageHeader objects.
//!                         2. Construct CSIP object.
//!                         3. Construct CSIPAcceptLanguageHeader objects.
//!                         4. Get the language-range.
//!                         5. Set the language-range.
//!                         6. Get the language-range again.
//!                         7. Delete all objects.
//! @SYMTestStatus          Implemented
//! @SYMTestPriority        High
//! @SYMTestExpectedResults The returned language-range is as expected.
//! @SYMTestType            CIT
    START_TEST_BLOCK    100 t_sipcodecapi                      \SIP\sipcodec\t_csipacceptlanguageheader.ini
        CREATE_OBJECT       CSIP                        sip
        CREATE_OBJECT       CSIPAcceptLanguageHeader    sipacceptlanguageheader
        COMMAND             sip                         NewL            t_csipacceptlanguageheader-0004-NewL_Command01
        COMMAND             sipacceptlanguageheader     NewL            t_csipacceptlanguageheader-0004-NewL_Command02
        COMMAND             sipacceptlanguageheader     LanguageRange   t_csipacceptlanguageheader-0004-LanguageRange_Command03
        COMMAND             sipacceptlanguageheader     SetLanguageRangeL t_csipacceptlanguageheader-0004-SetLanguageRangeL_Command04
        COMMAND             sipacceptlanguageheader     LanguageRange   t_csipacceptlanguageheader-0004-LanguageRange_Command05
        COMMAND             sipacceptlanguageheader     ~
        COMMAND             sip                         ~
    END_TEST_BLOCK
END_TESTCASE      t_csipacceptlanguageheader-0004

START_TESTCASE              t_csipacceptlanguageheader-0005
//! @SYMTestCaseID          t_csipacceptlanguageheader-0005
//! @SYMAuthor              Jeffery Zhao
//! @SYMCreationDate        28/10/2009
//! @SYMAPI                 CSIPAcceptLanguageHeader::QParameter() const
//!                         CSIPAcceptLanguageHeader::SetQParameterL(TReal)
//! @SYMTestCaseDesc        Gets the "q"-parameter value and then set.
//! @SYMTestActions         1. Create a CSIP object and CSIPAcceptLanguageHeader objects.
//!                         2. Construct CSIP object.
//!                         3. Construct CSIPAcceptLanguageHeader objects.
//!                         4. Get the "q"-parameter value.
//!                         5. Set the "q"-parameter value .
//!                         6. Get the "q"-parameter value again.
//!                         7. Delete all objects.
//! @SYMTestStatus          Implemented
//! @SYMTestPriority        High
//! @SYMTestExpectedResults The returned "q"-parameter value is as expected.
//! @SYMTestType            CIT
    START_TEST_BLOCK    100 t_sipcodecapi                      \SIP\sipcodec\t_csipacceptlanguageheader.ini
        CREATE_OBJECT       CSIP                        sip
        CREATE_OBJECT       CSIPAcceptLanguageHeader    sipacceptlanguageheader
        COMMAND             sip                         NewL            t_csipacceptlanguageheader-0005-NewL_Command01
        COMMAND             sipacceptlanguageheader     NewL            t_csipacceptlanguageheader-0005-NewL_Command02
        COMMAND             sipacceptlanguageheader     QParameter      t_csipacceptlanguageheader-0005-QParameter_Command03
        COMMAND             sipacceptlanguageheader     SetQParameterL  t_csipacceptlanguageheader-0005-SetQParameterL_Command04
        COMMAND             sipacceptlanguageheader     QParameter      t_csipacceptlanguageheader-0005-QParameter_Command05
        COMMAND             sipacceptlanguageheader     ~
        COMMAND             sip                         ~
    END_TEST_BLOCK
END_TESTCASE      t_csipacceptlanguageheader-0005

START_TESTCASE              t_csipacceptlanguageheader-0006
//! @SYMTestCaseID          t_csipacceptlanguageheader-0006
//! @SYMAuthor              Jeffery Zhao
//! @SYMCreationDate        28/10/2009
//! @SYMAPI                 CSIPAcceptLanguageHeader::InternalizeValueL()
//! @SYMTestCaseDesc        Constructs an instance of a CSIPAcceptLanguageHeader from a RReadStream.
//! @SYMTestActions         1. Create a CSIP object and 2 CSIPAcceptLanguageHeader objects.
//!                         2. Construct CSIP and CSIPAcceptLanguageHeader object.
//!                         3. Set the 1st CSIPAcceptLanguageHeader object's "q"-parameter value. 
//!                         4. Externalize 1st CSIPAcceptLanguageHeader object
//!                         5. Constructs an instance of a CSIPAcceptLanguageHeader from a RReadStream by using InternalizeValueL.
//!                         6. Get the language-range and "q"-parameter value to check whether they are same with 1st CSIPAcceptLanguageHeader object set. 
//!                         7. Delete all objects.
//! @SYMTestStatus          Implemented
//! @SYMTestPriority        High
//! @SYMTestExpectedResults A CSIPAcceptLanguageHeader object can be created by internalizing from a file. The new one is same as the original one which externalizes to a file.
//! @SYMTestType            CIT
    START_TEST_BLOCK    100 t_sipcodecapi             \sip\sipcodec\t_csipacceptlanguageheader.ini
        CREATE_OBJECT       CSIPAcceptLanguageHeader     sipacceptlanguageheader
        CREATE_OBJECT       CSIPAcceptLanguageHeader     sipacceptlanguageheader1
        CREATE_OBJECT       CSIP                        sip
        COMMAND             sip                         NewL            t_csipacceptlanguageheader-0006-NewL_command01
        COMMAND             sipacceptlanguageheader     NewL            t_csipacceptlanguageheader-0006-NewL_command02
        COMMAND             sipacceptlanguageheader     SetQParameterL  t_csipacceptlanguageheader-0006-SetQParameterL_Command03
        COMMAND             sipacceptlanguageheader     ExternalizeL    t_csipacceptlanguageheader-0006-ExternalizeL_command04
        COMMAND             sipacceptlanguageheader1    InternalizeValueL  t_csipacceptlanguageheader-0006-InternalizeValueL_command05
        COMMAND             sipacceptlanguageheader1    LanguageRange   t_csipacceptlanguageheader-0006-LanguageRange_command06
        COMMAND             sipacceptlanguageheader1    QParameter      t_csipacceptlanguageheader-0006-QParameter_command07
        COMMAND             sipacceptlanguageheader     ~
        COMMAND             sipacceptlanguageheader1    ~
        COMMAND             sip                         ~ 
    END_TEST_BLOCK
END_TESTCASE      t_csipacceptlanguageheader-0006


START_TESTCASE              t_csipacceptlanguageheader-0007
//! @SYMTestCaseID          t_csipacceptlanguageheader-0007
//! @SYMAuthor              Jeffery Zhao
//! @SYMCreationDate        28/10/2009
//! @SYMAPI                 CSIPAcceptLanguageHeader::Name()
//! @SYMTestCaseDesc        Gets the full name of the header.
//! @SYMTestActions         1. Create a CSIP object and a CSIPAcceptLanguageHeader object.
//!                         2. Construct CSIP and CSIPAcceptLanguageHeader object.
//!                         3. Get name of the CSIPAcceptLanguageHeader object.
//!                         4. Delete all objects.
//! @SYMTestStatus          Implemented
//! @SYMTestPriority        High
//! @SYMTestExpectedResults Name() can be called successfully.
//! @SYMTestType            CIT
    START_TEST_BLOCK    100 t_sipcodecapi                      \SIP\sipcodec\t_csipacceptlanguageheader.ini
        CREATE_OBJECT       CSIP                        sip
        CREATE_OBJECT       CSIPAcceptLanguageHeader    sipacceptlanguageheader
        COMMAND             sip                         NewL            t_csipacceptlanguageheader-0007-NewL_Command01
        COMMAND             sipacceptlanguageheader     NewL            t_csipacceptlanguageheader-0007-NewL_Command02
        COMMAND             sipacceptlanguageheader     Name
        COMMAND             sipacceptlanguageheader     ~
        COMMAND             sip                         ~
    END_TEST_BLOCK
END_TESTCASE      t_csipacceptlanguageheader-0007


START_TESTCASE              t_csipacceptlanguageheader-0008
//! @SYMTestCaseID          t_csipacceptlanguageheader-0008
//! @SYMAuthor              Jeffery Zhao
//! @SYMCreationDate        28/10/2009
//! @SYMAPI                 CSIPAcceptLanguageHeader::CloneL()
//! @SYMTestCaseDesc        Creates a deep-copy of this header object.
//! @SYMTestActions         1. Create a CSIP object and 2 CSIPAcceptLanguageHeader objects.
//!                         2. Construct CSIP and CSIPAcceptLanguageHeader object.
//!                         3. Clone the CSIPAcceptLanguageHeader object to 2nd one and check the 2nd one is same as 1st one.
//!                         4. Delete all objects.
//! @SYMTestStatus          Implemented
//! @SYMTestPriority        High
//! @SYMTestExpectedResults CloneL can be called successfully and the clone is same as original one.
//! @SYMTestType            CIT
    START_TEST_BLOCK    100 t_sipcodecapi             \sip\sipcodec\t_csipacceptlanguageheader.ini
        CREATE_OBJECT       CSIPAcceptLanguageHeader     sipacceptlanguageheader
        CREATE_OBJECT       CSIPAcceptLanguageHeader     sipacceptlanguageheader1
        CREATE_OBJECT       CSIP                         sip
        COMMAND             sip                          NewL           t_csipacceptlanguageheader-0008-NewL_Command01
        COMMAND             sipacceptlanguageheader      NewL           t_csipacceptlanguageheader-0008-NewL_Command02
        COMMAND             sipacceptlanguageheader      SetQParameterL t_csipacceptlanguageheader-0008-SetQParameterL_Command03
        COMMAND             sipacceptlanguageheader      CloneL         t_csipacceptlanguageheader-0008-CloneL_command04
        COMMAND             sipacceptlanguageheader1     LanguageRange  t_csipacceptlanguageheader-0008-LanguageRange_command05
        COMMAND             sipacceptlanguageheader1     QParameter     t_csipacceptlanguageheader-0008-QParameter_command06
        COMMAND             sipacceptlanguageheader      ~
        COMMAND             sipacceptlanguageheader1     ~
        COMMAND             sip                          ~
    END_TEST_BLOCK
END_TESTCASE      t_csipacceptlanguageheader-0008

START_TESTCASE              t_csipacceptlanguageheader-0009
//! @SYMTestCaseID          t_csipacceptlanguageheader-0009
//! @SYMAuthor              Jeffery Zhao
//! @SYMCreationDate        28/10/2009
//! @SYMAPI                 CSIPAcceptLanguageHeader::DecodeL(const TDesC8{ref})
//! @SYMTestCaseDesc        Negative case,constructs a CSIPAcceptLanguageHeader object from an abnormal textual presentation.
//! @SYMTestActions         1. Create a CSIP object and 2 CSIPAcceptLanguageHeader objects.
//!                         2. Construct CSIP object.
//!                         3. Construct CSIPAcceptLanguageHeader objects from an abnormal textual presentation.
//!                         4. Delete all objects
//! @SYMTestStatus          Implemented
//! @SYMTestPriority        High
//! @SYMTestExpectedResults The CSIPAcceptLanguageHeader decoded with error KErrSipCodecAcceptLanguageHeader(-17801).
//! @SYMTestType            CIT
    START_TEST_BLOCK    100 t_sipcodecapi                      \SIP\sipcodec\t_csipacceptlanguageheader.ini
        CREATE_OBJECT       CSIP                        sip
        CREATE_OBJECT       CSIPAcceptLanguageHeader    sipacceptlanguageheader
        CREATE_OBJECT       CSIPAcceptLanguageHeader    sipacceptlanguageheader1
        COMMAND             sip                         NewL                        t_csipacceptlanguageheader-0009-NewL_Command01
        COMMAND  !Error=-17801 sipacceptlanguageheader  DecodeL                     t_csipacceptlanguageheader-0009-DecodeL_Command02
        COMMAND             sipacceptlanguageheader     ~
        COMMAND             sipacceptlanguageheader1    ~
        COMMAND             sip                         ~
    END_TEST_BLOCK
END_TESTCASE      t_csipacceptlanguageheader-0009

START_TESTCASE              t_csipacceptlanguageheader-0010
//! @SYMTestCaseID          t_csipacceptlanguageheader-0010
//! @SYMAuthor              Jeffery Zhao
//! @SYMCreationDate        28/10/2009
//! @SYMAPI                 CSIPAcceptLanguageHeader::SetLanguageRangeL(const TDesC8{ref})
//! @SYMTestCaseDesc        Negative case,set an illegal language-range to the "Accept-Language" header.
//! @SYMTestActions         1. Create a CSIP object and CSIPAcceptLanguageHeader objects.
//!                         2. Construct CSIP object.
//!                         3. Construct CSIPAcceptLanguageHeader.
//!                         4. Set an illegal language-range.
//!                         5. Delete all objects.
//! @SYMTestStatus          Implemented
//! @SYMTestPriority        High
//! @SYMTestExpectedResults The error KErrSipCodecAcceptLanguageHeader(-17801) returned when set language-range.
//! @SYMTestType            CIT
    START_TEST_BLOCK    100 t_sipcodecapi                      \SIP\sipcodec\t_csipacceptlanguageheader.ini
        CREATE_OBJECT       CSIP                        sip
        CREATE_OBJECT       CSIPAcceptLanguageHeader    sipacceptlanguageheader
        COMMAND             sip                         NewL            t_csipacceptlanguageheader-0010-NewL_Command01
        COMMAND             sipacceptlanguageheader     NewL            t_csipacceptlanguageheader-0010-NewL_Command02
        COMMAND !Error=-17801 sipacceptlanguageheader   SetLanguageRangeL t_csipacceptlanguageheader-0010-SetLanguageRangeL_Command03
        COMMAND             sipacceptlanguageheader     ~
        COMMAND             sip                         ~
    END_TEST_BLOCK
END_TESTCASE      t_csipacceptlanguageheader-0010

START_TESTCASE              t_csipacceptlanguageheader-0011
//! @SYMTestCaseID          t_csipacceptlanguageheader-0011
//! @SYMAuthor              Jeffery Zhao
//! @SYMCreationDate        28/10/2009
//! @SYMAPI                 CSIPAcceptLanguageHeader::SetQParameterL(TReal)
//! @SYMTestCaseDesc        Negative case,set the illegal "q"-parameter value.
//! @SYMTestActions         1. Create a CSIP object and CSIPAcceptLanguageHeader objects.
//!                         2. Construct CSIP object.
//!                         3. Construct CSIPAcceptLanguageHeader objects.
//!                         4. Set the illegal "q"-parameter value .
//!                         5. Delete all objects.
//! @SYMTestStatus          Implemented
//! @SYMTestPriority        High
//! @SYMTestExpectedResults The error KErrSipCodecAcceptParams(-17802) returned when set illegal "q"-parameter value.
//! @SYMTestType            CIT
    START_TEST_BLOCK    100 t_sipcodecapi                      \SIP\sipcodec\t_csipacceptlanguageheader.ini
        CREATE_OBJECT       CSIP                        sip
        CREATE_OBJECT       CSIPAcceptLanguageHeader    sipacceptlanguageheader
        COMMAND             sip                         NewL            t_csipacceptlanguageheader-0011-NewL_Command01
        COMMAND             sipacceptlanguageheader     NewL            t_csipacceptlanguageheader-0011-NewL_Command02
        COMMAND  !Error=-17802 sipacceptlanguageheader  SetQParameterL  t_csipacceptlanguageheader-0011-SetQParameterL_Command03
        COMMAND             sipacceptlanguageheader     ~
        COMMAND             sip                         ~
    END_TEST_BLOCK
END_TESTCASE      t_csipacceptlanguageheader-0011
