applayerpluginsandutils/bookmarksupport/test/t_cbkmrkattachment.cpp
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2005-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 "bkmrkattachment.h"
       
    17 #include "repository.h"
       
    18 #include "testutils.h"
       
    19 
       
    20 LOCAL_D CTestWrapper* gTestWrapper;
       
    21 
       
    22 _LIT(KFilename, "t_cbkmrkattachment.cpp");
       
    23 _LIT8(KDataIcon,  "123456789");
       
    24 _LIT8(KDataIcon2, "different4436");
       
    25 
       
    26 LOCAL_D void AttachmentTestsL()
       
    27 	{
       
    28 	CRepository* iconRepository = CRepository::NewL(KUidIconRepository);
       
    29 	CBkmrkAttachment* newIcon = CBkmrkAttachment::NewL(*iconRepository, KDataIcon);
       
    30 	
       
    31 	gTestWrapper->TEST(newIcon->Size() == KDataIcon().Size());
       
    32 	gTestWrapper->TEST(newIcon->Data().Compare(KDataIcon) == 0);
       
    33 	gTestWrapper->TEST(newIcon->Size() != KDataIcon2().Size());
       
    34 	gTestWrapper->TEST(newIcon->Data().Compare(KDataIcon2) != 0);
       
    35 	
       
    36 	newIcon->SetDataL(KDataIcon2);
       
    37 	
       
    38 	gTestWrapper->TEST(newIcon->Size() == KDataIcon2().Size());
       
    39 	gTestWrapper->TEST(newIcon->Data().Compare(KDataIcon2) == 0);
       
    40 	gTestWrapper->TEST(newIcon->Size() != KDataIcon().Size());
       
    41 	gTestWrapper->TEST(newIcon->Data().Compare(KDataIcon) != 0);
       
    42 	
       
    43 	delete newIcon;
       
    44 	delete iconRepository;
       
    45 	}
       
    46 
       
    47 void DoAttachmentUnitL(CTestWrapper* aTest)
       
    48 	{
       
    49 	gTestWrapper = aTest;
       
    50 	gTestWrapper->SetFile(KFilename);
       
    51 	gTestWrapper->Next(_L("*** Attachment tests ***"));
       
    52 	
       
    53 	AttachmentTestsL();
       
    54 	}