From 6a7a08b4a873d0bb4602e4095dc62d7124a6f41e Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 15 Oct 2012 18:22:45 +0200 Subject: Improve QDate test coverage. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some statements could not be tested, such as default cases of switches where all possible cases are already handled and some statements where the system locale is used. I also removed some statements that would never be reached and hence will never be able to be covered by tests. Change-Id: I8ea3071f66d942d986e65708732af6751d36b5e3 Reviewed-by: Jędrzej Nowacki --- src/corelib/tools/qdatetime.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index a9d3095224..7561847c96 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -408,8 +408,6 @@ int QDate::daysInMonth() const getDateFromJulianDay(jd, &y, &m, 0); if (m == 2 && isLeapYear(y)) return 29; - else if (m < 1 || m > 12) - return 0; else return monthDays[m]; } @@ -1150,9 +1148,10 @@ QDate QDate::fromString(const QString& s, Qt::DateFormat f) break; } } - } - if (month < 1 || month > 12) { - return QDate(); + if (month == -1) { + // Month name matches neither English nor other localised name. + return QDate(); + } } bool ok; -- cgit v1.2.3