OpenCoverage

qdatetimeparser.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qdatetimeparser.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtCore module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qplatformdefs.h"-
41#include "private/qdatetimeparser_p.h"-
42-
43#include "qdatastream.h"-
44#include "qset.h"-
45#include "qlocale.h"-
46#include "qdatetime.h"-
47#include "qregexp.h"-
48#include "qdebug.h"-
49-
50//#define QDATETIMEPARSER_DEBUG-
51#if defined (QDATETIMEPARSER_DEBUG) && !defined(QT_NO_DEBUG_STREAM)-
52# define QDTPDEBUG qDebug() << QString("%1:%2").arg(__FILE__).arg(__LINE__)-
53# define QDTPDEBUGN qDebug-
54#else-
55# define QDTPDEBUG if (false) qDebug()-
56# define QDTPDEBUGN if (false) qDebug-
57#endif-
58-
59QT_BEGIN_NAMESPACE-
60-
61#ifndef QT_BOOTSTRAPPED-
62-
63/*!-
64 \internal-
65 Gets the digit from a datetime. E.g.-
66-
67 QDateTime var(QDate(2004, 02, 02));-
68 int digit = getDigit(var, Year);-
69 // digit = 2004-
70*/-
71-
72int QDateTimeParser::getDigit(const QDateTime &t, int index) const-
73{-
74 if (index < 0 || index >= sectionNodes.size()) {
index < 0Description
TRUEnever evaluated
FALSEevaluated 3487 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
index >= sectionNodes.size()Description
TRUEnever evaluated
FALSEevaluated 3487 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
0-3487
75#ifndef QT_NO_DATESTRING-
76 qWarning("QDateTimeParser::getDigit() Internal error (%s %d)",-
77 qPrintable(t.toString()), index);-
78#else-
79 qWarning("QDateTimeParser::getDigit() Internal error (%d)", index);-
80#endif-
81 return -1;
never executed: return -1;
0
82 }-
83 const SectionNode &node = sectionNodes.at(index);-
84 switch (node.type) {-
85 case Hour24Section: case Hour12Section: return t.time().hour();
executed 724 times by 2 tests: return t.time().hour();
Executed by:
  • tst_QDateTimeEdit
  • tst_QItemDelegate
executed 419 times by 1 test: case Hour24Section:
Executed by:
  • tst_QDateTimeEdit
executed 305 times by 2 tests: case Hour12Section:
Executed by:
  • tst_QDateTimeEdit
  • tst_QItemDelegate
305-724
86 case MinuteSection: return t.time().minute();
executed 316 times by 1 test: return t.time().minute();
Executed by:
  • tst_QDateTimeEdit
executed 316 times by 1 test: case MinuteSection:
Executed by:
  • tst_QDateTimeEdit
316
87 case SecondSection: return t.time().second();
executed 299 times by 1 test: return t.time().second();
Executed by:
  • tst_QDateTimeEdit
executed 299 times by 1 test: case SecondSection:
Executed by:
  • tst_QDateTimeEdit
299
88 case MSecSection: return t.time().msec();
never executed: return t.time().msec();
never executed: case MSecSection:
0
89 case YearSection2Digits:
executed 566 times by 2 tests: case YearSection2Digits:
Executed by:
  • tst_QDate
  • tst_QDateTimeEdit
566
90 case YearSection: return t.date().year();
executed 749 times by 2 tests: return t.date().year();
Executed by:
  • tst_QDate
  • tst_QDateTimeEdit
executed 183 times by 1 test: case YearSection:
Executed by:
  • tst_QDateTimeEdit
183-749
91 case MonthSection: return t.date().month();
executed 159 times by 4 tests: return t.date().month();
Executed by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
executed 159 times by 4 tests: case MonthSection:
Executed by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
159
92 case DaySection: return t.date().day();
executed 131 times by 1 test: return t.date().day();
Executed by:
  • tst_QDateTimeEdit
executed 131 times by 1 test: case DaySection:
Executed by:
  • tst_QDateTimeEdit
131
93 case DayOfWeekSectionShort:
executed 90 times by 1 test: case DayOfWeekSectionShort:
Executed by:
  • tst_QDateTimeEdit
90
94 case DayOfWeekSectionLong: return t.date().day();
executed 1103 times by 1 test: return t.date().day();
Executed by:
  • tst_QDateTimeEdit
executed 1013 times by 1 test: case DayOfWeekSectionLong:
Executed by:
  • tst_QDateTimeEdit
1013-1103
95 case AmPmSection: return t.time().hour() > 11 ? 1 : 0;
executed 6 times by 1 test: return t.time().hour() > 11 ? 1 : 0;
Executed by:
  • tst_QDateTimeEdit
executed 6 times by 1 test: case AmPmSection:
Executed by:
  • tst_QDateTimeEdit
6
96-
97 default: break;
never executed: break;
never executed: default:
0
98 }-
99-
100#ifndef QT_NO_DATESTRING-
101 qWarning("QDateTimeParser::getDigit() Internal error 2 (%s %d)",-
102 qPrintable(t.toString()), index);-
103#else-
104 qWarning("QDateTimeParser::getDigit() Internal error 2 (%d)", index);-
105#endif-
106 return -1;
never executed: return -1;
0
107}-
108-
109/*!-
110 \internal-
111 Sets a digit in a datetime. E.g.-
112-
113 QDateTime var(QDate(2004, 02, 02));-
114 int digit = getDigit(var, Year);-
115 // digit = 2004-
116 setDigit(&var, Year, 2005);-
117 digit = getDigit(var, Year);-
118 // digit = 2005-
119*/-
120-
121bool QDateTimeParser::setDigit(QDateTime &v, int index, int newVal) const-
122{-
123 if (index < 0 || index >= sectionNodes.size()) {
index < 0Description
TRUEnever evaluated
FALSEevaluated 4310 times by 7 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
  • tst_QTime
index >= sectionNodes.size()Description
TRUEnever evaluated
FALSEevaluated 4310 times by 7 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
  • tst_QTime
0-4310
124#ifndef QT_NO_DATESTRING-
125 qWarning("QDateTimeParser::setDigit() Internal error (%s %d %d)",-
126 qPrintable(v.toString()), index, newVal);-
127#else-
128 qWarning("QDateTimeParser::setDigit() Internal error (%d %d)", index, newVal);-
129#endif-
130 return false;
never executed: return false;
0
131 }-
132 const SectionNode &node = sectionNodes.at(index);-
133-
134 const QDate date = v.date();-
135 const QTime time = v.time();-
136 int year = date.year();-
137 int month = date.month();-
138 int day = date.day();-
139 int hour = time.hour();-
140 int minute = time.minute();-
141 int second = time.second();-
142 int msec = time.msec();-
143-
144 switch (node.type) {-
145 case Hour24Section: case Hour12Section: hour = newVal; break;
executed 856 times by 3 tests: break;
Executed by:
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
executed 478 times by 2 tests: case Hour24Section:
Executed by:
  • tst_QDateTimeEdit
  • tst_QTime
executed 378 times by 2 tests: case Hour12Section:
Executed by:
  • tst_QDateTimeEdit
  • tst_QItemDelegate
378-856
146 case MinuteSection: minute = newVal; break;
executed 470 times by 1 test: break;
Executed by:
  • tst_QDateTimeEdit
executed 470 times by 1 test: case MinuteSection:
Executed by:
  • tst_QDateTimeEdit
470
147 case SecondSection: second = newVal; break;
executed 434 times by 1 test: break;
Executed by:
  • tst_QDateTimeEdit
executed 434 times by 1 test: case SecondSection:
Executed by:
  • tst_QDateTimeEdit
434
148 case MSecSection: msec = newVal; break;
executed 36 times by 1 test: break;
Executed by:
  • tst_QDateTimeEdit
executed 36 times by 1 test: case MSecSection:
Executed by:
  • tst_QDateTimeEdit
36
149 case YearSection2Digits:
executed 565 times by 2 tests: case YearSection2Digits:
Executed by:
  • tst_QDate
  • tst_QDateTimeEdit
565
150 case YearSection: year = newVal; break;
executed 719 times by 2 tests: break;
Executed by:
  • tst_QDate
  • tst_QDateTimeEdit
executed 154 times by 1 test: case YearSection:
Executed by:
  • tst_QDateTimeEdit
154-719
151 case MonthSection: month = newVal; break;
executed 241 times by 4 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
executed 241 times by 4 tests: case MonthSection:
Executed by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
241
152 case DaySection:
executed 445 times by 2 tests: case DaySection:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
445
153 case DayOfWeekSectionShort:
executed 90 times by 1 test: case DayOfWeekSectionShort:
Executed by:
  • tst_QDateTimeEdit
90
154 case DayOfWeekSectionLong:
executed 1013 times by 1 test: case DayOfWeekSectionLong:
Executed by:
  • tst_QDateTimeEdit
1013
155 if (newVal > 31) {
newVal > 31Description
TRUEnever evaluated
FALSEevaluated 1548 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
0-1548
156 // have to keep legacy behavior. setting the-
157 // date to 32 should return false. Setting it-
158 // to 31 for february should return true-
159 return false;
never executed: return false;
0
160 }-
161 day = newVal;-
162 break;
executed 1548 times by 2 tests: break;
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
1548
163 case AmPmSection: hour = (newVal == 0 ? hour % 12 : (hour % 12) + 12); break;
executed 6 times by 1 test: break;
Executed by:
  • tst_QDateTimeEdit
newVal == 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
executed 6 times by 1 test: case AmPmSection:
Executed by:
  • tst_QDateTimeEdit
2-6
164 default:
never executed: default:
0
165 qWarning("QDateTimeParser::setDigit() Internal error (%s)",-
166 qPrintable(node.name()));-
167 break;
never executed: break;
0
168 }-
169-
170 if (!(node.type & DaySectionMask)) {
!(node.type & DaySectionMask)Description
TRUEevaluated 2762 times by 6 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 1548 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
1548-2762
171 if (day < cachedDay)
day < cachedDayDescription
TRUEevaluated 21 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 2741 times by 6 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
  • tst_QTime
21-2741
172 day = cachedDay;
executed 21 times by 1 test: day = cachedDay;
Executed by:
  • tst_QDateTimeEdit
21
173 const int max = QDate(year, month, 1).daysInMonth();-
174 if (day > max) {
day > maxDescription
TRUEevaluated 76 times by 3 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTimeEdit
  • tst_QItemDelegate
FALSEevaluated 2686 times by 6 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
  • tst_QTime
76-2686
175 day = max;-
176 }
executed 76 times by 3 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTimeEdit
  • tst_QItemDelegate
76
177 }
executed 2762 times by 6 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
  • tst_QTime
2762
178 if (QDate::isValid(year, month, day) && QTime::isValid(hour, minute, second, msec)) {
QDate::isValid...r, month, day)Description
TRUEevaluated 4271 times by 7 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 39 times by 2 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTimeEdit
QTime::isValid... second, msec)Description
TRUEevaluated 4271 times by 7 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEnever evaluated
0-4271
179 v = QDateTime(QDate(year, month, day), QTime(hour, minute, second, msec), spec);-
180 return true;
executed 4271 times by 7 tests: return true;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
  • tst_QTime
4271
181 }-
182 return false;
executed 39 times by 2 tests: return false;
Executed by:
  • tst_QDate
  • tst_QDateTimeEdit
