Speedup qDebug() << QDate(...)
We really do not need to do string parsing there. Change-Id: Ie2277d9ff0d0445285b7108023941af111d9baca Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
b6bce68a64
commit
607462019a
|
|
@ -4976,7 +4976,7 @@ QDataStream &operator>>(QDataStream &in, QDateTime &dateTime)
|
|||
#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_NO_DATESTRING)
|
||||
QDebug operator<<(QDebug dbg, const QDate &date)
|
||||
{
|
||||
dbg.nospace() << "QDate(" << date.toString(QStringLiteral("yyyy-MM-dd")) << ')';
|
||||
dbg.nospace() << "QDate(" << date.toString(Qt::ISODate) << ')';
|
||||
return dbg.space();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ private slots:
|
|||
void longMonthName() const;
|
||||
void standaloneLongMonthName() const;
|
||||
void roundtrip() const;
|
||||
void qdebug() const;
|
||||
private:
|
||||
QDate defDate() const { return QDate(1900, 1, 1); }
|
||||
QDate invalidDate() const { return QDate(); }
|
||||
|
|
@ -1476,5 +1477,13 @@ void tst_QDate::roundtrip() const
|
|||
}
|
||||
}
|
||||
|
||||
void tst_QDate::qdebug() const
|
||||
{
|
||||
QTest::ignoreMessage(QtDebugMsg, "QDate(\"\")");
|
||||
qDebug() << QDate();
|
||||
QTest::ignoreMessage(QtDebugMsg, "QDate(\"1983-08-07\")");
|
||||
qDebug() << QDate(1983, 8, 7);
|
||||
}
|
||||
|
||||
QTEST_APPLESS_MAIN(tst_QDate)
|
||||
#include "tst_qdate.moc"
|
||||
|
|
|
|||
Loading…
Reference in New Issue