phonebookengines_old/contactsmodel/tsrc/t_contenttype.cpp
changeset 40 b46a585f6909
equal deleted inserted replaced
37:fd64c38c277d 40:b46a585f6909
       
     1 // Copyright (c) 1997-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 <e32test.h>
       
    17 #include <cntfield.h>
       
    18 
       
    19 _LIT(KTestName, "CContentType Tests");
       
    20 _LIT(KConpareContentTest, "@SYMTESTCaseID:PIM-T-CONTENTTYPE-0001 ContentType compare");
       
    21 
       
    22 LOCAL_D RTest test(KTestName);
       
    23 
       
    24 /**
       
    25 
       
    26 @SYMTestCaseID     PIM-T-CONTENTTYPE-0001
       
    27 
       
    28 */
       
    29 
       
    30 void CompareContentTypeL()
       
    31 	{
       
    32 	test.Start(KConpareContentTest);
       
    33 
       
    34 	CContentType* leftContentType=CContentType::NewL();
       
    35 	CleanupStack::PushL(leftContentType);
       
    36 	CContentType* rightContentType=CContentType::NewL();
       
    37 	CleanupStack::PushL(rightContentType);
       
    38 	
       
    39 	leftContentType->SetMapping(KUidContactFieldVCardMapSIPID);
       
    40 	leftContentType->AddFieldTypeL(KUidContactFieldSIPID);
       
    41 	leftContentType->AddFieldTypeL(KUidContactFieldVCardMapVOIP);
       
    42 	
       
    43 	rightContentType->SetMapping(KUidContactFieldVCardMapSIPID);
       
    44 	rightContentType->AddFieldTypeL(KUidContactFieldSIPID);
       
    45 	rightContentType->AddFieldTypeL(KUidContactFieldVCardMapSIPID);
       
    46 	
       
    47 	test(!(*leftContentType == *rightContentType));
       
    48 	test(!(*rightContentType == *leftContentType));
       
    49 	test(!leftContentType->IsEqual(*rightContentType));
       
    50 	test(!rightContentType->IsEqual(*leftContentType));
       
    51 	test(leftContentType->IsEqual(*leftContentType));
       
    52 	test(rightContentType->IsEqual(*rightContentType));
       
    53 	
       
    54 	CleanupStack::PopAndDestroy(2); //leftContentType & rightContentType
       
    55 	test.End();
       
    56 	}
       
    57 
       
    58 
       
    59 void DoTestsL()
       
    60     {
       
    61     test.Start(_L("CContentType Tests"));
       
    62 
       
    63 	CompareContentTypeL();	
       
    64 	test.Close();
       
    65     }
       
    66 
       
    67 GLDEF_C TInt E32Main()
       
    68 	{
       
    69 	__UHEAP_MARK;
       
    70     CTrapCleanup* cleanupStack = CTrapCleanup::New();
       
    71     if (!cleanupStack)
       
    72         {
       
    73         return KErrNoMemory;
       
    74         }
       
    75 
       
    76     // Run the tests
       
    77     TRAPD(err, DoTestsL());
       
    78 
       
    79     // Cleanup
       
    80     delete cleanupStack;
       
    81 	__UHEAP_MARKEND;
       
    82 	return err;
       
    83     }