39
183}-
184-
185-
186-
187/*!-
188 \-
189-
190 Returns the absolute maximum for a section-
191*/-
192-
193int QDateTimeParser::absoluteMax(int s, const QDateTime &cur) const-
194{-
195 const SectionNode &sn = sectionNode(s);-
196 switch (sn.type) {-
197 case Hour24Section:
executed 1665 times by 6 tests: case Hour24Section:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
1665
198 case Hour12Section: return 23; // this is special-cased in
executed 2822 times by 8 tests: return 23;
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
executed 1157 times by 5 tests: case Hour12Section:
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
1157-2822
199 // parseSection. We want it to be-
200 // 23 for the stepBy case.-
201 case MinuteSection:
executed 2268 times by 8 tests: case MinuteSection:
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
2268
202 case SecondSection: return 59;
executed 4330 times by 8 tests: return 59;
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
executed 2062 times by 4 tests: case SecondSection:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkReply
  • tst_QNetworkRequest
2062-4330
203 case MSecSection: return 999;
executed 237 times by 2 tests: return 999;
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
executed 237 times by 2 tests: case MSecSection:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
237
204 case YearSection2Digits:
executed 1439 times by 7 tests: case YearSection2Digits:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
1439
205 case YearSection: return 9999; // sectionMaxSize will prevent
executed 3473 times by 10 tests: return 9999;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
executed 2034 times by 6 tests: case YearSection:
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
2034-3473
206 // people from typing in a larger-
207 // number in count == 2 sections.-
208 // stepBy() will work on real years anyway-
209 case MonthSection: return 12;
executed 1928 times by 7 tests: return 12;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QStyleSheetStyle
executed 1928 times by 7 tests: case MonthSection:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QStyleSheetStyle
1928
210 case DaySection:
executed 2979 times by 10 tests: case DaySection:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
2979
211 case DayOfWeekSectionShort:
executed 90 times by 1 test: case DayOfWeekSectionShort:
Executed by:
  • tst_QDateTimeEdit
90
212 case DayOfWeekSectionLong: return cur.isValid() ? cur.date().daysInMonth() : 31;
executed 4082 times by 10 tests: return cur.isValid() ? cur.date().daysInMonth() : 31;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
executed 1013 times by 1 test: case DayOfWeekSectionLong:
Executed by:
  • tst_QDateTimeEdit
1013-4082
213 case AmPmSection: return 1;
executed 6 times by 1 test: return 1;
Executed by:
  • tst_QDateTimeEdit
executed 6 times by 1 test: case AmPmSection:
Executed by:
  • tst_QDateTimeEdit
6
214 default: break;
never executed: break;
never executed: default:
0
215 }-
216 qWarning("QDateTimeParser::absoluteMax() Internal error (%s)",-
217 qPrintable(sn.name()));-
218 return -1;
never executed: return -1;
0
219}-
220-
221/*!-
222 \internal-
223-
224 Returns the absolute minimum for a section-
225*/-
226-
227int QDateTimeParser::absoluteMin(int s) const-
228{-
229 const SectionNode &sn = sectionNode(s);-
230 switch (sn.type) {-
231 case Hour24Section:
executed 1665 times by 6 tests: case Hour24Section:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
1665
232 case Hour12Section:
executed 1157 times by 5 tests: case Hour12Section:
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
1157
233 case MinuteSection:
executed 2257 times by 8 tests: case MinuteSection:
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
2257
234 case SecondSection:
executed 2050 times by 4 tests: case SecondSection:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkReply
  • tst_QNetworkRequest
2050
235 case MSecSection:
executed 237 times by 2 tests: case MSecSection:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
237
236 case YearSection2Digits:
executed 1436 times by 7 tests: case YearSection2Digits:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
1436
237 case YearSection: return 0;
executed 10836 times by 11 tests: return 0;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
executed 2034 times by 6 tests: case YearSection:
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
2034-10836
238 case MonthSection:
executed 1916 times by 7 tests: case MonthSection:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QStyleSheetStyle
1916
239 case DaySection:
executed 2955 times by 10 tests: case DaySection:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
2955
240 case DayOfWeekSectionShort:
executed 90 times by 1 test: case DayOfWeekSectionShort:
Executed by:
  • tst_QDateTimeEdit
90
241 case DayOfWeekSectionLong: return 1;
executed 5974 times by 10 tests: return 1;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
executed 1013 times by 1 test: case DayOfWeekSectionLong:
Executed by:
  • tst_QDateTimeEdit
1013-5974
242 case AmPmSection: return 0;
executed 6 times by 1 test: return 0;
Executed by:
  • tst_QDateTimeEdit
executed 6 times by 1 test: case AmPmSection:
Executed by:
  • tst_QDateTimeEdit
6
243 default: break;
never executed: break;
never executed: default:
0
244 }-
245 qWarning("QDateTimeParser::absoluteMin() Internal error (%s, %0x)",-
246 qPrintable(sn.name()), sn.type);-
247 return -1;
never executed: return -1;
0
248}-
249-
250/*!-
251 \internal-
252-
253 Returns the sectionNode for the Section \a s.-
254*/-
255-
256const QDateTimeParser::SectionNode &QDateTimeParser::sectionNode(int sectionIndex) const-
257{-
258 if (sectionIndex < 0) {
sectionIndex < 0Description
TRUEevaluated 709 times by 10 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
FALSEevaluated 148184 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
709-148184
259 switch (sectionIndex) {-
260 case FirstSectionIndex:
executed 229 times by 4 tests: case FirstSectionIndex:
Executed by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
229
261 return first;
executed 229 times by 4 tests: return first;
Executed by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
229
262 case LastSectionIndex:
executed 7 times by 1 test: case LastSectionIndex:
Executed by:
  • tst_QDateTimeEdit
7
263 return last;
executed 7 times by 1 test: return last;
Executed by:
  • tst_QDateTimeEdit
7
264 case NoSectionIndex:
executed 473 times by 7 tests: case NoSectionIndex:
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
473
265 return none;
executed 473 times by 7 tests: return none;
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
473
266 }-
267 } else if (sectionIndex < sectionNodes.size()) {
never executed: end of block
sectionIndex <...onNodes.size()Description
TRUEevaluated 148184 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEnever evaluated
0-148184
268 return sectionNodes.at(sectionIndex);
executed 148184 times by 11 tests: return sectionNodes.at(sectionIndex);
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
148184
269 }-
270-
271 qWarning("QDateTimeParser::sectionNode() Internal error (%d)",-
272 sectionIndex);-
273 return none;
never executed: return none;
0
274}-
275-
276QDateTimeParser::Section QDateTimeParser::sectionType(int sectionIndex) const-
277{-
278 return sectionNode(sectionIndex).type;
executed 6740 times by 10 tests: return sectionNode(sectionIndex).type;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
6740
279}-
280-
281-
282/*!-
283 \internal-
284-
285 Returns the starting position for section \a s.-
286*/-
287-
288int QDateTimeParser::sectionPos(int sectionIndex) const-
289{-
290 return sectionPos(sectionNode(sectionIndex));
executed 49357 times by 4 tests: return sectionPos(sectionNode(sectionIndex));
Executed by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
49357
291}-
292-
293int QDateTimeParser::sectionPos(const SectionNode &sn) const-
294{-
295 switch (sn.type) {-
296 case FirstSection: return 0;
executed 117 times by 4 tests: return 0;
Executed by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
executed 117 times by 4 tests: case FirstSection:
Executed by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
117
297 case LastSection: return displayText().size() - 1;
never executed: return displayText().size() - 1;
never executed: case LastSection:
0
298 default: break;
executed 51900 times by 4 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
executed 51900 times by 4 tests: default:
Executed by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
51900
299 }-
300 if (sn.pos == -1) {
sn.pos == -1Description
TRUEnever evaluated
FALSEevaluated 51900 times by 4 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
0-51900
301 qWarning("QDateTimeParser::sectionPos Internal error (%s)", qPrintable(sn.name()));-
302 return -1;
never executed: return -1;
0
303 }-
304 return sn.pos;
executed 51900 times by 4 tests: return sn.pos;
Executed by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
51900
305}-
306-
307-
308/*!-
309 \internal-
310-
311 helper function for parseFormat. removes quotes that are-
312 not escaped and removes the escaping on those that are escaped-
313-
314*/-
315-
316static QString unquote(const QStringRef &str)-
317{-
318 const QChar quote(QLatin1Char('\''));-
319 const QChar slash(QLatin1Char('\\'));-
320 const QChar zero(QLatin1Char('0'));-
321 QString ret;-
322 QChar status(zero);-
323 const int max = str.size();-
324 for (int i=0; i<max; ++i) {
i<maxDescription
TRUEevaluated 476 times by 5 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
FALSEevaluated 991 times by 10 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
476-991
325 if (str.at(i) == quote) {
str.at(i) == quoteDescription
TRUEevaluated 21 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkRequest
FALSEevaluated 455 times by 5 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
21-455
326 if (status != quote) {
status != quoteDescription
TRUEevaluated 11 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkRequest
FALSEevaluated 10 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkRequest
10-11
327 status = quote;-
328 } else if (!ret.isEmpty() && str.at(i - 1) == slash) {
executed 11 times by 4 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkRequest
!ret.isEmpty()Description
TRUEevaluated 9 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkRequest
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTime
str.at(i - 1) == slashDescription
TRUEnever evaluated
FALSEevaluated 9 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkRequest
0-11
329 ret[ret.size() - 1] = quote;-
330 } else {
never executed: end of block
0
331 status = zero;-
332 }
executed 10 times by 4 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkRequest
10
333 } else {-
334 ret += str.at(i);-
335 }
executed 455 times by 5 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
455
336 }-
337 return ret;
executed 991 times by 10 tests: return ret;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
991
338}-
339/*!-
340 \internal-
341-
342 Parses the format \a newFormat. If successful, returns \c true and-
343 sets up the format. Else keeps the old format and returns \c false.-
344-
345*/-
346-
347static inline int countRepeat(const QString &str, int index, int maxCount)-
348{-
349 int count = 1;-
350 const QChar ch(str.at(index));-
351 const int max = qMin(index + maxCount, str.size());-
352 while (index + count < max && str.at(index + count) == ch) {
index + count < maxDescription
TRUEevaluated 7926 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 1950 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
str.at(index + count) == chDescription
TRUEevaluated 5978 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 1948 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
1948-7926
353 ++count;-
354 }
executed 5978 times by 11 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
5978
355 return count;
executed 3898 times by 11 tests: return count;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
3898
356}-
357-
358static inline void appendSeparator(QStringList *list, const QString &string, int from, int size, int lastQuote)-
359{-
360 const QStringRef separator = string.midRef(from, size);-
361 list->append(lastQuote >= from ? unquote(separator) : separator.toString());-
362}
executed 3025 times by 11 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
3025
363-
364-
365bool QDateTimeParser::parseFormat(const QString &newFormat)-
366{-
367 const QLatin1Char quote('\'');-
368 const QLatin1Char slash('\\');-
369 const QLatin1Char zero('0');-
370 if (newFormat == displayFormat && !newFormat.isEmpty()) {
newFormat == displayFormatDescription
TRUEevaluated 175 times by 2 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTimeEdit
FALSEevaluated 1149 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
!newFormat.isEmpty()Description
TRUEevaluated 173 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDate
2-1149
371 return true;
executed 173 times by 1 test: return true;
Executed by:
  • tst_QDateTimeEdit
173
372 }-
373-
374 QDTPDEBUGN("parseFormat: %s", newFormat.toLatin1().constData());
dead code: QMessageLogger(__FILE__, 374, __PRETTY_FUNCTION__).debug("parseFormat: %s", newFormat.toLatin1().constData());
-
375-
376 QVector<SectionNode> newSectionNodes;-
377 Sections newDisplay = 0;-
378 QStringList newSeparators;-
379 int i, index = 0;-
380 int add = 0;-
381 QChar status(zero);-
382 const int max = newFormat.size();-
383 int lastQuote = -1;-
384 for (i = 0; i<max; ++i) {
i<maxDescription
TRUEevaluated 7177 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 1151 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
1151-7177
385 if (newFormat.at(i) == quote) {
newFormat.at(i) == quoteDescription
TRUEevaluated 21 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkRequest
FALSEevaluated 7156 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
21-7156
386 lastQuote = i;-
387 ++add;-
388 if (status != quote) {
status != quoteDescription
TRUEevaluated 11 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkRequest
FALSEevaluated 10 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkRequest
10-11
389 status = quote;-
390 } else if (i > 0 && newFormat.at(i - 1) != slash) {
executed 11 times by 4 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkRequest
i > 0Description
TRUEevaluated 10 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkRequest
FALSEnever evaluated
newFormat.at(i - 1) != slashDescription
TRUEevaluated 10 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkRequest
FALSEnever evaluated
0-11
391 status = zero;-
392 }
executed 10 times by 4 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkRequest
10
393 } else if (status != quote) {
executed 21 times by 4 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkRequest
status != quoteDescription
TRUEevaluated 7117 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 39 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkRequest
21-7117
394 const char sect = newFormat.at(i).toLatin1();-
395 switch (sect) {-
396 case 'H':
executed 81 times by 4 tests: case 'H':
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkReply
  • tst_QTime
81
397 case 'h':
executed 319 times by 8 tests: case 'h':
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkRequest
  • tst_QTime
319
398 if (parserType != QVariant::Date) {
parserType != QVariant::DateDescription
TRUEevaluated 397 times by 8 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
FALSEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTimeEdit
3-397
399 const Section hour = (sect == 'h') ? Hour12Section : Hour24Section;
(sect == 'h')Description
TRUEevaluated 316 times by 7 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkRequest
  • tst_QTime
FALSEevaluated 81 times by 4 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkReply
  • tst_QTime
81-316
400 const SectionNode sn = { hour, i - add, countRepeat(newFormat, i, 2), 0 };-
401 newSectionNodes.append(sn);-
402 appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote);-
403 i += sn.count - 1;-
404 index = i + 1;-
405 newDisplay |= hour;-
406 }
executed 397 times by 8 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
397
407 break;
executed 400 times by 9 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
400
408 case 'm':
executed 379 times by 8 tests: case 'm':
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
379
409 if (parserType != QVariant::Date) {
parserType != QVariant::DateDescription
TRUEevaluated 379 times by 8 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
FALSEnever evaluated
0-379
410 const SectionNode sn = { MinuteSection, i - add, countRepeat(newFormat, i, 2), 0 };-
411 newSectionNodes.append(sn);-
412 appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote);-
413 i += sn.count - 1;-
414 index = i + 1;-
415 newDisplay |= MinuteSection;-
416 }
executed 379 times by 8 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
379
417 break;
executed 379 times by 8 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
379
418 case 's':
executed 236 times by 4 tests: case 's':
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkReply
  • tst_QNetworkRequest
236
419 if (parserType != QVariant::Date) {
parserType != QVariant::DateDescription
TRUEevaluated 236 times by 4 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkReply
  • tst_QNetworkRequest
FALSEnever evaluated
0-236
420 const SectionNode sn = { SecondSection, i - add, countRepeat(newFormat, i, 2), 0 };-
421 newSectionNodes.append(sn);-
422 appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote);-
423 i += sn.count - 1;-
424 index = i + 1;-
425 newDisplay |= SecondSection;-
426 }
executed 236 times by 4 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkReply
  • tst_QNetworkRequest
236
427 break;
executed 236 times by 4 tests: break;
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkReply
  • tst_QNetworkRequest
236
428-
429 case 'z':
executed 47 times by 2 tests: case 'z':
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
47
430 if (parserType != QVariant::Date) {
parserType != QVariant::DateDescription
TRUEevaluated 47 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
FALSEnever evaluated
0-47
431 const SectionNode sn = { MSecSection, i - add, countRepeat(newFormat, i, 3) < 3 ? 1 : 3, 0 };-
432 newSectionNodes.append(sn);-
433 appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote);-
434 i += sn.count - 1;-
435 index = i + 1;-
436 newDisplay |= MSecSection;-
437 }
executed 47 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
47
438 break;
executed 47 times by 2 tests: break;
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
47
439 case 'A':
executed 16 times by 5 tests: case 'A':
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
16
440 case 'a':
executed 79 times by 4 tests: case 'a':
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
79
441 if (parserType != QVariant::Date) {
parserType != QVariant::DateDescription
TRUEevaluated 93 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDate
2-93
442 const bool cap = (sect == 'A');-
443 const SectionNode sn = { AmPmSection, i - add, (cap ? 1 : 0), 0 };-
444 newSectionNodes.append(sn);-
445 appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote);-
446 newDisplay |= AmPmSection;-
447 if (i + 1 < newFormat.size()
i + 1 < newFormat.size()Description
TRUEevaluated 92 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTimeEdit
1-92
448 && newFormat.at(i+1) == (cap ? QLatin1Char('P') : QLatin1Char('p'))) {
capDescription
TRUEevaluated 16 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
FALSEevaluated 76 times by 3 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
newFormat.at(i...tin1Char('p'))Description
TRUEevaluated 92 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
FALSEnever evaluated
0-92
449 ++i;-
450 }
executed 92 times by 5 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
92
451 index = i + 1;-
452 }
executed 93 times by 5 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
93
453 break;
executed 95 times by 6 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
95
454 case 'y':
executed 863 times by 10 tests: case 'y':
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
863
455 if (parserType != QVariant::Time) {
parserType != QVariant::TimeDescription
TRUEevaluated 859 times by 10 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
4-859
456 const int repeat = countRepeat(newFormat, i, 4);-
457 if (repeat >= 2) {
repeat >= 2Description
TRUEevaluated 858 times by 10 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTimeEdit
1-858
458 const SectionNode sn = { repeat == 4 ? YearSection : YearSection2Digits,-
459 i - add, repeat == 4 ? 4 : 2, 0 };-
460 newSectionNodes.append(sn);-
461 appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote);-
462 i += sn.count - 1;-
463 index = i + 1;-
464 newDisplay |= sn.type;-
465 }
executed 858 times by 10 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
858
466 }
executed 859 times by 10 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
859
467 break;
executed 863 times by 10 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
863
468 case 'M':
executed 981 times by 10 tests: case 'M':
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
981
469 if (parserType != QVariant::Time) {
parserType != QVariant::TimeDescription
TRUEevaluated 981 times by 10 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
FALSEnever evaluated
0-981
470 const SectionNode sn = { MonthSection, i - add, countRepeat(newFormat, i, 4), 0 };-
471 newSectionNodes.append(sn);-
472 newSeparators.append(unquote(newFormat.midRef(index, i - index)));-
473 i += sn.count - 1;-
474 index = i + 1;-
475 newDisplay |= MonthSection;-
476 }
executed 981 times by 10 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
981
477 break;
executed 981 times by 10 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
981
478 case 'd':
executed 999 times by 10 tests: case 'd':
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
999
479 if (parserType != QVariant::Time) {
parserType != QVariant::TimeDescription
TRUEevaluated 999 times by 10 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
FALSEnever evaluated
0-999
480 const int repeat = countRepeat(newFormat, i, 4);-
481 const Section sectionType = (repeat == 4 ? DayOfWeekSectionLong
repeat == 4Description
TRUEevaluated 31 times by 3 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
FALSEevaluated 968 times by 10 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
31-968
482 : (repeat == 3 ? DayOfWeekSectionShort : DaySection));
repeat == 3Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
FALSEevaluated 962 times by 10 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
6-962
483 const SectionNode sn = { sectionType, i - add, repeat, 0 };-
484 newSectionNodes.append(sn);-
485 appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote);-
486 i += sn.count - 1;-
487 index = i + 1;-
488 newDisplay |= sn.type;-
489 }
executed 999 times by 10 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
999
490 break;
executed 999 times by 10 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
999
491-
492 default:
executed 3117 times by 10 tests: default:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
3117
493 break;
executed 3117 times by 10 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
3117
494 }-
495 }-
496 }
executed 7177 times by 11 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
7177
497 if (newSectionNodes.isEmpty() && context == DateTimeEdit) {
newSectionNodes.isEmpty()Description
TRUEevaluated 11 times by 3 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
FALSEevaluated 1140 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
context == DateTimeEditDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
2-1140
498 return false;
executed 2 times by 1 test: return false;
Executed by:
  • tst_QDateTimeEdit
2
499 }-
500-
501 if ((newDisplay & (AmPmSection|Hour12Section)) == Hour12Section) {
(newDisplay & ... Hour12SectionDescription
TRUEevaluated 218 times by 5 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkRequest
  • tst_QTime
FALSEevaluated 931 times by 10 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QStyleSheetStyle
  • tst_QTime
218-931
502 const int count = newSectionNodes.size();-
503 for (int i = 0; i < count; ++i) {
i < countDescription
TRUEevaluated 878 times by 5 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkRequest
  • tst_QTime
FALSEevaluated 218 times by 5 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkRequest
  • tst_QTime
218-878
504 SectionNode &node = newSectionNodes[i];-
505 if (node.type == Hour12Section)
node.type == Hour12SectionDescription
TRUEevaluated 229 times by 5 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkRequest
  • tst_QTime
FALSEevaluated 649 times by 5 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkRequest
  • tst_QTime
229-649
506 node.type = Hour24Section;
executed 229 times by 5 tests: node.type = Hour24Section;
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkRequest
  • tst_QTime
229
507 }
executed 878 times by 5 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkRequest
  • tst_QTime
878
508 }
executed 218 times by 5 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkRequest
  • tst_QTime
218
509-
510 if (index < max) {
index < maxDescription
TRUEevaluated 16 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkRequest
FALSEevaluated 1133 times by 10 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QStyleSheetStyle
  • tst_QTime
16-1133
511 appendSeparator(&newSeparators, newFormat, index, index - max, lastQuote);-
512 } else {
executed 16 times by 4 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkRequest
16
513 newSeparators.append(QString());-
514 }
executed 1133 times by 10 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QStyleSheetStyle
  • tst_QTime
1133
515-
516 displayFormat = newFormat;-
517 separators = newSeparators;-
518 sectionNodes = newSectionNodes;-
519 display = newDisplay;-
520 last.pos = -1;-
521-
522// for (int i=0; i<sectionNodes.size(); ++i) {-
523// QDTPDEBUG << sectionNodes.at(i).name() << sectionNodes.at(i).count;-
524// }-
525-
526 QDTPDEBUG << newFormat << displayFormat;
dead code: QMessageLogger(__FILE__, 526, __PRETTY_FUNCTION__).debug() << newFormat << displayFormat;
-
527 QDTPDEBUGN("separators:\n'%s'", separators.join(QLatin1String("\n")).toLatin1().constData());
dead code: QMessageLogger(__FILE__, 527, __PRETTY_FUNCTION__).debug("separators:\n'%s'", separators.join(QLatin1String("\n")).toLatin1().constData());
-
528-
529 return true;
executed 1149 times by 11 tests: return true;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
1149
530}-
531-
532/*!-
533 \internal-
534-
535 Returns the size of section \a s.-
536*/-
537-
538int QDateTimeParser::sectionSize(int sectionIndex) const-
539{-
540 if (sectionIndex < 0)
sectionIndex < 0Description
TRUEnever evaluated
FALSEevaluated 18759 times by 4 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
0-18759
541 return 0;
never executed: return 0;
0
542-
543 if (sectionIndex >= sectionNodes.size()) {
sectionIndex >...onNodes.size()Description
TRUEnever evaluated
FALSEevaluated 18759 times by 4 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
0-18759
544 qWarning("QDateTimeParser::sectionSize Internal error (%d)", sectionIndex);-
545 return -1;
never executed: return -1;
0
546 }-
547-
548 if (sectionIndex == sectionNodes.size() - 1) {
sectionIndex =...des.size() - 1Description
TRUEevaluated 4554 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 14205 times by 4 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
4554-14205
549 // In some cases there is a difference between displayText() and text.-
550 // e.g. when text is 2000/01/31 and displayText() is "2000/2/31" - text-
551 // is the previous value and displayText() is the new value.-
552 // The size difference is always due to leading zeroes.-
553 int sizeAdjustment = 0;-
554 const int displayTextSize = displayText().size();-
555 if (displayTextSize != text.size()) {
displayTextSize != text.size()Description
TRUEevaluated 23 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 4531 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
23-4531
556 // Any zeroes added before this section will affect our size.-
557 int preceedingZeroesAdded = 0;-
558 if (sectionNodes.size() > 1 && context == DateTimeEdit) {
sectionNodes.size() > 1Description
TRUEevaluated 23 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEnever evaluated
context == DateTimeEditDescription
TRUEevaluated 23 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEnever evaluated
0-23
559 const auto begin = sectionNodes.cbegin();-
560 const auto end = begin + sectionIndex;-
561 for (auto sectionIt = begin; sectionIt != end; ++sectionIt)
sectionIt != endDescription
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 23 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
23-40
562 preceedingZeroesAdded += sectionIt->zeroesAdded;
executed 40 times by 1 test: preceedingZeroesAdded += sectionIt->zeroesAdded;
Executed by:
  • tst_QDateTimeEdit
40
563 }
executed 23 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
23
564 sizeAdjustment = preceedingZeroesAdded;-
565 }
executed 23 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
23
566-
567 return displayTextSize + sizeAdjustment - sectionPos(sectionIndex) - separators.last().size();
executed 4554 times by 1 test: return displayTextSize + sizeAdjustment - sectionPos(sectionIndex) - separators.last().size();
Executed by:
  • tst_QDateTimeEdit
4554
568 } else {-
569 return sectionPos(sectionIndex + 1) - sectionPos(sectionIndex)
executed 14205 times by 4 tests: return sectionPos(sectionIndex + 1) - sectionPos(sectionIndex) - separators.at(sectionIndex + 1).size();
Executed by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
14205
570 - separators.at(sectionIndex + 1).size();
executed 14205 times by 4 tests: return sectionPos(sectionIndex + 1) - sectionPos(sectionIndex) - separators.at(sectionIndex + 1).size();
Executed by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
14205
571 }-
572}-
573-
574-
575int QDateTimeParser::sectionMaxSize(Section s, int count) const-
576{-
577#ifndef QT_NO_TEXTDATE-
578 int mcount = 12;-
579#endif-
580-
581 switch (s) {-
582 case FirstSection:
never executed: case FirstSection:
0
583 case NoSection:
never executed: case NoSection:
0
584 case LastSection: return 0;
never executed: return 0;
never executed: case LastSection:
0
585-
586 case AmPmSection: {
executed 1726 times by 5 tests: case AmPmSection:
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
1726
587 const int lowerMax = qMin(getAmPmText(AmText, LowerCase).size(),-
588 getAmPmText(PmText, LowerCase).size());-
589 const int upperMax = qMin(getAmPmText(AmText, UpperCase).size(),-
590 getAmPmText(PmText, UpperCase).size());-
591 return qMin(4, qMin(lowerMax, upperMax));
executed 1726 times by 5 tests: return qMin(4, qMin(lowerMax, upperMax));
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
1726
592 }-
593-
594 case Hour24Section:
executed 1483 times by 6 tests: case Hour24Section:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
1483
595 case Hour12Section:
executed 943 times by 5 tests: case Hour12Section:
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
943
596 case MinuteSection:
executed 2232 times by 8 tests: case MinuteSection:
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
2232
597 case SecondSection:
executed 1931 times by 4 tests: case SecondSection:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkReply
  • tst_QNetworkRequest
1931
598 case DaySection: return 2;
executed 9811 times by 11 tests: return 2;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
executed 3222 times by 10 tests: case DaySection:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
3222-9811
599 case DayOfWeekSectionShort:
executed 40 times by 3 tests: case DayOfWeekSectionShort:
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
40
600 case DayOfWeekSectionLong:
executed 424 times by 3 tests: case DayOfWeekSectionLong:
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
424
601#ifdef QT_NO_TEXTDATE-
602 return 2;-
603#else-
604 mcount = 7;-
605 // fall through-
606#endif-
607 case MonthSection:
code before this statement executed 464 times by 3 tests: case MonthSection:
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
executed 3676 times by 10 tests: case MonthSection:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
464-3676
608#ifdef QT_NO_TEXTDATE-
609 return 2;-
610#else-
611 if (count <= 2)
count <= 2Description
TRUEevaluated 2211 times by 7 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QStyleSheetStyle
FALSEevaluated 1929 times by 6 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
1929-2211
612 return 2;
executed 2211 times by 7 tests: return 2;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QStyleSheetStyle
2211
613-
614 {-
615 int ret = 0;-
616 const QLocale l = locale();-
617 const QLocale::FormatType format = count == 4 ? QLocale::LongFormat : QLocale::ShortFormat;
count == 4Description
TRUEevaluated 619 times by 3 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
FALSEevaluated 1310 times by 6 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
619-1310
618 for (int i=1; i<=mcount; ++i) {
i<=mcountDescription
TRUEevaluated 20828 times by 6 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
FALSEevaluated 1929 times by 6 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
1929-20828
619 const QString str = (s == MonthSection
s == MonthSectionDescription
TRUEevaluated 17580 times by 6 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
FALSEevaluated 3248 times by 3 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
3248-17580
620 ? l.monthName(i, format)-
621 : l.dayName(i, format));-
622 ret = qMax(str.size(), ret);-
623 }
executed 20828 times by 6 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
20828
624 return ret;
executed 1929 times by 6 tests: return ret;
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
1929
625 }-
626#endif-
627 case MSecSection: return 3;
executed 283 times by 2 tests: return 3;
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
executed 283 times by 2 tests: case MSecSection:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
283
628 case YearSection: return 4;
executed 2161 times by 6 tests: return 4;
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
executed 2161 times by 6 tests: case YearSection:
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
2161
629 case YearSection2Digits: return 2;
executed 907 times by 7 tests: return 2;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
executed 907 times by 7 tests: case YearSection2Digits:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
907
630-
631 case CalendarPopupSection:
never executed: case CalendarPopupSection:
0
632 case Internal:
never executed: case Internal:
0
633 case TimeSectionMask:
never executed: case TimeSectionMask:
0
634 case DateSectionMask:
never executed: case DateSectionMask:
0
635 case HourSectionMask:
never executed: case HourSectionMask:
0
636 case YearSectionMask:
never executed: case YearSectionMask:
0
637 case DayOfWeekSectionMask:
never executed: case DayOfWeekSectionMask:
0
638 case DaySectionMask:
never executed: case DaySectionMask:
0
639 qWarning("QDateTimeParser::sectionMaxSize: Invalid section %s",-
640 SectionNode::name(s).toLatin1().constData());-
641-
642 case NoSectionIndex:
code before this statement never executed: case NoSectionIndex:
never executed: case NoSectionIndex:
0
643 case FirstSectionIndex:
never executed: case FirstSectionIndex:
0
644 case LastSectionIndex:
never executed: case LastSectionIndex:
0
645 case CalendarPopupIndex:
never executed: case CalendarPopupIndex:
0
646 // these cases can't happen-
647 break;
never executed: break;
0
648 }-
649 return -1;
never executed: return -1;
0
650}-
651-
652-
653int QDateTimeParser::sectionMaxSize(int index) const-
654{-
655 const SectionNode &sn = sectionNode(index);-
656 return sectionMaxSize(sn.type, sn.count);
executed 19028 times by 11 tests: return sectionMaxSize(sn.type, sn.count);
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
19028
657}-
658-
659/*!-
660 \internal-
661-
662 Returns the text of section \a s. This function operates on the-
663 arg text rather than edit->text().-
664*/-
665-
666-
667QString QDateTimeParser::sectionText(const QString &text, int sectionIndex, int index) const-
668{-
669 const SectionNode &sn = sectionNode(sectionIndex);-
670 switch (sn.type) {-
671 case NoSectionIndex:
never executed: case NoSectionIndex:
0
672 case FirstSectionIndex:
never executed: case FirstSectionIndex:
0
673 case LastSectionIndex:
never executed: case LastSectionIndex:
0
674 return QString();
never executed: return QString();
0
675 default: break;
executed 175 times by 1 test: break;
Executed by:
  • tst_QDateTimeEdit
executed 175 times by 1 test: default:
Executed by:
  • tst_QDateTimeEdit
175
676 }-
677-
678 return text.mid(index, sectionSize(sectionIndex));
executed 175 times by 1 test: return text.mid(index, sectionSize(sectionIndex));
Executed by:
  • tst_QDateTimeEdit
175
679}-
680-
681QString QDateTimeParser::sectionText(int sectionIndex) const-
682{-
683 const SectionNode &sn = sectionNode(sectionIndex);-
684 return sectionText(displayText(), sectionIndex, sn.pos);
executed 46 times by 1 test: return sectionText(displayText(), sectionIndex, sn.pos);
Executed by:
  • tst_QDateTimeEdit
46
685}-
686-
687-
688#ifndef QT_NO_TEXTDATE-
689/*!-
690 \internal:skipToNextSection-
691-
692 Parses the part of \a text that corresponds to \a s and returns-
693 the value of that field. Sets *stateptr to the right state if-
694 stateptr != 0.-
695*/-
696-
697int QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionIndex,-
698 QString &text, int &cursorPosition, int index,-
699 State &state, int *usedptr) const-
700{-
701 state = Invalid;-
702 int num = 0;-
703 const SectionNode &sn = sectionNode(sectionIndex);-
704 if ((sn.type & Internal) == Internal) {
(sn.type & Int...l) == InternalDescription
TRUEnever evaluated
FALSEevaluated 15899 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
0-15899
705 qWarning("QDateTimeParser::parseSection Internal error (%s %d)",-
706 qPrintable(sn.name()), sectionIndex);-
707 return -1;
never executed: return -1;
0
708 }-
709-
710 const int sectionmaxsize = sectionMaxSize(sectionIndex);-
711 QStringRef sectionTextRef = text.midRef(index, sectionmaxsize);-
712 int sectiontextSize = sectionTextRef.size();-
713-
714 QDTPDEBUG << "sectionValue for" << sn.name()
dead code: QMessageLogger(__FILE__, 714, __PRETTY_FUNCTION__).debug() << "sectionValue for" << sn.name() << "with text" << text << "and st" << sectionTextRef << text.midRef(index, sectionmaxsize) << index;
-
715 << "with text" << text << "and st" << sectionTextRef
dead code: QMessageLogger(__FILE__, 714, __PRETTY_FUNCTION__).debug() << "sectionValue for" << sn.name() << "with text" << text << "and st" << sectionTextRef << text.midRef(index, sectionmaxsize) << index;
-
716 << text.midRef(index, sectionmaxsize)
dead code: QMessageLogger(__FILE__, 714, __PRETTY_FUNCTION__).debug() << "sectionValue for" << sn.name() << "with text" << text << "and st" << sectionTextRef << text.midRef(index, sectionmaxsize) << index;
-
717 << index;
dead code: QMessageLogger(__FILE__, 714, __PRETTY_FUNCTION__).debug() << "sectionValue for" << sn.name() << "with text" << text << "and st" << sectionTextRef << text.midRef(index, sectionmaxsize) << index;
-
718-
719 int used = 0;-
720 switch (sn.type) {-
721 case AmPmSection: {
executed 863 times by 5 tests: case AmPmSection:
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
863
722 QString sectiontext = sectionTextRef.toString();-
723 const int ampm = findAmPm(sectiontext, sectionIndex, &used);-
724 switch (ampm) {-
725 case AM: // sectiontext == AM
executed 758 times by 5 tests: case AM:
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
758
726 case PM: // sectiontext == PM
executed 103 times by 3 tests: case PM:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
103
727 num = ampm;-
728 state = Acceptable;-
729 break;
executed 861 times by 5 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
861
730 case PossibleAM: // sectiontext => AM
never executed: case PossibleAM:
0
731 case PossiblePM: // sectiontext => PM
never executed: case PossiblePM:
0
732 num = ampm - 2;-
733 state = Intermediate;-
734 break;
never executed: break;
0
735 case PossibleBoth: // sectiontext => AM|PM
never executed: case PossibleBoth:
0
736 num = 0;-
737 state = Intermediate;-
738 break;
never executed: break;
0
739 case Neither:
executed 2 times by 2 tests: case Neither:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
2
740 state = Invalid;-
741 QDTPDEBUG << "invalid because findAmPm(" << sectiontext << ") returned -1";
dead code: QMessageLogger(__FILE__, 741, __PRETTY_FUNCTION__).debug() << "invalid because findAmPm(" << sectiontext << ") returned -1";
-
742 break;
executed 2 times by 2 tests: break;
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
2
743 default:
never executed: default:
0
744 QDTPDEBUGN("This should never happen (findAmPm returned %d)", ampm);
dead code: QMessageLogger(__FILE__, 744, __PRETTY_FUNCTION__).debug("This should never happen (findAmPm returned %d)", ampm);
-
745 break;
never executed: break;
0
746 }-
747 if (state != Invalid)
state != InvalidDescription
TRUEevaluated 861 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
2-861
748 text.replace(index, used, sectiontext.constData(), used);
executed 861 times by 5 tests: text.replace(index, used, sectiontext.constData(), used);
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
861
749 break; }
executed 863 times by 5 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
863
750 case MonthSection:
executed 3195 times by 10 tests: case MonthSection:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
3195
751 case DayOfWeekSectionShort:
executed 40 times by 3 tests: case DayOfWeekSectionShort:
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
40
752 case DayOfWeekSectionLong:
executed 424 times by 3 tests: case DayOfWeekSectionLong:
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
424
753 if (sn.count >= 3) {
sn.count >= 3Description
TRUEevaluated 1926 times by 6 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
FALSEevaluated 1733 times by 7 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QStyleSheetStyle
1733-1926
754 QString sectiontext = sectionTextRef.toString();-
755 if (sn.type == MonthSection) {
sn.type == MonthSectionDescription
TRUEevaluated 1462 times by 6 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
FALSEevaluated 464 times by 3 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
464-1462
756 int min = 1;-
757 const QDate minDate = getMinimum().date();-
758 if (currentValue.date().year() == minDate.year()) {
currentValue.d...minDate.year()Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 1445 times by 6 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
17-1445
759 min = minDate.month();-
760 }
executed 17 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
17
761 num = findMonth(sectiontext.toLower(), min, sectionIndex, &sectiontext, &used);-
762 } else {
executed 1462 times by 6 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
1462
763 num = findDay(sectiontext.toLower(), 1, sectionIndex, &sectiontext, &used);-
764 }
executed 464 times by 3 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
464
765-
766 if (num != -1) {
num != -1Description
TRUEevaluated 1921 times by 6 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
5-1921
767 state = (used == sectiontext.size() ? Acceptable : Intermediate);
used == sectiontext.size()Description
TRUEevaluated 1814 times by 6 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
FALSEevaluated 107 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
107-1814
768 text.replace(index, used, sectiontext.constData(), used);-
769 } else {
executed 1921 times by 6 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
1921
770 state = Intermediate;-
771 }
executed 5 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
5
772 break;
executed 1926 times by 6 tests: break;
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
1926
773 } // else: fall through-
774 case DaySection:
code before this statement executed 1733 times by 7 tests: case DaySection:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QStyleSheetStyle
executed 2691 times by 10 tests: case DaySection:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
1733-2691
775 case YearSection:
executed 1932 times by 6 tests: case YearSection:
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
1932
776 case YearSection2Digits:
executed 880 times by 7 tests: case YearSection2Digits:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
880
777 case Hour12Section:
executed 820 times by 5 tests: case Hour12Section:
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
820
778 case Hour24Section:
executed 1246 times by 6 tests: case Hour24Section:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
1246
779 case MinuteSection:
executed 1886 times by 8 tests: case MinuteSection:
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
1886
780 case SecondSection:
executed 1703 times by 4 tests: case SecondSection:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkReply
  • tst_QNetworkRequest
1703
781 case MSecSection: {
executed 219 times by 2 tests: case MSecSection:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
219
782 if (sectiontextSize == 0) {
sectiontextSize == 0Description
TRUEevaluated 17 times by 2 tests
Evaluated by:
  • tst_QDateTimeEdit
  • tst_QTime
FALSEevaluated 13093 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
17-13093
783 num = 0;-
784 used = 0;-
785 state = Intermediate;-
786 } else {
executed 17 times by 2 tests: end of block
Executed by:
  • tst_QDateTimeEdit
  • tst_QTime
17
787 const int absMax = absoluteMax(sectionIndex);-
788 QLocale loc;-
789 bool ok = true;-
790 int last = -1;-
791 used = -1;-
792-
793 QStringRef digitsStr = sectionTextRef;-
794 for (int i = 0; i < sectiontextSize; ++i) {
i < sectiontextSizeDescription
TRUEevaluated 29808 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 12847 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
12847-29808
795 if (digitsStr.at(i).isSpace()) {
digitsStr.at(i).isSpace()Description
TRUEevaluated 246 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
FALSEevaluated 29562 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
246-29562
796 sectiontextSize = i;-
797 break;
executed 246 times by 4 tests: break;
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
246
798 }-
799 }
executed 29562 times by 11 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
29562
800-
801 const int max = qMin(sectionmaxsize, sectiontextSize);-
802 for (int digits = max; digits >= 1; --digits) {
digits >= 1Description
TRUEevaluated 14065 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 48 times by 3 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTimeEdit
  • tst_QFtp
48-14065
803 digitsStr.truncate(digits);-
804 int tmp = (int)loc.toUInt(digitsStr, &ok);-
805 if (ok && sn.type == Hour12Section) {
okDescription
TRUEevaluated 13053 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 1012 times by 6 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
sn.type == Hour12SectionDescription
TRUEevaluated 822 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
FALSEevaluated 12231 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
822-13053
806 if (tmp > 12) {
tmp > 12Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 820 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
2-820
807 tmp = -1;-
808 ok = false;-
809 } else if (tmp == 12) {
executed 2 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
tmp == 12Description
TRUEevaluated 100 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
FALSEevaluated 720 times by 4 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
2-720
810 tmp = 0;-
811 }
executed 100 times by 3 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
100
812 }
executed 822 times by 5 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
822
813 if (ok && tmp <= absMax) {
okDescription
TRUEevaluated 13051 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 1014 times by 6 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
tmp <= absMaxDescription
TRUEevaluated 13045 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 6 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
6-13051
814 QDTPDEBUG << sectionTextRef.left(digits) << tmp << digits;
dead code: QMessageLogger(__FILE__, 814, __PRETTY_FUNCTION__).debug() << sectionTextRef.left(digits) << tmp << digits;
-
815 last = tmp;-
816 used = digits;-
817 break;
executed 13045 times by 11 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
13045
818 }-
819 }
executed 1020 times by 7 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
  • tst_QTime
1020
820-
821 if (last == -1) {
last == -1Description
TRUEevaluated 48 times by 3 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTimeEdit
  • tst_QFtp
FALSEevaluated 13045 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
48-13045
822 QChar first(sectionTextRef.at(0));-
823 if (separators.at(sectionIndex + 1).startsWith(first)) {
separators.at(...rtsWith(first)Description
TRUEevaluated 46 times by 2 tests
Evaluated by:
  • tst_QDateTimeEdit
  • tst_QFtp
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDate
2-46
824 used = 0;-
825 state = Intermediate;-
826 } else {
executed 46 times by 2 tests: end of block
Executed by:
  • tst_QDateTimeEdit
  • tst_QFtp
46
827 state = Invalid;-
828 QDTPDEBUG << "invalid because" << sectionTextRef << "can't become a uint" << last << ok;
dead code: QMessageLogger(__FILE__, 828, __PRETTY_FUNCTION__).debug() << "invalid because" << sectionTextRef << "can't become a uint" << last << ok;
-
829 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QDate
2
830 } else {-
831 num += last;-
832 const FieldInfo fi = fieldInfo(sectionIndex);-
833 const bool done = (used == sectionmaxsize);-
834 if (!done && fi & Fraction) { // typing 2 in a zzz field should be .200, not .002
!doneDescription
TRUEevaluated 1515 times by 8 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 11530 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
1515-11530
835 for (int i=used; i<sectionmaxsize; ++i) {
i<sectionmaxsizeDescription
TRUEevaluated 148 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 78 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
78-148
836 num *= 10;-
837 }
executed 148 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
148
838 }
executed 78 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
78
839 const int absMin = absoluteMin(sectionIndex);-
840 if (num < absMin) {
num < absMinDescription
TRUEevaluated 25 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 13020 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
25-13020
841 state = done ? Invalid : Intermediate;
doneDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
3-22
842 if (done)
doneDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
3-22
843 QDTPDEBUG << "invalid because" << num << "is less than absoluteMin" << absMin;
dead code: QMessageLogger(__FILE__, 843, __PRETTY_FUNCTION__).debug() << "invalid because" << num << "is less than absoluteMin" << absMin;
-
844 } else if (num > absMax) {
executed 25 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
num > absMaxDescription
TRUEnever evaluated
FALSEevaluated 13020 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
0-13020
845 state = Intermediate;-
846 } else if (!done && (fi & (FixedWidth|Numeric)) == (FixedWidth|Numeric)) {
never executed: end of block
!doneDescription
TRUEevaluated 1493 times by 8 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 11527 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
(fi & (FixedWi...Width|Numeric)Description
TRUEevaluated 465 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
FALSEevaluated 1028 times by 8 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
  • tst_QTime
0-11527
847 if (skipToNextSection(sectionIndex, currentValue, digitsStr)) {
skipToNextSect...ue, digitsStr)Description
TRUEevaluated 27 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 438 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
27-438
848 state = Acceptable;-
849 const int missingZeroes = sectionmaxsize - digitsStr.size();-
850 text.insert(index, QString(missingZeroes, QLatin1Char('0')));-
851 used = sectionmaxsize;-
852 cursorPosition += missingZeroes;-
853 ++(const_cast<QDateTimeParser*>(this)->sectionNodes[sectionIndex].zeroesAdded);-
854 } else {
executed 27 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
27
855 state = Intermediate;;-
856 }
executed 438 times by 4 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
438
857 } else {-
858 state = Acceptable;-
859 }
executed 12555 times by 11 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
12555
860 }-
861 }-
862 break; }
executed 13110 times by 11 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
13110
863 default:
never executed: default:
0
864 qWarning("QDateTimeParser::parseSection Internal error (%s %d)",-
865 qPrintable(sn.name()), sectionIndex);-
866 return -1;
never executed: return -1;
0
867 }-
868-
869 if (usedptr)
usedptrDescription
TRUEevaluated 15899 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEnever evaluated
0-15899
870 *usedptr = used;
executed 15899 times by 11 tests: *usedptr = used;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
15899
871-
872 return (state != Invalid ? num : -1);
executed 15899 times by 11 tests: return (state != Invalid ? num : -1);
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
15899
873}-
874#endif // QT_NO_TEXTDATE-
875-
876#ifndef QT_NO_DATESTRING-
877/*!-
878 \internal-
879*/-
880-
881QDateTimeParser::StateNode QDateTimeParser::parse(QString &input, int &cursorPosition,-
882 const QDateTime &currentValue, bool fixup) const-
883{-
884 const QDateTime minimum = getMinimum();-
885 const QDateTime maximum = getMaximum();-
886-
887 State state = Acceptable;-
888-
889 QDateTime newCurrentValue;-
890 bool conflicts = false;-
891 const int sectionNodesCount = sectionNodes.size();-
892-
893 QDTPDEBUG << "parse" << input;
dead code: QMessageLogger(__FILE__, 893, __PRETTY_FUNCTION__).debug() << "parse" << input;
-
894 {-
895 int pos = 0;-
896 int year, month, day;-
897 const QDate currentDate = currentValue.date();-
898 const QTime currentTime = currentValue.time();-
899 currentDate.getDate(&year, &month, &day);-
900 int year2digits = year % 100;-
901 int hour = currentTime.hour();-
902 int hour12 = -1;-
903 int minute = currentTime.minute();-
904 int second = currentTime.second();-
905 int msec = currentTime.msec();-
906 int dayofweek = currentDate.dayOfWeek();-
907-
908 int ampm = -1;-
909 Sections isSet = NoSection;-
910 int num;-
911 State tmpstate;-
912-
913 for (int index=0; state != Invalid && index<sectionNodesCount; ++index) {
state != InvalidDescription
TRUEevaluated 20637 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 7 times by 3 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
index<sectionNodesCountDescription
TRUEevaluated 16021 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 4616 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
7-20637
914 if (QStringRef(&input, pos, separators.at(index).size()) != separators.at(index)) {
QStringRef(&in...tors.at(index)Description
TRUEevaluated 122 times by 2 tests
Evaluated by:
  • tst_QDateTimeEdit
  • tst_QFtp
FALSEevaluated 15899 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
122-15899
915 QDTPDEBUG << "invalid because" << input.midRef(pos, separators.at(index).size())
dead code: QMessageLogger(__FILE__, 915, __PRETTY_FUNCTION__).debug() << "invalid because" << input.midRef(pos, separators.at(index).size()) << "!=" << separators.at(index) << index << pos << currentSectionIndex;
-
916 << "!=" << separators.at(index)
dead code: QMessageLogger(__FILE__, 915, __PRETTY_FUNCTION__).debug() << "invalid because" << input.midRef(pos, separators.at(index).size()) << "!=" << separators.at(index) << index << pos << currentSectionIndex;
-
917 << index << pos << currentSectionIndex;
dead code: QMessageLogger(__FILE__, 915, __PRETTY_FUNCTION__).debug() << "invalid because" << input.midRef(pos, separators.at(index).size()) << "!=" << separators.at(index) << index << pos << currentSectionIndex;
-
918 state = Invalid;-
919 goto end;
executed 122 times by 2 tests: goto end;
Executed by:
  • tst_QDateTimeEdit
  • tst_QFtp
122
920 }-
921 pos += separators.at(index).size();-
922 sectionNodes[index].pos = pos;-
923 int *current = 0;-
924 const SectionNode sn = sectionNodes.at(index);-
925 int used;-
926-
927 num = parseSection(currentValue, index, input, cursorPosition, pos, tmpstate, &used);-
928 QDTPDEBUG << "sectionValue" << sn.name() << input
dead code: QMessageLogger(__FILE__, 928, __PRETTY_FUNCTION__).debug() << "sectionValue" << sn.name() << input << "pos" << pos << "used" << used << stateName(tmpstate);
-
929 << "pos" << pos << "used" << used << stateName(tmpstate);
dead code: QMessageLogger(__FILE__, 928, __PRETTY_FUNCTION__).debug() << "sectionValue" << sn.name() << input << "pos" << pos << "used" << used << stateName(tmpstate);
-
930 if (fixup && tmpstate == Intermediate && used < sn.count) {
fixupDescription
TRUEevaluated 73 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 15826 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
tmpstate == IntermediateDescription
TRUEevaluated 21 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
used < sn.countDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTimeEdit
1-15826
931 const FieldInfo fi = fieldInfo(index);-
932 if ((fi & (Numeric|FixedWidth)) == (Numeric|FixedWidth)) {
(fi & (Numeric...ic|FixedWidth)Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
3-17
933 const QString newText = QString::fromLatin1("%1").arg(num, sn.count, 10, QLatin1Char('0'));-
934 input.replace(pos, used, newText);-
935 used = sn.count;-
936 }
executed 17 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
17
937 }
executed 20 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
20
938 pos += qMax(0, used);-
939-
940 state = qMin<State>(state, tmpstate);-
941 if (state == Intermediate && context == FromString) {
state == IntermediateDescription
TRUEevaluated 1353 times by 5 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QTime
FALSEevaluated 14546 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
context == FromStringDescription
TRUEevaluated 12 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QFtp
  • tst_QTime
FALSEevaluated 1341 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
12-14546
942 state = Invalid;-
943 break;
executed 12 times by 4 tests: break;
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QFtp
  • tst_QTime
12
944 }-
945-
946 QDTPDEBUG << index << sn.name() << "is set to"
dead code: QMessageLogger(__FILE__, 946, __PRETTY_FUNCTION__).debug() << index << sn.name() << "is set to" << pos << "state is" << stateName(state);
-
947 << pos << "state is" << stateName(state);
dead code: QMessageLogger(__FILE__, 946, __PRETTY_FUNCTION__).debug() << index << sn.name() << "is set to" << pos << "state is" << stateName(state);
-
948-
949-
950 if (state != Invalid) {
state != InvalidDescription
TRUEevaluated 15880 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 7 times by 3 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
7-15880
951 switch (sn.type) {-
952 case Hour24Section: current = &hour; break;
executed 1245 times by 6 tests: break;
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
executed 1245 times by 6 tests: case Hour24Section:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
1245
953 case Hour12Section: current = &hour12; break;
executed 820 times by 5 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
executed 820 times by 5 tests: case Hour12Section:
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
820
954 case MinuteSection: current = &minute; break;
executed 1885 times by 8 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
executed 1885 times by 8 tests: case MinuteSection:
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
1885
955 case SecondSection: current = &second; break;
executed 1703 times by 4 tests: break;
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkReply
  • tst_QNetworkRequest
executed 1703 times by 4 tests: case SecondSection:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkReply
  • tst_QNetworkRequest
1703
956 case MSecSection: current = &msec; break;
executed 219 times by 2 tests: break;
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
executed 219 times by 2 tests: case MSecSection:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
219
957 case YearSection: current = &year; break;
executed 1932 times by 6 tests: break;
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
executed 1932 times by 6 tests: case YearSection:
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
1932
958 case YearSection2Digits: current = &year2digits; break;
executed 879 times by 7 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
executed 879 times by 7 tests: case YearSection2Digits:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
879
959 case MonthSection: current = &month; break;
executed 3192 times by 10 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
executed 3192 times by 10 tests: case MonthSection:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
3192
960 case DayOfWeekSectionShort:
executed 40 times by 3 tests: case DayOfWeekSectionShort:
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
40
961 case DayOfWeekSectionLong: current = &dayofweek; break;
executed 464 times by 3 tests: break;
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
executed 424 times by 3 tests: case DayOfWeekSectionLong:
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
424-464
962 case DaySection: current = &day; num = qMax<int>(1, num); break;
executed 2680 times by 10 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
executed 2680 times by 10 tests: case DaySection:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
2680
963 case AmPmSection: current = &ampm; break;
executed 861 times by 5 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
executed 861 times by 5 tests: case AmPmSection:
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
861
964 default:
never executed: default:
0
965 qWarning("QDateTimeParser::parse Internal error (%s)",-
966 qPrintable(sn.name()));-
967 break;
never executed: break;
0
968 }-
969 if (!current) {
!currentDescription
TRUEnever evaluated
FALSEevaluated 15880 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
0-15880
970 qWarning("QDateTimeParser::parse Internal error 2");-
971 return StateNode();
never executed: return StateNode();
0
972 }-
973 if (isSet & sn.type && *current != num) {
*current != numDescription
TRUEevaluated 101 times by 3 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
FALSEevaluated 416 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
101-416
974 QDTPDEBUG << "CONFLICT " << sn.name() << *current << num;
dead code: QMessageLogger(__FILE__, 974, __PRETTY_FUNCTION__).debug() << "CONFLICT " << sn.name() << *current << num;
-
975 conflicts = true;-
976 if (index != currentSectionIndex || num == -1) {
index != currentSectionIndexDescription
TRUEevaluated 96 times by 3 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
num == -1Description
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
0-96
977 continue;
executed 96 times by 3 tests: continue;
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
96
978 }-
979 }
executed 5 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
5
980 if (num != -1)
num != -1Description
TRUEevaluated 15779 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
5-15779
981 *current = num;
executed 15779 times by 11 tests: *current = num;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
15779
982 isSet |= sn.type;-
983 }
executed 15784 times by 11 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
15784
984 }
executed 15791 times by 11 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
15791
985-
986 if (state != Invalid && QStringRef(&input, pos, input.size() - pos) != separators.last()) {
state != InvalidDescription
TRUEevaluated 4616 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 19 times by 5 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QTime
QStringRef(&in...arators.last()Description
TRUEevaluated 15 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
FALSEevaluated 4601 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
15-4616
987 QDTPDEBUG << "invalid because" << input.midRef(pos)
dead code: QMessageLogger(__FILE__, 987, __PRETTY_FUNCTION__).debug() << "invalid because" << input.midRef(pos) << "!=" << separators.last() << pos;
-
988 << "!=" << separators.last() << pos;
dead code: QMessageLogger(__FILE__, 987, __PRETTY_FUNCTION__).debug() << "invalid because" << input.midRef(pos) << "!=" << separators.last() << pos;
-
989 state = Invalid;-
990 }
executed 15 times by 4 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
15
991-
992 if (state != Invalid) {
state != InvalidDescription
TRUEevaluated 4601 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 34 times by 5 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QTime
34-4601
993 if (parserType != QVariant::Time) {
parserType != QVariant::TimeDescription
TRUEevaluated 4578 times by 10 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
FALSEevaluated 23 times by 3 tests
Evaluated by:
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
23-4578
994 if (year % 100 != year2digits && (isSet & YearSection2Digits)) {
year % 100 != year2digitsDescription
TRUEevaluated 359 times by 7 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
FALSEevaluated 4219 times by 7 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
359-4219
995 if (!(isSet & YearSection)) {
!(isSet & YearSection)Description
TRUEevaluated 16 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkRequest
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTime
1-16
996 year = (year / 100) * 100;-
997 year += year2digits;-
998 } else {
executed 16 times by 4 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkRequest
16
999 conflicts = true;-
1000 const SectionNode &sn = sectionNode(currentSectionIndex);-
1001 if (sn.type == YearSection2Digits) {
sn.type == YearSection2DigitsDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTime
0-1
1002 year = (year / 100) * 100;-
1003 year += year2digits;-
1004 }
never executed: end of block
0
1005 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QDateTime
1
1006 }-
1007-
1008 const QDate date(year, month, day);-
1009 const int diff = dayofweek - date.dayOfWeek();-
1010 if (diff != 0 && state == Acceptable && isSet & DayOfWeekSectionMask) {
diff != 0Description
TRUEevaluated 524 times by 7 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
FALSEevaluated 4054 times by 8 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QStyleSheetStyle
state == AcceptableDescription
TRUEevaluated 315 times by 7 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
FALSEevaluated 209 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
209-4054
1011 if (isSet & DaySection)
isSet & DaySectionDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
2-26
1012 conflicts = true;
executed 2 times by 1 test: conflicts = true;
Executed by:
  • tst_QDateTimeEdit
2
1013 const SectionNode &sn = sectionNode(currentSectionIndex);-
1014 if (sn.type & DayOfWeekSectionMask || currentSectionIndex == -1) {
sn.type & DayOfWeekSectionMaskDescription
TRUEnever evaluated
FALSEevaluated 28 times by 3 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
currentSectionIndex == -1Description
TRUEevaluated 14 times by 2 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
0-28
1015 // dayofweek should be preferred-
1016 day += diff;-
1017 if (day <= 0) {
day <= 0Description
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QDate
6-8
1018 day += 7;-
1019 } else if (day > date.daysInMonth()) {
executed 8 times by 2 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTime
day > date.daysInMonth()Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QDate
0-8
1020 day -= 7;-
1021 }
never executed: end of block
0
1022 QDTPDEBUG << year << month << day << dayofweek
dead code: QMessageLogger(__FILE__, 1022, __PRETTY_FUNCTION__).debug() << year << month << day << dayofweek << diff << QDate(year, month, day).dayOfWeek();
-
1023 << diff << QDate(year, month, day).dayOfWeek();
dead code: QMessageLogger(__FILE__, 1022, __PRETTY_FUNCTION__).debug() << year << month << day << dayofweek << diff << QDate(year, month, day).dayOfWeek();
-
1024 }
executed 14 times by 2 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTime
14
1025 }
executed 28 times by 3 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
28
1026-
1027 bool needfixday = false;-
1028 if (sectionType(currentSectionIndex) & DaySectionMask) {
sectionType(cu...DaySectionMaskDescription
TRUEevaluated 1257 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 3321 times by 10 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
1257-3321
1029 cachedDay = day;-
1030 } else if (cachedDay > day) {
executed 1257 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
cachedDay > dayDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 3309 times by 10 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
12-3309
1031 day = cachedDay;-
1032 needfixday = true;-
1033 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
12
1034-
1035 if (!QDate::isValid(year, month, day)) {
!QDate::isVali...r, month, day)Description
TRUEevaluated 88 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
FALSEevaluated 4490 times by 10 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
88-4490
1036 if (day < 32) {
day < 32Description
TRUEevaluated 88 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
FALSEnever evaluated
0-88
1037 cachedDay = day;-
1038 }
executed 88 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
88
1039 if (day > 28 && QDate::isValid(year, month, 1)) {
day > 28Description
TRUEevaluated 51 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
FALSEevaluated 37 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
QDate::isValid(year, month, 1)Description
TRUEevaluated 51 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
FALSEnever evaluated
0-51
1040 needfixday = true;-
1041 }
executed 51 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
51
1042 }
executed 88 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
88
1043 if (needfixday) {
needfixdayDescription
TRUEevaluated 51 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
FALSEevaluated 4527 times by 10 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
51-4527
1044 if (context == FromString) {
context == FromStringDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTime
FALSEevaluated 50 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
1-50
1045 state = Invalid;-
1046 goto end;
executed 1 time by 1 test: goto end;
Executed by:
  • tst_QDateTime
1
1047 }-
1048 if (state == Acceptable && fixday) {
state == AcceptableDescription
TRUEevaluated 50 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEnever evaluated
fixdayDescription
TRUEevaluated 50 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEnever evaluated
0-50
1049 day = qMin<int>(day, QDate(year, month, 1).daysInMonth());-
1050-
1051 const QLocale loc = locale();-
1052 for (int i=0; i<sectionNodesCount; ++i) {
i<sectionNodesCountDescription
TRUEevaluated 149 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 50 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
50-149
1053 const SectionNode sn = sectionNode(i);-
1054 if (sn.type & DaySection) {
sn.type & DaySectionDescription
TRUEevaluated 38 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 111 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
38-111
1055 input.replace(sectionPos(sn), sectionSize(i), loc.toString(day));-
1056 } else if (sn.type & DayOfWeekSectionMask) {
executed 38 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
sn.type & DayOfWeekSectionMaskDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 97 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
14-97
1057 const int dayOfWeek = QDate(year, month, day).dayOfWeek();-
1058 const QLocale::FormatType dayFormat =-
1059 (sn.type == DayOfWeekSectionShort
sn.type == Day...ekSectionShortDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 13 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
1-13
1060 ? QLocale::ShortFormat : QLocale::LongFormat);-
1061 const QString dayName(loc.dayName(dayOfWeek, dayFormat));-
1062 input.replace(sectionPos(sn), sectionSize(i), dayName);-
1063 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
14
1064 }
executed 149 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
149
1065 } else {
executed 50 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
50
1066 state = qMin(Intermediate, state);-
1067 }
never executed: end of block
0
1068 }-
1069 }
executed 4577 times by 10 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
4577
1070-
1071 if (parserType != QVariant::Date) {
parserType != QVariant::DateDescription
TRUEevaluated 3681 times by 9 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
FALSEevaluated 919 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
919-3681
1072 if (isSet & Hour12Section) {
isSet & Hour12SectionDescription
TRUEevaluated 808 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
FALSEevaluated 2873 times by 7 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
808-2873
1073 const bool hasHour = isSet & Hour24Section;-
1074 if (ampm == -1) {
ampm == -1Description
TRUEnever evaluated
FALSEevaluated 808 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
0-808
1075 if (hasHour) {
hasHourDescription
TRUEnever evaluated
FALSEnever evaluated
0
1076 ampm = (hour < 12 ? 0 : 1);
hour < 12Description
TRUEnever evaluated
FALSEnever evaluated
0
1077 } else {
never executed: end of block
0
1078 ampm = 0; // no way to tell if this is am or pm so I assume am-
1079 }
never executed: end of block
0
1080 }-
1081 hour12 = (ampm == 0 ? hour12 % 12 : (hour12 % 12) + 12);
ampm == 0Description
TRUEevaluated 730 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
FALSEevaluated 78 times by 2 tests
Evaluated by:
  • tst_QDateTimeEdit
  • tst_QTime
78-730
1082 if (!hasHour) {
!hasHourDescription
TRUEevaluated 806 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
2-806
1083 hour = hour12;-
1084 } else if (hour != hour12) {
executed 806 times by 5 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
hour != hour12Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
0-806
1085 conflicts = true;-
1086 }
never executed: end of block
0
1087 } else if (ampm != -1) {
executed 808 times by 5 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
ampm != -1Description
TRUEevaluated 51 times by 3 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
FALSEevaluated 2822 times by 7 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
51-2822
1088 if (!(isSet & (Hour24Section))) {
!(isSet & (Hour24Section))Description
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
FALSEevaluated 48 times by 2 tests
Evaluated by:
  • tst_QDateTimeEdit
  • tst_QTime
3-48
1089 hour = (12 * ampm); // special case. Only ap section-
1090 } else if ((ampm == 0) != (hour < 12)) {
executed 3 times by 2 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
(ampm == 0) != (hour < 12)Description
TRUEnever evaluated
FALSEevaluated 48 times by 2 tests
Evaluated by:
  • tst_QDateTimeEdit
  • tst_QTime
0-48
1091 conflicts = true;-
1092 }
never executed: end of block
0
1093 }
executed 51 times by 3 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
51
1094-
1095 }
executed 3681 times by 9 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
3681
1096-
1097 newCurrentValue = QDateTime(QDate(year, month, day), QTime(hour, minute, second, msec), spec);-
1098 QDTPDEBUG << year << month << day << hour << minute << second << msec;
dead code: QMessageLogger(__FILE__, 1098, __PRETTY_FUNCTION__).debug() << year << month << day << hour << minute << second << msec;
-
1099 }
executed 4600 times by 11 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
4600
1100 QDTPDEBUGN("'%s' => '%s'(%s)", input.toLatin1().constData(),
dead code: QMessageLogger(__FILE__, 1100, __PRETTY_FUNCTION__).debug("'%s' => '%s'(%s)", input.toLatin1().constData(), newCurrentValue.toString(QLatin1String("yyyy/MM/dd hh:mm:ss.zzz")).toLatin1().constData(), stateName(state).toLatin1().constData());
-
1101 newCurrentValue.toString(QLatin1String("yyyy/MM/dd hh:mm:ss.zzz")).toLatin1().constData(),
dead code: QMessageLogger(__FILE__, 1100, __PRETTY_FUNCTION__).debug("'%s' => '%s'(%s)", input.toLatin1().constData(), newCurrentValue.toString(QLatin1String("yyyy/MM/dd hh:mm:ss.zzz")).toLatin1().constData(), stateName(state).toLatin1().constData());
-
1102 stateName(state).toLatin1().constData());
dead code: QMessageLogger(__FILE__, 1100, __PRETTY_FUNCTION__).debug("'%s' => '%s'(%s)", input.toLatin1().constData(), newCurrentValue.toString(QLatin1String("yyyy/MM/dd hh:mm:ss.zzz")).toLatin1().constData(), stateName(state).toLatin1().constData());
-
1103 }-
1104end:
code before this statement executed 4634 times by 11 tests: end:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
4634
1105 if (newCurrentValue.isValid()) {
newCurrentValue.isValid()Description
TRUEevaluated 4563 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 194 times by 5 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QTime
194-4563
1106 if (context != FromString && state != Invalid && newCurrentValue < minimum) {
context != FromStringDescription
TRUEevaluated 4098 times by 4 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
FALSEevaluated 465 times by 8 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
state != InvalidDescription
TRUEevaluated 4098 times by 4 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
FALSEnever evaluated
newCurrentValue < minimumDescription
TRUEevaluated 53 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 4045 times by 4 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
0-4098
1107 const QLatin1Char space(' ');-
1108 if (newCurrentValue >= minimum)
newCurrentValue >= minimumDescription
TRUEnever evaluated
FALSEevaluated 53 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
0-53
1109 qWarning("QDateTimeParser::parse Internal error 3 (%s %s)",
never executed: QMessageLogger(__FILE__, 1109, __PRETTY_FUNCTION__).warning("QDateTimeParser::parse Internal error 3 (%s %s)", QString(newCurrentValue.toString()).toLocal8Bit().constData(), QString(minimum.toString()).toLocal8Bit().constData());
0
1110 qPrintable(newCurrentValue.toString()), qPrintable(minimum.toString()));
never executed: QMessageLogger(__FILE__, 1109, __PRETTY_FUNCTION__).warning("QDateTimeParser::parse Internal error 3 (%s %s)", QString(newCurrentValue.toString()).toLocal8Bit().constData(), QString(minimum.toString()).toLocal8Bit().constData());
0
1111-
1112 bool done = false;-
1113 state = Invalid;-
1114 for (int i=0; i<sectionNodesCount && !done; ++i) {
i<sectionNodesCountDescription
TRUEevaluated 138 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
!doneDescription
TRUEevaluated 129 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
9-138
1115 const SectionNode &sn = sectionNodes.at(i);-
1116 QString t = sectionText(input, i, sn.pos).toLower();-
1117 if ((t.size() < sectionMaxSize(i) && (((int)fieldInfo(i) & (FixedWidth|Numeric)) != Numeric))
t.size() < sectionMaxSize(i)Description
TRUEevaluated 55 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 74 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
(((int)fieldIn...)) != Numeric)Description
TRUEevaluated 55 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEnever evaluated
0-74
1118 || t.contains(space)) {
t.contains(space)Description
TRUEnever evaluated
FALSEevaluated 74 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
0-74
1119 switch (sn.type) {-
1120 case AmPmSection:
never executed: case AmPmSection:
0
1121 switch (findAmPm(t, i)) {-
1122 case AM:
never executed: case AM:
0
1123 case PM:
never executed: case PM:
0
1124 state = Acceptable;-
1125 done = true;-
1126 break;
never executed: break;
0
1127 case Neither:
never executed: case Neither:
0
1128 state = Invalid;-
1129 done = true;-
1130 break;
never executed: break;
0
1131 case PossibleAM:
never executed: case PossibleAM:
0
1132 case PossiblePM:
never executed: case PossiblePM:
0
1133 case PossibleBoth: {
never executed: case PossibleBoth:
0
1134 const QDateTime copy(newCurrentValue.addSecs(12 * 60 * 60));-
1135 if (copy >= minimum && copy <= maximum) {
copy >= minimumDescription
TRUEnever evaluated
FALSEnever evaluated
copy <= maximumDescription
TRUEnever evaluated
FALSEnever evaluated
0
1136 state = Intermediate;-
1137 done = true;-
1138 }
never executed: end of block
0
1139 break; }
never executed: break;
0
1140 }-
1141 case MonthSection:
code before this statement never executed: case MonthSection:
executed 3 times by 1 test: case MonthSection:
Executed by:
  • tst_QDateTimeEdit
0-3
1142 if (sn.count >= 3) {
sn.count >= 3Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEnever evaluated
0-3
1143 const int currentMonth = newCurrentValue.date().month();-
1144 int tmp = currentMonth;-
1145 // I know the first possible month makes the date too early-
1146 while ((tmp = findMonth(t, tmp + 1, i)) != -1) {
(tmp = findMon...+ 1, i)) != -1Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
3-6
1147 const QDateTime copy(newCurrentValue.addMonths(tmp - currentMonth));-
1148 if (copy >= minimum && copy <= maximum)
copy >= minimumDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
copy <= maximumDescription
TRUEnever evaluated
FALSEnever evaluated
0-6
1149 break; // break out of while
never executed: break;
0
1150 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
6
1151 if (tmp == -1) {
tmp == -1Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEnever evaluated
0-3
1152 break;
executed 3 times by 1 test: break;
Executed by:
  • tst_QDateTimeEdit
3
1153 }-
1154 state = Intermediate;-
1155 done = true;-
1156 break;
never executed: break;
0
1157 }-
1158 // fallthrough-
1159 default: {
code before this statement never executed: default:
executed 52 times by 1 test: default:
Executed by:
  • tst_QDateTimeEdit
0-52
1160 int toMin;-
1161 int toMax;-
1162-
1163 if (sn.type & TimeSectionMask) {
sn.type & TimeSectionMaskDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
20-32
1164 if (newCurrentValue.daysTo(minimum) != 0) {
newCurrentValu...(minimum) != 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
0-20
1165 break;
never executed: break;
0
1166 }-
1167 const QTime time = newCurrentValue.time();-
1168 toMin = time.msecsTo(minimum.time());-
1169 if (newCurrentValue.daysTo(maximum) > 0) {
newCurrentValu...o(maximum) > 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
0-20
1170 toMax = -1; // can't get to max-
1171 } else {
never executed: end of block
0
1172 toMax = time.msecsTo(maximum.time());-
1173 }
executed 20 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
20
1174 } else {-
1175 toMin = newCurrentValue.daysTo(minimum);-
1176 toMax = newCurrentValue.daysTo(maximum);-
1177 }
executed 32 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
32
1178 const int maxChange = sn.maxChange();-
1179 if (toMin > maxChange) {
toMin > maxChangeDescription
TRUEnever evaluated
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
0-52
1180 QDTPDEBUG << "invalid because toMin > maxChange" << toMin
dead code: QMessageLogger(__FILE__, 1180, __PRETTY_FUNCTION__).debug() << "invalid because toMin > maxChange" << toMin << maxChange << t << newCurrentValue << minimum;
-
1181 << maxChange << t << newCurrentValue << minimum;
dead code: QMessageLogger(__FILE__, 1180, __PRETTY_FUNCTION__).debug() << "invalid because toMin > maxChange" << toMin << maxChange << t << newCurrentValue << minimum;
-
1182 state = Invalid;-
1183 done = true;-
1184 break;
never executed: break;
0
1185 } else if (toMax > maxChange) {
toMax > maxChangeDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 38 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
14-38
1186 toMax = -1; // can't get to max-
1187 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
14
1188-
1189 const int min = getDigit(minimum, i);-
1190 if (min == -1) {
min == -1Description
TRUEnever evaluated
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
0-52
1191 qWarning("QDateTimeParser::parse Internal error 4 (%s)",-
1192 qPrintable(sn.name()));-
1193 state = Invalid;-
1194 done = true;-
1195 break;
never executed: break;
0
1196 }-
1197-
1198 int max = toMax != -1 ? getDigit(maximum, i) : absoluteMax(i, newCurrentValue);
toMax != -1Description
TRUEevaluated 38 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
14-38
1199 int pos = cursorPosition - sn.pos;-
1200 if (pos < 0 || pos >= t.size())
pos < 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
pos >= t.size()Description
TRUEevaluated 41 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
4-48
1201 pos = -1;
executed 45 times by 1 test: pos = -1;
Executed by:
  • tst_QDateTimeEdit
45
1202 if (!potentialValue(t.simplified(), min, max, i, newCurrentValue, pos)) {
!potentialValu...entValue, pos)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 50 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
2-50
1203 QDTPDEBUG << "invalid because potentialValue(" << t.simplified() << min << max
dead code: QMessageLogger(__FILE__, 1203, __PRETTY_FUNCTION__).debug() << "invalid because potentialValue(" << t.simplified() << min << max << sn.name() << "returned" << toMax << toMin << pos;
-
1204 << sn.name() << "returned" << toMax << toMin << pos;
dead code: QMessageLogger(__FILE__, 1203, __PRETTY_FUNCTION__).debug() << "invalid because potentialValue(" << t.simplified() << min << max << sn.name() << "returned" << toMax << toMin << pos;
-
1205 state = Invalid;-
1206 done = true;-
1207 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_QDateTimeEdit
2
1208 }-
1209 state = Intermediate;-
1210 done = true;-
1211 break; }
executed 50 times by 1 test: break;
Executed by:
  • tst_QDateTimeEdit
50
1212 }-
1213 }-
1214 }
executed 129 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
129
1215 } else {
executed 53 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
53
1216 if (context == FromString) {
context == FromStringDescription
TRUEevaluated 465 times by 8 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
FALSEevaluated 4045 times by 4 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
465-4045
1217 // optimization-
1218 Q_ASSERT(getMaximum().date().toJulianDay() == 4642999);-
1219 if (newCurrentValue.date().toJulianDay() > 4642999)
newCurrentValu...ay() > 4642999Description
TRUEnever evaluated
FALSEevaluated 465 times by 8 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
0-465
1220 state = Invalid;
never executed: state = Invalid;
0
1221 } else {
executed 465 times by 8 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
465
1222 if (newCurrentValue > getMaximum())
newCurrentValue > getMaximum()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 4044 times by 4 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
1-4044
1223 state = Invalid;
executed 1 time by 1 test: state = Invalid;
Executed by:
  • tst_QDateTimeEdit
1
1224 }
executed 4045 times by 4 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
4045
1225-
1226 QDTPDEBUG << "not checking intermediate because newCurrentValue is" << newCurrentValue << getMinimum() << getMaximum();
dead code: QMessageLogger(__FILE__, 1226, __PRETTY_FUNCTION__).debug() << "not checking intermediate because newCurrentValue is" << newCurrentValue << getMinimum() << getMaximum();
-
1227 }
executed 4510 times by 11 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
4510
1228 }-
1229 StateNode node;-
1230 node.input = input;-
1231 node.state = state;-
1232 node.conflicts = conflicts;-
1233 node.value = newCurrentValue.toTimeSpec(spec);-
1234 text = input;-
1235 return node;
executed 4757 times by 11 tests: return node;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
4757
1236}-
1237#endif // QT_NO_DATESTRING-
1238-
1239#ifndef QT_NO_TEXTDATE-
1240/*!-
1241 \internal-
1242 finds the first possible monthname that \a str1 can-
1243 match. Starting from \a index; str should already by lowered-
1244*/-
1245-
1246int QDateTimeParser::findMonth(const QString &str1, int startMonth, int sectionIndex,-
1247 QString *usedMonth, int *used) const-
1248{-
1249 int bestMatch = -1;-
1250 int bestCount = 0;-
1251 if (!str1.isEmpty()) {
!str1.isEmpty()Description
TRUEevaluated 1471 times by 6 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
FALSEnever evaluated
0-1471
1252 const SectionNode &sn = sectionNode(sectionIndex);-
1253 if (sn.type != MonthSection) {
sn.type != MonthSectionDescription
TRUEnever evaluated
FALSEevaluated 1471 times by 6 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
0-1471
1254 qWarning("QDateTimeParser::findMonth Internal error");-
1255 return -1;
never executed: return -1;
0
1256 }-
1257-
1258 QLocale::FormatType type = sn.count == 3 ? QLocale::ShortFormat : QLocale::LongFormat;
sn.count == 3Description
TRUEevaluated 1270 times by 5 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
FALSEevaluated 201 times by 3 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
201-1270
1259 QLocale l = locale();-
1260-
1261 for (int month=startMonth; month<=12; ++month) {
month<=12Description
TRUEevaluated 6035 times by 6 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
FALSEevaluated 118 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
118-6035
1262 const QString monthName = l.monthName(month, type);-
1263 QString str2 = monthName.toLower();-
1264-
1265 if (str1.startsWith(str2)) {
str1.startsWith(str2)Description
TRUEevaluated 1350 times by 6 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
FALSEevaluated 4685 times by 6 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
1350-4685
1266 if (used) {
usedDescription
TRUEevaluated 1350 times by 6 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
FALSEnever evaluated
0-1350
1267 QDTPDEBUG << "used is set to" << str2.size();
dead code: QMessageLogger(__FILE__, 1267, __PRETTY_FUNCTION__).debug() << "used is set to" << str2.size();
-
1268 *used = str2.size();-
1269 }
executed 1350 times by 6 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
1350
1270 if (usedMonth)
usedMonthDescription
TRUEevaluated 1350 times by 6 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
FALSEnever evaluated
0-1350
1271 *usedMonth = monthName;
executed 1350 times by 6 tests: *usedMonth = monthName;
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
1350
1272-
1273 return month;
executed 1350 times by 6 tests: return month;
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
1350
1274 }-
1275 if (context == FromString)
context == FromStringDescription
TRUEevaluated 3086 times by 5 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
FALSEevaluated 1599 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
1599-3086
1276 continue;
executed 3086 times by 5 tests: continue;
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkRequest
3086
1277-
1278 const int limit = qMin(str1.size(), str2.size());-
1279-
1280 QDTPDEBUG << "limit is" << limit << str1 << str2;
dead code: QMessageLogger(__FILE__, 1280, __PRETTY_FUNCTION__).debug() << "limit is" << limit << str1 << str2;
-
1281 bool equal = true;-
1282 for (int i=0; i<limit; ++i) {
i<limitDescription
TRUEevaluated 2263 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
3-2263
1283 if (str1.at(i) != str2.at(i)) {
str1.at(i) != str2.at(i)Description
TRUEevaluated 1596 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 667 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
667-1596
1284 equal = false;-
1285 if (i > bestCount) {
i > bestCountDescription
TRUEevaluated 177 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 1419 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
177-1419
1286 bestCount = i;-
1287 bestMatch = month;-
1288 }
executed 177 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
177
1289 break;
executed 1596 times by 1 test: break;
Executed by:
  • tst_QDateTimeEdit
1596
1290 }-
1291 }
executed 667 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
667
1292 if (equal) {
equalDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 1596 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
3-1596
1293 if (used)
usedDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEnever evaluated
0-3
1294 *used = limit;
executed 3 times by 1 test: *used = limit;
Executed by:
  • tst_QDateTimeEdit
3
1295 if (usedMonth)
usedMonthDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEnever evaluated
0-3
1296 *usedMonth = monthName;
executed 3 times by 1 test: *usedMonth = monthName;
Executed by:
  • tst_QDateTimeEdit
3
1297 return month;
executed 3 times by 1 test: return month;
Executed by:
  • tst_QDateTimeEdit
3
1298 }-
1299 }
executed 1596 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
1596
1300 if (usedMonth && bestMatch != -1)
usedMonthDescription
TRUEevaluated 109 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
bestMatch != -1Description
TRUEevaluated 104 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
5-109
1301 *usedMonth = l.monthName(bestMatch, type);
executed 104 times by 1 test: *usedMonth = l.monthName(bestMatch, type);
Executed by:
  • tst_QDateTimeEdit
104
1302 }
executed 118 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
118
1303 if (used) {
usedDescription
TRUEevaluated 109 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
9-109
1304 QDTPDEBUG << "used is set to" << bestCount;
dead code: QMessageLogger(__FILE__, 1304, __PRETTY_FUNCTION__).debug() << "used is set to" << bestCount;
-
1305 *used = bestCount;-
1306 }
executed 109 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
109
1307 return bestMatch;
executed 118 times by 1 test: return bestMatch;
Executed by:
  • tst_QDateTimeEdit
118
1308}-
1309-
1310int QDateTimeParser::findDay(const QString &str1, int startDay, int sectionIndex, QString *usedDay, int *used) const-
1311{-
1312 int bestMatch = -1;-
1313 int bestCount = 0;-
1314 if (!str1.isEmpty()) {
!str1.isEmpty()Description
TRUEevaluated 464 times by 3 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
FALSEnever evaluated
0-464
1315 const SectionNode &sn = sectionNode(sectionIndex);-
1316 if (!(sn.type & DaySectionMask)) {
!(sn.type & DaySectionMask)Description
TRUEnever evaluated
FALSEevaluated 464 times by 3 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
0-464
1317 qWarning("QDateTimeParser::findDay Internal error");-
1318 return -1;
never executed: return -1;
0
1319 }-
1320 const QLocale l = locale();-
1321 for (int day=startDay; day<=7; ++day) {
day<=7Description
TRUEevaluated 1838 times by 3 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
FALSEnever evaluated
0-1838
1322 const QString str2 = l.dayName(day, sn.count == 4 ? QLocale::LongFormat : QLocale::ShortFormat);-
1323-
1324 if (str1.startsWith(str2.toLower())) {
str1.startsWit...tr2.toLower())Description
TRUEevaluated 464 times by 3 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
FALSEevaluated 1374 times by 3 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
464-1374
1325 if (used)
usedDescription
TRUEevaluated 464 times by 3 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
FALSEnever evaluated
0-464
1326 *used = str2.size();
executed 464 times by 3 tests: *used = str2.size();
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
464
1327 if (usedDay) {
usedDayDescription
TRUEevaluated 464 times by 3 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
FALSEnever evaluated
0-464
1328 *usedDay = str2;-
1329 }
executed 464 times by 3 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
464
1330 return day;
executed 464 times by 3 tests: return day;
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
464
1331 }-
1332 if (context == FromString)
context == FromStringDescription
TRUEevaluated 53 times by 2 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
FALSEevaluated 1321 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
53-1321
1333 continue;
executed 53 times by 2 tests: continue;
Executed by:
  • tst_QDate
  • tst_QDateTime
53
1334-
1335 const int limit = qMin(str1.size(), str2.size());-
1336 bool found = true;-
1337 for (int i=0; i<limit; ++i) {
i<limitDescription
TRUEevaluated 1321 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEnever evaluated
0-1321
1338 if (str1.at(i) != str2.at(i) && !str1.at(i).isSpace()) {
str1.at(i) != str2.at(i)Description
TRUEevaluated 1321 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEnever evaluated
!str1.at(i).isSpace()Description
TRUEevaluated 1321 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEnever evaluated
0-1321
1339 if (i > bestCount) {
i > bestCountDescription
TRUEnever evaluated
FALSEevaluated 1321 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
0-1321
1340 bestCount = i;-
1341 bestMatch = day;-
1342 }
never executed: end of block
0
1343 found = false;-
1344 break;
executed 1321 times by 1 test: break;
Executed by:
  • tst_QDateTimeEdit
1321
1345 }-
1346-
1347 }
never executed: end of block
0
1348 if (found) {
foundDescription
TRUEnever evaluated
FALSEevaluated 1321 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
0-1321
1349 if (used)
usedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1350 *used = limit;
never executed: *used = limit;
0
1351 if (usedDay)
usedDayDescription
TRUEnever evaluated
FALSEnever evaluated
0
1352 *usedDay = str2;
never executed: *usedDay = str2;
0
1353-
1354 return day;
never executed: return day;
0
1355 }-
1356 }
executed 1321 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
1321
1357 if (usedDay && bestMatch != -1) {
usedDayDescription
TRUEnever evaluated
FALSEnever evaluated
bestMatch != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
1358 *usedDay = l.dayName(bestMatch, sn.count == 4 ? QLocale::LongFormat : QLocale::ShortFormat);-
1359 }
never executed: end of block
0
1360 }
never executed: end of block
0
1361 if (used)
usedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1362 *used = bestCount;
never executed: *used = bestCount;
0
1363-
1364 return bestMatch;
never executed: return bestMatch;
0
1365}-
1366#endif // QT_NO_TEXTDATE-
1367-
1368/*!-
1369 \internal-
1370-
1371 Returns-
1372 AM if str == tr("AM")-
1373 PM if str == tr("PM")-
1374 PossibleAM if str can become tr("AM")-
1375 PossiblePM if str can become tr("PM")-
1376 PossibleBoth if str can become tr("PM") and can become tr("AM")-
1377 Neither if str can't become anything sensible-
1378*/-
1379QDateTimeParser::AmPmFinder QDateTimeParser::findAmPm(QString &str, int sectionIndex, int *used) const-
1380{-
1381 const SectionNode &s = sectionNode(sectionIndex);-
1382 if (s.type != AmPmSection) {
s.type != AmPmSectionDescription
TRUEnever evaluated
FALSEevaluated 863 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
0-863
1383 qWarning("QDateTimeParser::findAmPm Internal error");-
1384 return Neither;
never executed: return Neither;
0
1385 }-
1386 if (used)
usedDescription
TRUEevaluated 863 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
FALSEnever evaluated
0-863
1387 *used = str.size();
executed 863 times by 5 tests: *used = str.size();
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
863
1388 if (QStringRef(&str).trimmed().isEmpty()) {
QStringRef(&st...ed().isEmpty()Description
TRUEnever evaluated
FALSEevaluated 863 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
0-863
1389 return PossibleBoth;
never executed: return PossibleBoth;
0
1390 }-
1391 const QLatin1Char space(' ');-
1392 int size = sectionMaxSize(sectionIndex);-
1393-
1394 enum {-
1395 amindex = 0,-
1396 pmindex = 1-
1397 };-
1398 QString ampm[2];-
1399 ampm[amindex] = getAmPmText(AmText, s.count == 1 ? UpperCase : LowerCase);-
1400 ampm[pmindex] = getAmPmText(PmText, s.count == 1 ? UpperCase : LowerCase);-
1401 for (int i=0; i<2; ++i)
i<2Description
TRUEevaluated 1726 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
FALSEevaluated 863 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
863-1726
1402 ampm[i].truncate(size);
executed 1726 times by 5 tests: ampm[i].truncate(size);
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
1726
1403-
1404 QDTPDEBUG << "findAmPm" << str << ampm[0] << ampm[1];
dead code: QMessageLogger(__FILE__, 1404, __PRETTY_FUNCTION__).debug() << "findAmPm" << str << ampm[0] << ampm[1];
-
1405-
1406 if (str.indexOf(ampm[amindex], 0, Qt::CaseInsensitive) == 0) {
str.indexOf(am...ensitive) == 0Description
TRUEevaluated 758 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
FALSEevaluated 105 times by 3 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
105-758
1407 str = ampm[amindex];-
1408 return AM;
executed 758 times by 5 tests: return AM;
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
758
1409 } else if (str.indexOf(ampm[pmindex], 0, Qt::CaseInsensitive) == 0) {
str.indexOf(am...ensitive) == 0Description
TRUEevaluated 103 times by 3 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
2-103
1410 str = ampm[pmindex];-
1411 return PM;
executed 103 times by 3 tests: return PM;
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
103
1412 } else if (context == FromString || (str.count(space) == 0 && str.size() >= size)) {
context == FromStringDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTime
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTimeEdit
str.count(space) == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEnever evaluated
str.size() >= sizeDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTimeEdit
0-1
1413 return Neither;
executed 1 time by 1 test: return Neither;
Executed by:
  • tst_QDateTime
1
1414 }-
1415 size = qMin(size, str.size());-
1416-
1417 bool broken[2] = {false, false};-
1418 for (int i=0; i<size; ++i) {
i<sizeDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEnever evaluated
0-1
1419 if (str.at(i) != space) {
str.at(i) != spaceDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEnever evaluated
0-1
1420 for (int j=0; j<2; ++j) {
j<2Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEnever evaluated
0-2
1421 if (!broken[j]) {
!broken[j]Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEnever evaluated
0-2
1422 int index = ampm[j].indexOf(str.at(i));-
1423 QDTPDEBUG << "looking for" << str.at(i)
dead code: QMessageLogger(__FILE__, 1423, __PRETTY_FUNCTION__).debug() << "looking for" << str.at(i) << "in" << ampm[j] << "and got" << index;
-
1424 << "in" << ampm[j] << "and got" << index;
dead code: QMessageLogger(__FILE__, 1423, __PRETTY_FUNCTION__).debug() << "looking for" << str.at(i) << "in" << ampm[j] << "and got" << index;
-
1425 if (index == -1) {
index == -1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEnever evaluated
0-2
1426 if (str.at(i).category() == QChar::Letter_Uppercase) {
str.at(i).cate...tter_UppercaseDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
0-2
1427 index = ampm[j].indexOf(str.at(i).toLower());-
1428 QDTPDEBUG << "trying with" << str.at(i).toLower()
dead code: QMessageLogger(__FILE__, 1428, __PRETTY_FUNCTION__).debug() << "trying with" << str.at(i).toLower() << "in" << ampm[j] << "and got" << index;
-
1429 << "in" << ampm[j] << "and got" << index;
dead code: QMessageLogger(__FILE__, 1428, __PRETTY_FUNCTION__).debug() << "trying with" << str.at(i).toLower() << "in" << ampm[j] << "and got" << index;
-
1430 } else if (str.at(i).category() == QChar::Letter_Lowercase) {
never executed: end of block
str.at(i).cate...tter_LowercaseDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
0-2
1431 index = ampm[j].indexOf(str.at(i).toUpper());-
1432 QDTPDEBUG << "trying with" << str.at(i).toUpper()
dead code: QMessageLogger(__FILE__, 1432, __PRETTY_FUNCTION__).debug() << "trying with" << str.at(i).toUpper() << "in" << ampm[j] << "and got" << index;
-
1433 << "in" << ampm[j] << "and got" << index;
dead code: QMessageLogger(__FILE__, 1432, __PRETTY_FUNCTION__).debug() << "trying with" << str.at(i).toUpper() << "in" << ampm[j] << "and got" << index;
-
1434 }
never executed: end of block
0
1435 if (index == -1) {
index == -1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEnever evaluated
0-2
1436 broken[j] = true;-
1437 if (broken[amindex] && broken[pmindex]) {
broken[amindex]Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEnever evaluated
broken[pmindex]Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDateTimeEdit
0-2
1438 QDTPDEBUG << str << "didn't make it";
dead code: QMessageLogger(__FILE__, 1438, __PRETTY_FUNCTION__).debug() << str << "didn't make it";
-
1439 return Neither;
executed 1 time by 1 test: return Neither;
Executed by:
  • tst_QDateTimeEdit
1
1440 }-
1441 continue;
executed 1 time by 1 test: continue;
Executed by:
  • tst_QDateTimeEdit
1
1442 } else {-
1443 str[i] = ampm[j].at(index); // fix case-
1444 }
never executed: end of block
0
1445 }-
1446 ampm[j].remove(index, 1);-
1447 }
never executed: end of block
0
1448 }
never executed: end of block
0
1449 }
never executed: end of block
0
1450 }
never executed: end of block
0
1451 if (!broken[pmindex] && !broken[amindex])
!broken[pmindex]Description
TRUEnever evaluated
FALSEnever evaluated
!broken[amindex]Description
TRUEnever evaluated
FALSEnever evaluated
0
1452 return PossibleBoth;
never executed: return PossibleBoth;
0
1453 return (!broken[amindex] ? PossibleAM : PossiblePM);
never executed: return (!broken[amindex] ? PossibleAM : PossiblePM);
0
1454}-
1455-
1456/*!-
1457 \internal-
1458 Max number of units that can be changed by this section.-
1459*/-
1460-
1461int QDateTimeParser::SectionNode::maxChange() const-
1462{-
1463 switch (type) {-
1464 // Time. unit is msec-
1465 case MSecSection: return 999;
never executed: return 999;
never executed: case MSecSection:
0
1466 case SecondSection: return 59 * 1000;
never executed: return 59 * 1000;
never executed: case SecondSection:
0
1467 case MinuteSection: return 59 * 60 * 1000;
executed 11 times by 1 test: return 59 * 60 * 1000;
Executed by:
  • tst_QDateTimeEdit
executed 11 times by 1 test: case MinuteSection:
Executed by:
  • tst_QDateTimeEdit
11
1468 case Hour24Section: case Hour12Section: return 59 * 60 * 60 * 1000;
executed 9 times by 1 test: return 59 * 60 * 60 * 1000;
Executed by:
  • tst_QDateTimeEdit
executed 9 times by 1 test: case Hour24Section:
Executed by:
  • tst_QDateTimeEdit
never executed: case Hour12Section:
0-9
1469-
1470 // Date. unit is day-
1471 case DayOfWeekSectionShort:
never executed: case DayOfWeekSectionShort:
0
1472 case DayOfWeekSectionLong: return 7;
never executed: return 7;
never executed: case DayOfWeekSectionLong:
0
1473 case DaySection: return 30;
never executed: return 30;
never executed: case DaySection:
0
1474 case MonthSection: return 365 - 31;
never executed: return 365 - 31;
never executed: case MonthSection:
0
1475 case YearSection: return 9999 * 365;
executed 29 times by 1 test: return 9999 * 365;
Executed by:
  • tst_QDateTimeEdit
executed 29 times by 1 test: case YearSection:
Executed by:
  • tst_QDateTimeEdit
29
1476 case YearSection2Digits: return 100 * 365;
executed 3 times by 1 test: return 100 * 365;
Executed by:
  • tst_QDateTimeEdit
executed 3 times by 1 test: case YearSection2Digits:
Executed by:
  • tst_QDateTimeEdit
3
1477 default:
never executed: default:
0
1478 qWarning("QDateTimeParser::maxChange() Internal error (%s)",-
1479 qPrintable(name()));-
1480 }
never executed: end of block
0
1481-
1482 return -1;
never executed: return -1;
0
1483}-
1484-
1485QDateTimeParser::FieldInfo QDateTimeParser::fieldInfo(int index) const-
1486{-
1487 FieldInfo ret = 0;-
1488 const SectionNode &sn = sectionNode(index);-
1489 switch (sn.type) {-
1490 case MSecSection:
executed 221 times by 2 tests: case MSecSection:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
221
1491 ret |= Fraction;-
1492 // fallthrough-
1493 case SecondSection:
code before this statement executed 221 times by 2 tests: case SecondSection:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
executed 1712 times by 4 tests: case SecondSection:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QNetworkReply
  • tst_QNetworkRequest
221-1712
1494 case MinuteSection:
executed 1922 times by 8 tests: case MinuteSection:
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
1922
1495 case Hour24Section:
executed 1269 times by 6 tests: case Hour24Section:
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
1269
1496 case Hour12Section:
executed 831 times by 5 tests: case Hour12Section:
Executed by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
831
1497 case YearSection:
executed 1951 times by 6 tests: case YearSection:
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
1951
1498 case YearSection2Digits:
executed 883 times by 7 tests: case YearSection2Digits:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
883
1499 ret |= Numeric;-
1500 if (sn.type != YearSection) {
sn.type != YearSectionDescription
TRUEevaluated 6838 times by 10 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 1951 times by 6 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
1951-6838
1501 ret |= AllowPartial;-
1502 }
executed 6838 times by 10 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
6838
1503 if (sn.count != 1) {
sn.count != 1Description
TRUEevaluated 8471 times by 11 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
FALSEevaluated 318 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QTime
318-8471
1504 ret |= FixedWidth;-
1505 }
executed 8471 times by 11 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
8471
1506 break;
executed 8789 times by 11 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
8789
1507 case MonthSection:
executed 1780 times by 7 tests: case MonthSection:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QItemDelegate
  • tst_QNetworkReply
  • tst_QStyleSheetStyle
1780
1508 case DaySection:
executed 2734 times by 10 tests: case DaySection:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
2734
1509 switch (sn.count) {-
1510 case 2:
executed 3502 times by 7 tests: case 2:
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
3502
1511 ret |= FixedWidth;-
1512 // fallthrough-
1513 case 1:
code before this statement executed 3502 times by 7 tests: case 1:
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
executed 992 times by 7 tests: case 1:
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QStyleSheetStyle
992-3502
1514 ret |= (Numeric|AllowPartial);-
1515 break;
executed 4494 times by 10 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
4494
1516 }-
1517 break;
executed 4514 times by 10 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
4514
1518 case DayOfWeekSectionShort:
never executed: case DayOfWeekSectionShort:
0
1519 case DayOfWeekSectionLong:
never executed: case DayOfWeekSectionLong:
0
1520 if (sn.count == 3)
sn.count == 3Description
TRUEnever evaluated
FALSEnever evaluated
0
1521 ret |= FixedWidth;
never executed: ret |= FixedWidth;
0
1522 break;
never executed: break;
0
1523 case AmPmSection:
never executed: case AmPmSection:
0
1524 ret |= FixedWidth;-
1525 break;
never executed: break;
0
1526 default:
never executed: default:
0
1527 qWarning("QDateTimeParser::fieldInfo Internal error 2 (%d %s %d)",-
1528 index, qPrintable(sn.name()), sn.count);-
1529 break;
never executed: break;
0
1530 }-
1531 return ret;
executed 13303 times by 11 tests: return ret;
Executed by:
  • tst_QAccessibility
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QItemDelegate
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QStyleSheetStyle
  • tst_QTime
13303
1532}-
1533-
1534QString QDateTimeParser::SectionNode::format() const-
1535{-
1536 QChar fillChar;-
1537 switch (type) {-
1538 case AmPmSection: return count == 1 ? QLatin1String("AP") : QLatin1String("ap");
never executed: return count == 1 ? QLatin1String("AP") : QLatin1String("ap");
never executed: case AmPmSection:
0
1539 case MSecSection: fillChar = QLatin1Char('z'); break;
never executed: break;
never executed: case MSecSection:
0
1540 case SecondSection: fillChar = QLatin1Char('s'); break;
never executed: break;
never executed: case SecondSection:
0
1541 case MinuteSection: fillChar = QLatin1Char('m'); break;
never executed: break;
never executed: case MinuteSection:
0
1542 case Hour24Section: fillChar = QLatin1Char('H'); break;
never executed: break;
never executed: case Hour24Section:
0
1543 case Hour12Section: fillChar = QLatin1Char('h'); break;
never executed: break;
never executed: case Hour12Section:
0
1544 case DayOfWeekSectionShort:
never executed: case DayOfWeekSectionShort:
0
1545 case DayOfWeekSectionLong:
never executed: case DayOfWeekSectionLong:
0
1546 case DaySection: fillChar = QLatin1Char('d'); break;
executed 2 times by 1 test: break;
Executed by:
  • tst_QDateTimeEdit
executed 2 times by 1 test: case DaySection:
Executed by:
  • tst_QDateTimeEdit
2
1547 case MonthSection: fillChar = QLatin1Char('M'); break;
executed 2 times by 1 test: break;
Executed by:
  • tst_QDateTimeEdit
executed 2 times by 1 test: case MonthSection:
Executed by:
  • tst_QDateTimeEdit
2
1548 case YearSection2Digits:
never executed: case YearSection2Digits:
0
1549 case YearSection: fillChar = QLatin1Char('y'); break;
executed 2 times by 1 test: break;
Executed by:
  • tst_QDateTimeEdit
executed 2 times by 1 test: case YearSection:
Executed by:
  • tst_QDateTimeEdit
2
1550 default:
never executed: default:
0
1551 qWarning("QDateTimeParser::sectionFormat Internal error (%s)",-
1552 qPrintable(name(type)));-
1553 return QString();
never executed: return QString();
0
1554 }-
1555 if (fillChar.isNull()) {
fillChar.isNull()Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
0-6
1556 qWarning("QDateTimeParser::sectionFormat Internal error 2");-
1557 return QString();
never executed: return QString();
0
1558 }-
1559 return QString(count, fillChar);
executed 6 times by 1 test: return QString(count, fillChar);
Executed by:
  • tst_QDateTimeEdit
6
1560}-
1561-
1562-
1563/*!-
1564 \internal-
1565-
1566 Returns \c true if str can be modified to represent a-
1567 number that is within min and max.-
1568*/-
1569-
1570bool QDateTimeParser::potentialValue(const QStringRef &str, int min, int max, int index,-
1571 const QDateTime &currentValue, int insert) const-
1572{-
1573 if (str.isEmpty()) {
str.isEmpty()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 1610 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
3-1610
1574 return true;
executed 3 times by 1 test: return true;
Executed by:
  • tst_QDateTimeEdit
3
1575 }-
1576 const int size = sectionMaxSize(index);-
1577 int val = (int)locale().toUInt(str);-
1578 const SectionNode &sn = sectionNode(index);-
1579 if (sn.type == YearSection2Digits) {
sn.type == YearSection2DigitsDescription
TRUEevaluated 20 times by 2 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTimeEdit
FALSEevaluated 1590 times by 3 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
20-1590
1580 const int year = currentValue.date().year();-
1581 val += year - (year % 100);-
1582 }
executed 20 times by 2 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTimeEdit
20
1583 if (val >= min && val <= max && str.size() == size) {
val >= minDescription
TRUEevaluated 1409 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
FALSEevaluated 201 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
val <= maxDescription
TRUEevaluated 999 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
FALSEevaluated 410 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
str.size() == sizeDescription
TRUEevaluated 495 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
FALSEevaluated 504 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
201-1409
1584 return true;
executed 495 times by 4 tests: return true;
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
495
1585 } else if (val > max) {
val > maxDescription
TRUEevaluated 410 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 705 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
410-705
1586 return false;
executed 410 times by 1 test: return false;
Executed by:
  • tst_QDateTimeEdit
410
1587 } else if (str.size() == size && val < min) {
str.size() == sizeDescription
TRUEevaluated 115 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 590 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
val < minDescription
TRUEevaluated 115 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEnever evaluated
0-590
1588 return false;
executed 115 times by 1 test: return false;
Executed by:
  • tst_QDateTimeEdit
115
1589 }-
1590-
1591 const int len = size - str.size();-
1592 for (int i=0; i<len; ++i) {
i<lenDescription
TRUEevaluated 590 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
FALSEevaluated 45 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
45-590
1593 for (int j=0; j<10; ++j) {
j<10Description
TRUEevaluated 1061 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
FALSEevaluated 45 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
45-1061
1594 if (potentialValue(str + QLatin1Char('0' + j), min, max, index, currentValue, insert)) {
potentialValue...Value, insert)Description
TRUEevaluated 542 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
FALSEevaluated 519 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
519-542
1595 return true;
executed 542 times by 4 tests: return true;
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
542
1596 } else if (insert >= 0) {
insert >= 0Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 510 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
9-510
1597 const QString tmp = str.left(insert) + QLatin1Char('0' + j) + str.mid(insert);-
1598 if (potentialValue(tmp, min, max, index, currentValue, insert))
potentialValue...Value, insert)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
3-6
1599 return true;
executed 3 times by 1 test: return true;
Executed by:
  • tst_QDateTimeEdit
3
1600 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
6
1601 }
executed 516 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
516
1602 }
executed 45 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
45
1603-
1604 return false;
executed 45 times by 1 test: return false;
Executed by:
  • tst_QDateTimeEdit
45
1605}-
1606-
1607bool QDateTimeParser::skipToNextSection(int index, const QDateTime &current, const QStringRef &text) const-
1608{-
1609 Q_ASSERT(current >= getMinimum() && current <= getMaximum());-
1610-
1611 const SectionNode &node = sectionNode(index);-
1612 Q_ASSERT(text.size() < sectionMaxSize(index));-
1613-
1614 const QDateTime maximum = getMaximum();-
1615 const QDateTime minimum = getMinimum();-
1616 QDateTime tmp = current;-
1617 int min = absoluteMin(index);-
1618 setDigit(tmp, index, min);-
1619 if (tmp < minimum) {
tmp < minimumDescription
TRUEevaluated 17 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 474 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
17-474
1620 min = getDigit(minimum, index);-
1621 }
executed 17 times by 1 test: end of block
Executed by:
  • tst_QDateTimeEdit
17
1622-
1623 int max = absoluteMax(index, current);-
1624 setDigit(tmp, index, max);-
1625 if (tmp > maximum) {
tmp > maximumDescription
TRUEevaluated 33 times by 2 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTimeEdit
FALSEevaluated 458 times by 3 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
33-458
1626 max = getDigit(maximum, index);-
1627 }
executed 33 times by 2 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTimeEdit
33
1628 int pos = cursorPosition() - node.pos;-
1629 if (pos < 0 || pos >= text.size())
pos < 0Description
TRUEevaluated 12 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
FALSEevaluated 479 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
pos >= text.size()Description
TRUEevaluated 472 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QDateTimeEdit
7-479
1630 pos = -1;
executed 484 times by 4 tests: pos = -1;
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
484
1631-
1632 const bool potential = potentialValue(text, min, max, index, current, pos);-
1633 return !potential;
executed 491 times by 4 tests: return !potential;
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QTime
491
1634-
1635 /* If the value potentially can become another valid entry we-
1636 * don't want to skip to the next. E.g. In a M field (month-
1637 * without leading 0 if you type 1 we don't want to autoskip but-
1638 * if you type 3 we do-
1639 */-
1640}-
1641-
1642/*!-
1643 \internal-
1644 For debugging. Returns the name of the section \a s.-
1645*/-
1646-
1647QString QDateTimeParser::SectionNode::name(QDateTimeParser::Section s)-
1648{-
1649 switch (s) {-
1650 case QDateTimeParser::AmPmSection: return QLatin1String("AmPmSection");
never executed: return QLatin1String("AmPmSection");
never executed: case QDateTimeParser::AmPmSection:
0
1651 case QDateTimeParser::DaySection: return QLatin1String("DaySection");
never executed: return QLatin1String("DaySection");
never executed: case QDateTimeParser::DaySection:
0
1652 case QDateTimeParser::DayOfWeekSectionShort: return QLatin1String("DayOfWeekSectionShort");
never executed: return QLatin1String("DayOfWeekSectionShort");
never executed: case QDateTimeParser::DayOfWeekSectionShort:
0
1653 case QDateTimeParser::DayOfWeekSectionLong: return QLatin1String("DayOfWeekSectionLong");
never executed: return QLatin1String("DayOfWeekSectionLong");
never executed: case QDateTimeParser::DayOfWeekSectionLong:
0
1654 case QDateTimeParser::Hour24Section: return QLatin1String("Hour24Section");
never executed: return QLatin1String("Hour24Section");
never executed: case QDateTimeParser::Hour24Section:
0
1655 case QDateTimeParser::Hour12Section: return QLatin1String("Hour12Section");
never executed: return QLatin1String("Hour12Section");
never executed: case QDateTimeParser::Hour12Section:
0
1656 case QDateTimeParser::MSecSection: return QLatin1String("MSecSection");
never executed: return QLatin1String("MSecSection");
never executed: case QDateTimeParser::MSecSection:
0
1657 case QDateTimeParser::MinuteSection: return QLatin1String("MinuteSection");
never executed: return QLatin1String("MinuteSection");
never executed: case QDateTimeParser::MinuteSection:
0
1658 case QDateTimeParser::MonthSection: return QLatin1String("MonthSection");
never executed: return QLatin1String("MonthSection");
never executed: case QDateTimeParser::MonthSection:
0
1659 case QDateTimeParser::SecondSection: return QLatin1String("SecondSection");
never executed: return QLatin1String("SecondSection");
never executed: case QDateTimeParser::SecondSection:
0
1660 case QDateTimeParser::YearSection: return QLatin1String("YearSection");
never executed: return QLatin1String("YearSection");
never executed: case QDateTimeParser::YearSection:
0
1661 case QDateTimeParser::YearSection2Digits: return QLatin1String("YearSection2Digits");
never executed: return QLatin1String("YearSection2Digits");
never executed: case QDateTimeParser::YearSection2Digits:
0
1662 case QDateTimeParser::NoSection: return QLatin1String("NoSection");
never executed: return QLatin1String("NoSection");
never executed: case QDateTimeParser::NoSection:
0
1663 case QDateTimeParser::FirstSection: return QLatin1String("FirstSection");
never executed: return QLatin1String("FirstSection");
never executed: case QDateTimeParser::FirstSection:
0
1664 case QDateTimeParser::LastSection: return QLatin1String("LastSection");
never executed: return QLatin1String("LastSection");
never executed: case QDateTimeParser::LastSection:
0
1665 default: return QLatin1String("Unknown section ") + QString::number(int(s));
never executed: return QLatin1String("Unknown section ") + QString::number(int(s));
never executed: default:
0
1666 }-
1667}-
1668-
1669/*!-
1670 \internal-
1671 For debugging. Returns the name of the state \a s.-
1672*/-
1673-
1674QString QDateTimeParser::stateName(State s) const-
1675{-
1676 switch (s) {-
1677 case Invalid: return QLatin1String("Invalid");
never executed: return QLatin1String("Invalid");
never executed: case Invalid:
0
1678 case Intermediate: return QLatin1String("Intermediate");
never executed: return QLatin1String("Intermediate");
never executed: case Intermediate:
0
1679 case Acceptable: return QLatin1String("Acceptable");
never executed: return QLatin1String("Acceptable");
never executed: case Acceptable:
0
1680 default: return QLatin1String("Unknown state ") + QString::number(s);
never executed: return QLatin1String("Unknown state ") + QString::number(s);
never executed: default:
0
1681 }-
1682}-
1683-
1684#ifndef QT_NO_DATESTRING-
1685bool QDateTimeParser::fromString(const QString &t, QDate *date, QTime *time) const-
1686{-
1687 QDateTime val(QDate(1900, 1, 1), QDATETIMEEDIT_TIME_MIN);-
1688 QString text = t;-
1689 int copy = -1;-
1690 const StateNode tmp = parse(text, copy, val, false);-
1691 if (tmp.state != Acceptable || tmp.conflicts) {
tmp.state != AcceptableDescription
TRUEevaluated 143 times by 4 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QFtp
  • tst_QTime
FALSEevaluated 465 times by 8 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
tmp.conflictsDescription
TRUEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTime
FALSEevaluated 460 times by 8 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
5-465
1692 return false;
executed 148 times by 4 tests: return false;
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QFtp
  • tst_QTime
148
1693 }-
1694 if (time) {
timeDescription
TRUEevaluated 424 times by 7 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_QDate
36-424
1695 const QTime t = tmp.value.time();-
1696 if (!t.isValid()) {
!t.isValid()Description
TRUEnever evaluated
FALSEevaluated 424 times by 7 tests
Evaluated by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
0-424
1697 return false;
never executed: return false;
0
1698 }-
1699 *time = t;-
1700 }
executed 424 times by 7 tests: end of block
Executed by:
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
424
1701-
1702 if (date) {
dateDescription
TRUEevaluated 454 times by 7 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QTime
6-454
1703 const QDate d = tmp.value.date();-
1704 if (!d.isValid()) {
!d.isValid()Description
TRUEnever evaluated
FALSEevaluated 454 times by 7 tests
Evaluated by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
0-454
1705 return false;
never executed: return false;
0
1706 }-
1707 *date = d;-
1708 }
executed 454 times by 7 tests: end of block
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
454
1709 return true;
executed 460 times by 8 tests: return true;
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
460
1710}-
1711#endif // QT_NO_DATESTRING-
1712-
1713QDateTime QDateTimeParser::getMinimum() const-
1714{-
1715 return QDateTime(QDATETIMEEDIT_DATE_MIN, QDATETIMEEDIT_TIME_MIN, spec);
executed 1121 times by 8 tests: return QDateTime(QDate(100, 1, 1), QTime(0, 0, 0, 0), spec);
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
1121
1716}-
1717-
1718QDateTime QDateTimeParser::getMaximum() const-
1719{-
1720 return QDateTime(QDATETIMEEDIT_DATE_MAX, QDATETIMEEDIT_TIME_MAX, spec);
executed 1079 times by 8 tests: return QDateTime(QDate(7999, 12, 31), QTime(23, 59, 59, 999), spec);
Executed by:
  • tst_QDate
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QFtp
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTime
1079
1721}-
1722-
1723QString QDateTimeParser::getAmPmText(AmPm ap, Case cs) const-
1724{-
1725 const QLocale loc = locale();-
1726 QString raw = ap == AmText ? loc.amText() : loc.pmText();
ap == AmTextDescription
TRUEevaluated 60 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTime
FALSEevaluated 60 times by 2 tests
Evaluated by:
  • tst_QDateTime
  • tst_QTime
60
1727 return cs == UpperCase ? raw.toUpper() : raw.toLower();
executed 120 times by 2 tests: return cs == UpperCase ? raw.toUpper() : raw.toLower();
Executed by:
  • tst_QDateTime
  • tst_QTime
120
1728}-
1729-
1730/*-
1731 \internal-
1732-
1733 I give arg2 preference because arg1 is always a QDateTime.-
1734*/-
1735-
1736bool operator==(const QDateTimeParser::SectionNode &s1, const QDateTimeParser::SectionNode &s2)-
1737{-
1738 return (s1.type == s2.type) && (s1.pos == s2.pos) && (s1.count == s2.count);
never executed: return (s1.type == s2.type) && (s1.pos == s2.pos) && (s1.count == s2.count);
0
1739}-
1740-
1741#endif // QT_BOOTSTRAPPED-
1742-
1743QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9