aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAnna Gadomska <ext-anna.2.gadomska@nokia.com>2010-08-20 09:39:49 +0300
committerDominik Kapusta <dominik.kapusta@teleca.com>2010-08-20 08:58:29 +0200
commitd4db071d651b0c9a0b9de187b557b598e62c9a15 (patch)
treec0cee4a79808918b2e8c154308260aac6e159fee /tests
parent3b80792a4181143e8996b54031aaf447f517b39d (diff)
Changes: MContentItem unit test, MComboBox unit test improvements
RevBy: Dominik
Diffstat (limited to 'tests')
-rw-r--r--tests/ut_mcombobox/ut_mcombobox.cpp19
-rw-r--r--tests/ut_mcombobox/ut_mcombobox.h1
-rw-r--r--tests/ut_mcontentitem/ut_mcontentitem.cpp45
-rw-r--r--tests/ut_mcontentitem/ut_mcontentitem.h6
4 files changed, 71 insertions, 0 deletions
diff --git a/tests/ut_mcombobox/ut_mcombobox.cpp b/tests/ut_mcombobox/ut_mcombobox.cpp
index 68d2d8be..54dbe536 100644
--- a/tests/ut_mcombobox/ut_mcombobox.cpp
+++ b/tests/ut_mcombobox/ut_mcombobox.cpp
@@ -509,5 +509,24 @@ void Ut_MComboBox::testProgressIndicator()
QCOMPARE(comboboxButtonLayout->policy(), viewPrivate->button->layoutPolicy(MComboBoxButton::TitleShown));
}
+void Ut_MComboBox::testProgressIndicator2()
+{
+ MComboBoxView *view = (MComboBoxView *)m_combobox->view();
+ MComboBoxViewPrivate *viewPrivate = view->d_func();
+ MLayout* comboboxButtonLayout = static_cast<MLayout*>(viewPrivate->button->layout());
+
+ QCOMPARE(m_combobox->isProgressIndicatorVisible(), false);
+ QCOMPARE(comboboxButtonLayout->policy(), viewPrivate->button->layoutPolicy(MComboBoxButton::TitleShown));
+
+ m_combobox->showProgressIndicator();
+ QCOMPARE(m_combobox->isProgressIndicatorVisible(), true);
+ QCOMPARE(comboboxButtonLayout->policy(),
+ viewPrivate->button->layoutPolicy(MComboBoxButton::TitleShown|MComboBoxButton::ProgressShown));
+
+ m_combobox->hideProgressIndicator();
+ QCOMPARE(m_combobox->isProgressIndicatorVisible(), false);
+ QCOMPARE(comboboxButtonLayout->policy(), viewPrivate->button->layoutPolicy(MComboBoxButton::TitleShown));
+}
+
QTEST_APPLESS_MAIN(Ut_MComboBox)
diff --git a/tests/ut_mcombobox/ut_mcombobox.h b/tests/ut_mcombobox/ut_mcombobox.h
index f800e651..996fd95d 100644
--- a/tests/ut_mcombobox/ut_mcombobox.h
+++ b/tests/ut_mcombobox/ut_mcombobox.h
@@ -55,6 +55,7 @@ private slots:
void testActivatedSignal();
void testSetCurrentIndex();
void testProgressIndicator();
+ void testProgressIndicator2();
private:
MComboBox *m_combobox;
diff --git a/tests/ut_mcontentitem/ut_mcontentitem.cpp b/tests/ut_mcontentitem/ut_mcontentitem.cpp
index aaea5c98..141e9015 100644
--- a/tests/ut_mcontentitem/ut_mcontentitem.cpp
+++ b/tests/ut_mcontentitem/ut_mcontentitem.cpp
@@ -83,6 +83,7 @@ void Ut_MContentItem::testSetImage()
m_subject->setImage( image );
QCOMPARE( m_subject->image(), image );
+ QCOMPARE( m_subject->model()->itemImage(), image );
}
void Ut_MContentItem::testSetImageID()
@@ -171,5 +172,49 @@ void Ut_MContentItem::testModelSetItemPixmap()
QCOMPARE( m_subject->model()->itemPixmap().toImage(), pixmap.toImage());
}
+void Ut_MContentItem::testModelSetOptionalPixmap_data()
+{
+ QTest::addColumn<QString>("fname");
+ QTest::newRow("png") << qApp->applicationDirPath() + "/ut_mcontentitem_test.png";
+}
+
+void Ut_MContentItem::testModelSetOptionalPixmap()
+{
+ QFETCH(QString, fname);
+
+ const QPixmap pixmap(fname);
+ m_subject->model()->setOptionalPixmap( pixmap );
+ QCOMPARE( m_subject->model()->optionalPixmap().toImage(), pixmap.toImage());
+}
+
+void Ut_MContentItem::testModelSetOptionalImage_data()
+{
+ QTest::addColumn<QString>("fname");
+ QTest::newRow("png") << qApp->applicationDirPath() + "/ut_mcontentitem_test.png";
+}
+
+void Ut_MContentItem::testModelSetOptionalImage()
+{
+ QFETCH(QString, fname);
+ const QImage image(fname);
+ m_subject->setOptionalImage( image );
+
+ QCOMPARE( m_subject->model()->optionalImage(), image );
+}
+
+void Ut_MContentItem::testModelSetItemQImage_data()
+{
+ QTest::addColumn<QString>("fname");
+ QTest::newRow("png") << qApp->applicationDirPath() + "/ut_mcontentitem_test.png";
+}
+
+void Ut_MContentItem::testModelSetItemQImage()
+{
+ QFETCH(QString, fname);
+ const QImage image(fname);
+ m_subject->model()->setItemQImage( image );
+
+ QCOMPARE( m_subject->model()->itemQImage(), image );
+}
QTEST_APPLESS_MAIN(Ut_MContentItem)
diff --git a/tests/ut_mcontentitem/ut_mcontentitem.h b/tests/ut_mcontentitem/ut_mcontentitem.h
index 454b64fd..8450e7c6 100644
--- a/tests/ut_mcontentitem/ut_mcontentitem.h
+++ b/tests/ut_mcontentitem/ut_mcontentitem.h
@@ -53,6 +53,12 @@ private slots:
void testAdditionalItem();
void testModelSetItemPixmap_data();
void testModelSetItemPixmap();
+ void testModelSetOptionalPixmap_data();
+ void testModelSetOptionalPixmap();
+ void testModelSetOptionalImage_data();
+ void testModelSetOptionalImage();
+ void testModelSetItemQImage_data();
+ void testModelSetItemQImage();
private:
MContentItem *m_subject;