summaryrefslogtreecommitdiffstats
path: root/tests/auto/qdate
diff options
context:
space:
mode:
authorIain <qt-info@nokia.com>2009-06-04 15:23:03 (GMT)
committerIain <qt-info@nokia.com>2009-06-04 15:23:03 (GMT)
commitaa081e40af9f3dd7b7e9a47e062f7784e0dbb515 (patch)
tree795ebd361f31956ac7ab5f8b850ec51ed7338dd0 /tests/auto/qdate
parent2b6dda723b168b3379684bc89b128ea1e792eddf (diff)
parent422905e301394dfd23b59a09ac9a725803ddf4e4 (diff)
downloadQt-aa081e40af9f3dd7b7e9a47e062f7784e0dbb515.zip
Qt-aa081e40af9f3dd7b7e9a47e062f7784e0dbb515.tar.gz
Qt-aa081e40af9f3dd7b7e9a47e062f7784e0dbb515.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt-s60-public
Diffstat (limited to 'tests/auto/qdate')
-rw-r--r--tests/auto/qdate/tst_qdate.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qdate/tst_qdate.cpp b/tests/auto/qdate/tst_qdate.cpp
index d4273d0..4d6c80c 100644
--- a/tests/auto/qdate/tst_qdate.cpp
+++ b/tests/auto/qdate/tst_qdate.cpp
@@ -82,6 +82,8 @@ private slots:
void operator_gt_eq();
void fromString_data();
void fromString();
+ void fromString_format_data();
+ void fromString_format();
void toString_format_data();
void toString_format();
void isLeapYear();
@@ -618,6 +620,30 @@ void tst_QDate::fromString()
QCOMPARE( QDate::fromString( str2, Qt::ISODate ), d1 );
}
+void tst_QDate::fromString_format_data()
+{
+ QTest::addColumn<QString>("string");
+ QTest::addColumn<QString>("format");
+ QTest::addColumn<QDate>("date");
+
+ //year with yy is always 19xx for compatibility
+ QTest::newRow( "data0" ) << QString("21052006") << QString("ddMMyyyy") << QDate(2006,5,21);
+ QTest::newRow( "data1" ) << QString("210506") << QString("ddMMyy") << QDate(1906,5,21);
+ QTest::newRow( "data2" ) << QString("21/5/2006") << QString("d/M/yyyy") << QDate(2006,5,21);
+ QTest::newRow( "data3" ) << QString("21/5/06") << QString("d/M/yy") << QDate(1906,5,21);
+ QTest::newRow( "data4" ) << QString("20060521") << QString("yyyyMMdd") << QDate(2006,5,21);
+ QTest::newRow( "data5" ) << QString("060521") << QString("yyMMdd") << QDate(1906,5,21);
+}
+
+void tst_QDate::fromString_format()
+{
+ QFETCH( QString, string );
+ QFETCH( QString, format );
+ QFETCH( QDate, date );
+
+ QCOMPARE( QDate::fromString( string, format ), date );
+}
+
void tst_QDate::toString_format_data()
{
QTest::addColumn<QDate>("t");