|
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 #include "bubblebuttonstyle.h" |
|
31 |
|
32 class ut_BubbleParticipantListItem : public QObject |
|
33 { |
|
34 Q_OBJECT |
|
35 |
|
36 private slots: |
|
37 void initTestCase(); |
|
38 void cleanupTestCase(); |
|
39 |
|
40 void testCreateItem(); |
|
41 void testUpdateChildItems(); |
|
42 |
|
43 private: |
|
44 BubbleParticipantListItem* mItem; |
|
45 HbMainWindow* mMainWindow; |
|
46 BubbleButtonStyle* mButtonStyle; |
|
47 int mStyleBaseId; |
|
48 }; |
|
49 |
|
50 void ut_BubbleParticipantListItem::initTestCase() |
|
51 { |
|
52 mMainWindow = new HbMainWindow(); |
|
53 mButtonStyle = new BubbleButtonStyle(); |
|
54 mItem = new BubbleParticipantListItem(BUBBLE_STYLE_PLUGIN,*mButtonStyle); |
|
55 mMainWindow->addView(mItem); |
|
56 HbListViewItem* item = static_cast<HbListViewItem*>(mItem); |
|
57 item->updateChildItems(); |
|
58 mMainWindow->show(); |
|
59 } |
|
60 |
|
61 void ut_BubbleParticipantListItem::cleanupTestCase() |
|
62 { |
|
63 mItem->clearActions(); |
|
64 delete mMainWindow; |
|
65 delete mButtonStyle; |
|
66 } |
|
67 |
|
68 void ut_BubbleParticipantListItem::testCreateItem() |
|
69 { |
|
70 HbAbstractViewItem* item = mItem->createItem(); |
|
71 Q_ASSERT(item); |
|
72 } |
|
73 |
|
74 void ut_BubbleParticipantListItem::testUpdateChildItems() |
|
75 { |
|
76 HbAction act1("Action-1"); |
|
77 HbAction act2("Action-2"); |
|
78 mItem->addAction(&act1); |
|
79 mItem->addAction(&act2); |
|
80 mItem->updateChildItems(); |
|
81 mItem->setExpanded(true); |
|
82 mItem->updateChildItems(); |
|
83 } |
|
84 |
|
85 BUBBLE_TEST_MAIN(ut_BubbleParticipantListItem) |
|
86 #include "ut_bubbleparticipantlistitem.moc" |