phoneuis/bubblemanager2/tsrc/unit/ut_bubbleparticipantlistitem/ut_bubbleparticipantlistitem.cpp
branchRCL_3
changeset 61 41a7f70b3818
equal deleted inserted replaced
58:40a3f856b14d 61:41a7f70b3818
       
     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:
       
    15 *
       
    16 */
       
    17 
       
    18 #include <QtGui>
       
    19 #include <QtTest/QtTest>
       
    20 
       
    21 #include <hbapplication.h>
       
    22 #include <hbmainwindow.h>
       
    23 #include <hbaction.h>
       
    24 #include <hbmainwindow.h>
       
    25 #include <hbinstance.h>
       
    26 #include <hbstyle.h>
       
    27 
       
    28 #include "bubbletest.h"
       
    29 #include "bubbleparticipantlistitem.h"
       
    30 
       
    31 class ut_BubbleParticipantListItem : public QObject
       
    32 {
       
    33     Q_OBJECT
       
    34 
       
    35 private slots:
       
    36     void initTestCase();
       
    37     void cleanupTestCase();
       
    38 
       
    39     void testCreateItem();
       
    40     void testUpdateChildItems();
       
    41 
       
    42 private:
       
    43     BubbleParticipantListItem* mItem;
       
    44     HbMainWindow* mMainWindow;
       
    45     int mStyleBaseId;
       
    46 };
       
    47 
       
    48 void ut_BubbleParticipantListItem::initTestCase()
       
    49 {
       
    50     mMainWindow = new HbMainWindow();
       
    51     mItem = new BubbleParticipantListItem();
       
    52     mMainWindow->addView(mItem);
       
    53     BubbleParticipantListItem* item =
       
    54         static_cast<BubbleParticipantListItem*>(mItem);
       
    55     item->updateChildItems();
       
    56     mMainWindow->show();
       
    57 }
       
    58 
       
    59 void ut_BubbleParticipantListItem::cleanupTestCase()
       
    60 {
       
    61     mItem->clearActions();
       
    62     delete mMainWindow;
       
    63 }
       
    64 
       
    65 void ut_BubbleParticipantListItem::testCreateItem()
       
    66 {
       
    67     HbAbstractViewItem* item = mItem->createItem();
       
    68     Q_ASSERT(item);
       
    69 }
       
    70 
       
    71 void ut_BubbleParticipantListItem::testUpdateChildItems()
       
    72 {
       
    73     HbAction act1("Action-1");
       
    74     HbAction act2("Action-2");
       
    75     mItem->addAction(&act1);
       
    76     mItem->addAction(&act2);
       
    77     mItem->updateChildItems();
       
    78     mItem->updateChildItems();
       
    79 }
       
    80 
       
    81 BUBBLE_TEST_MAIN(ut_BubbleParticipantListItem)
       
    82 #include "ut_bubbleparticipantlistitem.moc"