equal
deleted
inserted
replaced
35 #include <hbmenu.h> |
35 #include <hbmenu.h> |
36 #include <hblineedit.h> |
36 #include <hblineedit.h> |
37 #include <hbgroupbox.h> |
37 #include <hbgroupbox.h> |
38 #include <dialpad.h> |
38 #include <dialpad.h> |
39 #include <hbmessagebox.h> |
39 #include <hbmessagebox.h> |
|
40 #include <QGraphicsLinearLayout> |
40 |
41 |
41 Q_DECLARE_METATYPE(LogsDetailsModel *) |
42 Q_DECLARE_METATYPE(LogsDetailsModel *) |
42 |
43 |
43 |
44 |
44 void UT_LogsDetailsView::initTestCase() |
45 void UT_LogsDetailsView::initTestCase() |
410 QVERIFY( !args.isNull() ); |
411 QVERIFY( !args.isNull() ); |
411 LogsDetailsModel* model = qVariantValue<LogsDetailsModel*>(args); |
412 LogsDetailsModel* model = qVariantValue<LogsDetailsModel*>(args); |
412 QVERIFY( model != 0 ); |
413 QVERIFY( model != 0 ); |
413 delete model; |
414 delete model; |
414 } |
415 } |
|
416 |
|
417 |
|
418 void UT_LogsDetailsView::testUpdateChildItems() |
|
419 { |
|
420 HbListView list; |
|
421 LogsDetailsModel* model = new LogsDetailsModel(); |
|
422 list.setModel( model, new LogsDetailsViewItem()); |
|
423 |
|
424 model->mDetailItemsCount = 5; |
|
425 QEvent* event = new QEvent(QEvent::GraphicsSceneResize); |
|
426 qApp->sendEvent(&list, event); //will create list items and call updateChildItems() |
|
427 |
|
428 // No separator item |
|
429 LogsDetailsViewItem* item = static_cast<LogsDetailsViewItem*>(list.viewItem(0)); |
|
430 QVERIFY(item); |
|
431 QVERIFY( !item->mLayout ); |
|
432 |
|
433 // Separator item updated OK |
|
434 model->mSeparatorIndex = 0; |
|
435 item->updateChildItems(); |
|
436 QVERIFY( item->mLayout ); |
|
437 QCOMPARE( item->mLayout->count(), 1 ); |
|
438 QGraphicsLayoutItem* layoutItem = item->mLayout->itemAt(0); |
|
439 QVERIFY( static_cast<HbGroupBox*>(layoutItem) ); |
|
440 |
|
441 // Testing groupBoxClicked() |
|
442 QVERIFY( model->mSeparatorCollapsed ); |
|
443 item->groupBoxClicked(false); |
|
444 QVERIFY( !model->mSeparatorCollapsed ); |
|
445 |
|
446 |
|
447 list.setModel(0); |
|
448 delete model; |
|
449 } |
|
450 |