diff options
author | axis <qt-info@nokia.com> | 2009-05-20 13:44:05 +0200 |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-05-20 13:44:05 +0200 |
commit | 91e041fcff000024e619de5d7561ce141cb99d99 (patch) | |
tree | 0fc7285a4a1634f6a74499c324d00b6aef181974 /tests/auto/qcalendarwidget | |
parent | d68629e4cfb94776b8ef02cd01cf0b02bf430db8 (diff) | |
parent | 25f86fbab2e7d23832b0bb8ae8530289258e2aa5 (diff) | |
download | qt4-tools-91e041fcff000024e619de5d7561ce141cb99d99.tar.gz |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts:
tests/auto/network-settings.h
tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp
tests/auto/qiodevice/tst_qiodevice.cpp
tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp
tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp
tests/auto/qsslsocket/tst_qsslsocket.cpp
Diffstat (limited to 'tests/auto/qcalendarwidget')
-rw-r--r-- | tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp b/tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp index 30ac638dd2..0c7a1c9105 100644 --- a/tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp +++ b/tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp @@ -47,6 +47,8 @@ #include <qspinbox.h> #include <qmenu.h> #include <qdebug.h> +#include <qdatetime.h> +#include <qtextformat.h> //TESTED_CLASS= @@ -68,6 +70,11 @@ public slots: private slots: void getSetCheck(); void buttonClickCheck(); + + void setTextFormat(); + void resetTextFormat(); + + void setWeekdayFormat(); }; // Testing get/set functions @@ -215,6 +222,52 @@ void tst_QCalendarWidget::buttonClickCheck() } +void tst_QCalendarWidget::setTextFormat() +{ + QCalendarWidget calendar; + QTextCharFormat format; + format.setFontItalic(true); + format.setForeground(Qt::green); + + const QDate date(1984, 10, 20); + calendar.setDateTextFormat(date, format); + QCOMPARE(calendar.dateTextFormat(date), format); +} + +void tst_QCalendarWidget::resetTextFormat() +{ + QCalendarWidget calendar; + QTextCharFormat format; + format.setFontItalic(true); + format.setForeground(Qt::green); + + const QDate date(1984, 10, 20); + calendar.setDateTextFormat(date, format); + + calendar.setDateTextFormat(QDate(), QTextCharFormat()); + QCOMPARE(calendar.dateTextFormat(date), QTextCharFormat()); +} + +void tst_QCalendarWidget::setWeekdayFormat() +{ + QCalendarWidget calendar; + + QTextCharFormat format; + format.setFontItalic(true); + format.setForeground(Qt::green); + + calendar.setWeekdayTextFormat(Qt::Wednesday, format); + + // check the format of the a given month + for (int i = 1; i <= 31; ++i) { + const QDate date(1984, 10, i); + const Qt::DayOfWeek dayOfWeek = static_cast<Qt::DayOfWeek>(date.dayOfWeek()); + if (dayOfWeek == Qt::Wednesday) + QCOMPARE(calendar.weekdayTextFormat(dayOfWeek), format); + else + QVERIFY(calendar.weekdayTextFormat(dayOfWeek) != format); + } +} tst_QCalendarWidget::tst_QCalendarWidget() { |