summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@digia.com>2012-10-15 18:22:45 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-24 01:38:54 +0200
commit6a7a08b4a873d0bb4602e4095dc62d7124a6f41e (patch)
treef6f2e9a3d93c8508427f88dbf00ad75c8b26ea27 /src/corelib
parent7cbdac13627b8e6ba9ed1bcd42fdf3f408f02b7d (diff)
Improve QDate test coverage.
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 <jedrzej.nowacki@digia.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/tools/qdatetime.cpp9
1 files changed, 4 insertions, 5 deletions
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;