homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsdeletecollectionitemstate.cpp
changeset 96 458d8c8d9580
child 97 66b5fe3c07fd
equal deleted inserted replaced
92:6727c5d0afc7 96:458d8c8d9580
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Main test class for hsHomeScreenStatePlugin library.
       
    15 *
       
    16 */
       
    17 
       
    18 #include <QAction>
       
    19 #include <HbMainWindow>
       
    20 #include<hbmessagebox.h>
       
    21 #include<hbaction.h>
       
    22 
       
    23 #include "hsdeletecollectionitemstate.h"
       
    24 #include "t_hsmenuworkerstateplugin.h"
       
    25 #include "hscontentservice.h"
       
    26 #include "hsshortcutservice.h"
       
    27 #include "hsmenuevent.h"
       
    28 #include "hsmenuitemmodel.h"
       
    29 #include "hsdialogcontroller.h"
       
    30 
       
    31 // ---------------------------------------------------------------------------
       
    32 // ---------------------------------------------------------------------------
       
    33 //
       
    34 void MenuStatesTest::DeleteCollectionItemState_construction()
       
    35 {
       
    36 #ifdef Q_OS_SYMBIAN
       
    37 #ifdef UT_MEMORY_CHECK
       
    38     __UHEAP_MARK;
       
    39 #endif//UT_MEMORY_CHECK
       
    40 #endif//Q_OS_SYMBIAN
       
    41     {
       
    42         QState parentState1;
       
    43         parentState1.setObjectName(tr("testName1"));
       
    44 
       
    45         HsDeleteCollectionItemState del1(&parentState1);
       
    46         QString s1 = del1.objectName();
       
    47         QVERIFY(s1 == tr("testName1/DeleteCollectionItemState"));
       
    48 
       
    49     }
       
    50 #ifdef Q_OS_SYMBIAN
       
    51 #ifdef UT_MEMORY_CHECK
       
    52     __UHEAP_MARKEND;
       
    53 #endif//UT_MEMORY_CHECK
       
    54 #endif//Q_OS_SYMBIAN
       
    55 }
       
    56 
       
    57 
       
    58 
       
    59 void MenuStatesTest::DeleteCollectionItemState_onEntry()
       
    60 {
       
    61 #ifdef Q_OS_SYMBIAN
       
    62 #ifdef UT_MEMORY_CHECK
       
    63     __UHEAP_MARK;
       
    64 #endif//UT_MEMORY_CHECK
       
    65 #endif//Q_OS_SYMBIAN
       
    66     {
       
    67         QState parentState3;
       
    68         parentState3.setObjectName(tr("testName3"));
       
    69         HsDeleteCollectionItemState del3(&parentState3);
       
    70 
       
    71         int SomeAppId = 14; ////app to delete //esheel
       
    72         int dummyCollectionID = 123456789;
       
    73         QVariantMap params;
       
    74         params.insert(Hs::itemIdKey, SomeAppId);
       
    75         params.insert(Hs::collectionIdKey, dummyCollectionID);
       
    76 
       
    77         QEvent *e = new HsMenuEvent(HsMenuEvent::RemoveAppFromCollection, params);
       
    78         
       
    79         QString s3 = del3.objectName();
       
    80         QCOMPARE(s3, tr("testName3/DeleteCollectionItemState"));
       
    81         
       
    82         del3.onEntry( e );
       
    83         
       
    84         QCOMPARE(del3.mItemId, SomeAppId);
       
    85         QCOMPARE(del3.mCollectionId , dummyCollectionID);
       
    86 
       
    87         checkDialogController();
       
    88         
       
    89         del3.cleanUp();
       
    90         
       
    91         QCOMPARE(del3.mItemId, 0);
       
    92     }
       
    93 #ifdef Q_OS_SYMBIAN
       
    94 #ifdef UT_MEMORY_CHECK
       
    95     __UHEAP_MARKEND;
       
    96 #endif//UT_MEMORY_CHECK
       
    97 #endif//Q_OS_SYMBIAN
       
    98 }