QtBase  v6.3.1
qtest.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2021 The Qt Company Ltd.
4 ** Copyright (C) 2020 Intel Corporation.
5 ** Contact: https://www.qt.io/licensing/
6 **
7 ** This file is part of the QtTest module of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** Commercial License Usage
11 ** Licensees holding valid commercial Qt licenses may use this file in
12 ** accordance with the commercial license agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and The Qt Company. For licensing terms
15 ** and conditions see https://www.qt.io/terms-conditions. For further
16 ** information use the contact form at https://www.qt.io/contact-us.
17 **
18 ** GNU Lesser General Public License Usage
19 ** Alternatively, this file may be used under the terms of the GNU Lesser
20 ** General Public License version 3 as published by the Free Software
21 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
22 ** packaging of this file. Please review the following information to
23 ** ensure the GNU Lesser General Public License version 3 requirements
24 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
25 **
26 ** GNU General Public License Usage
27 ** Alternatively, this file may be used under the terms of the GNU
28 ** General Public License version 2.0 or (at your option) the GNU General
29 ** Public license version 3 or any later version approved by the KDE Free
30 ** Qt Foundation. The licenses are as published by the Free Software
31 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
32 ** included in the packaging of this file. Please review the following
33 ** information to ensure the GNU General Public License requirements will
34 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
35 ** https://www.gnu.org/licenses/gpl-3.0.html.
36 **
37 ** $QT_END_LICENSE$
38 **
39 ****************************************************************************/
40 
41 #ifndef QTEST_H
42 #define QTEST_H
43 
44 #include <QtTest/qttestglobal.h>
45 #include <QtTest/qtestcase.h>
46 #include <QtTest/qtestdata.h>
47 #include <QtTest/qbenchmark.h>
48 
49 #include <QtCore/qbitarray.h>
50 #include <QtCore/qbytearray.h>
51 #include <QtCore/qcborarray.h>
52 #include <QtCore/qcborcommon.h>
53 #include <QtCore/qcbormap.h>
54 #include <QtCore/qcborvalue.h>
55 #include <QtCore/qstring.h>
56 #include <QtCore/qstringlist.h>
57 #include <QtCore/qcborcommon.h>
58 #include <QtCore/qdatetime.h>
59 #if QT_CONFIG(itemmodel)
60 #include <QtCore/qabstractitemmodel.h>
61 #endif
62 #include <QtCore/qobject.h>
63 #include <QtCore/qvariant.h>
64 #include <QtCore/qurl.h>
65 #include <QtCore/quuid.h>
66 
67 #if defined(TESTCASE_LOWDPI)
68 #include <QtCore/qcoreapplication.h>
69 #endif
70 
71 #include <QtCore/qpoint.h>
72 #include <QtCore/qsize.h>
73 #include <QtCore/qrect.h>
74 
75 #include <initializer_list>
76 #include <memory>
77 
79 
80 namespace QTest
81 {
82 
83 template <> inline char *toString(const QStringView &str)
84 {
86 }
87 
88 template<> inline char *toString(const QString &str)
89 {
90  return toString(QStringView(str));
91 }
92 
93 template<> inline char *toString(const QLatin1String &str)
94 {
95  return toString(QString(str));
96 }
97 
98 template<> inline char *toString(const QByteArray &ba)
99 {
101 }
102 
103 template<> inline char *toString(const QBitArray &ba)
104 {
105  qsizetype size = ba.size();
106  char *str = new char[size + 1];
107  for (qsizetype i = 0; i < size; ++i)
108  str[i] = "01"[ba.testBit(i)];
109  str[size] = '\0';
110  return str;
111 }
112 
113 #if QT_CONFIG(datestring)
114 template<> inline char *toString(const QTime &time)
115 {
116  return time.isValid()
117  ? qstrdup(qPrintable(time.toString(u"hh:mm:ss.zzz")))
118  : qstrdup("Invalid QTime");
119 }
120 
121 template<> inline char *toString(const QDate &date)
122 {
123  return date.isValid()
124  ? qstrdup(qPrintable(date.toString(u"yyyy/MM/dd")))
125  : qstrdup("Invalid QDate");
126 }
127 
128 template<> inline char *toString(const QDateTime &dateTime)
129 {
130  return dateTime.isValid()
131  ? qstrdup(qPrintable(dateTime.toString(u"yyyy/MM/dd hh:mm:ss.zzz[t]")))
132  : qstrdup("Invalid QDateTime");
133 }
134 #endif // datestring
135 
136 template<> inline char *toString(const QCborError &c)
137 {
138  // use the Q_ENUM formatting
139  return toString(c.c);
140 }
141 
142 template<> inline char *toString(const QChar &c)
143 {
144  const ushort uc = c.unicode();
145  if (uc < 128) {
146  char msg[32] = {'\0'};
147  qsnprintf(msg, sizeof(msg), "QChar: '%c' (0x%x)", char(uc), unsigned(uc));
148  return qstrdup(msg);
149  }
150  return qstrdup(qPrintable(QString::fromLatin1("QChar: '%1' (0x%2)").arg(c).arg(QString::number(static_cast<int>(c.unicode()), 16))));
151 }
152 
153 #if QT_CONFIG(itemmodel)
154 template<> inline char *toString(const QModelIndex &idx)
155 {
156  char msg[128];
157  qsnprintf(msg, sizeof(msg), "QModelIndex(%d,%d,%p,%p)", idx.row(), idx.column(), idx.internalPointer(), idx.model());
158  return qstrdup(msg);
159 }
160 #endif
161 
162 template<> inline char *toString(const QPoint &p)
163 {
164  char msg[128] = {'\0'};
165  qsnprintf(msg, sizeof(msg), "QPoint(%d,%d)", p.x(), p.y());
166  return qstrdup(msg);
167 }
168 
169 template<> inline char *toString(const QSize &s)
170 {
171  char msg[128] = {'\0'};
172  qsnprintf(msg, sizeof(msg), "QSize(%dx%d)", s.width(), s.height());
173  return qstrdup(msg);
174 }
175 
176 template<> inline char *toString(const QRect &s)
177 {
178  char msg[256] = {'\0'};
179  qsnprintf(msg, sizeof(msg), "QRect(%d,%d %dx%d) (bottomright %d,%d)",
180  s.left(), s.top(), s.width(), s.height(), s.right(), s.bottom());
181  return qstrdup(msg);
182 }
183 
184 template<> inline char *toString(const QPointF &p)
185 {
186  char msg[64] = {'\0'};
187  qsnprintf(msg, sizeof(msg), "QPointF(%g,%g)", p.x(), p.y());
188  return qstrdup(msg);
189 }
190 
191 template<> inline char *toString(const QSizeF &s)
192 {
193  char msg[64] = {'\0'};
194  qsnprintf(msg, sizeof(msg), "QSizeF(%gx%g)", s.width(), s.height());
195  return qstrdup(msg);
196 }
197 
198 template<> inline char *toString(const QRectF &s)
199 {
200  char msg[256] = {'\0'};
201  qsnprintf(msg, sizeof(msg), "QRectF(%g,%g %gx%g) (bottomright %g,%g)",
202  s.left(), s.top(), s.width(), s.height(), s.right(), s.bottom());
203  return qstrdup(msg);
204 }
205 
206 template<> inline char *toString(const QUrl &uri)
207 {
208  if (!uri.isValid())
209  return qstrdup(qPrintable(QLatin1String("Invalid URL: ") + uri.errorString()));
210  return qstrdup(uri.toEncoded().constData());
211 }
212 
213 template <> inline char *toString(const QUuid &uuid)
214 {
215  return qstrdup(uuid.toByteArray().constData());
216 }
217 
218 template<> inline char *toString(const QVariant &v)
219 {
220  QByteArray vstring("QVariant(");
221  if (v.isValid()) {
222  QByteArray type(v.typeName());
223  if (type.isEmpty()) {
224  type = QByteArray::number(v.userType());
225  }
226  vstring.append(type);
227  if (!v.isNull()) {
228  vstring.append(',');
229  if (v.canConvert<QString>()) {
230  vstring.append(v.toString().toLocal8Bit());
231  }
232  else {
233  vstring.append("<value not representable as string>");
234  }
235  }
236  }
237  vstring.append(')');
238 
239  return qstrdup(vstring.constData());
240 }
241 
242 namespace Internal {
244 {
245  enum { BufferLen = 256 };
247  {
248  char *buf = new char[BufferLen];
249  qsnprintf(buf, BufferLen, "QCborValue(QCborSimpleType(%d))", int(st));
250  return buf;
251  }
252 
253  static char *formatTag(QCborTag tag, const QCborValue &taggedValue)
254  {
255  QScopedArrayPointer<char> hold(format(taggedValue));
256  char *buf = new char[BufferLen];
257  qsnprintf(buf, BufferLen, "QCborValue(QCborTag(%llu), %s)", tag, hold.get());
258  return buf;
259  }
260 
261  static char *innerFormat(QCborValue::Type t, const char *str)
262  {
263  static const QMetaEnum typeEnum = []() {
264  int idx = QCborValue::staticMetaObject.indexOfEnumerator("Type");
265  return QCborValue::staticMetaObject.enumerator(idx);
266  }();
267 
268  char *buf = new char[BufferLen];
269  const char *typeName = typeEnum.valueToKey(t);
270  if (typeName)
271  qsnprintf(buf, BufferLen, "QCborValue(%s, %s)", typeName, str);
272  else
273  qsnprintf(buf, BufferLen, "QCborValue(<unknown type 0x%02x>)", t);
274  return buf;
275  }
276 
277  template<typename T> static char *format(QCborValue::Type type, const T &t)
278  {
280  return innerFormat(type, hold.get());
281  }
282 
283  static char *format(const QCborValue &v)
284  {
285  switch (v.type()) {
286  case QCborValue::Integer:
287  return format(v.type(), v.toInteger());
289  return format(v.type(), v.toByteArray());
290  case QCborValue::String:
291  return format(v.type(), v.toString());
292  case QCborValue::Array:
293  return innerFormat(v.type(), QScopedArrayPointer<char>(format(v.toArray())).get());
294  case QCborValue::Map:
295  return innerFormat(v.type(), QScopedArrayPointer<char>(format(v.toMap())).get());
296  case QCborValue::Tag:
297  return formatTag(v.tag(), v.taggedValue());
299  break;
300  case QCborValue::True:
301  return qstrdup("QCborValue(true)");
302  case QCborValue::False:
303  return qstrdup("QCborValue(false)");
304  case QCborValue::Null:
305  return qstrdup("QCborValue(nullptr)");
307  return qstrdup("QCborValue()");
308  case QCborValue::Double:
309  return format(v.type(), v.toDouble());
311  case QCborValue::Url:
313  return format(v.type(), v.taggedValue().toString());
314  case QCborValue::Uuid:
315  return format(v.type(), v.toUuid());
316  case QCborValue::Invalid:
317  return qstrdup("QCborValue(<invalid>)");
318  }
319 
320  if (v.isSimpleType())
321  return formatSimpleType(v.toSimpleType());
322  return innerFormat(v.type(), "");
323  }
324 
325  static char *format(const QCborArray &a)
326  {
327  QByteArray out(1, '[');
328  const char *comma = "";
329  for (const QCborValueRef v : a) {
331  out += comma;
332  out += s.get();
333  comma = ", ";
334  }
335  out += ']';
336  return qstrdup(out.constData());
337  }
338 
339  static char *format(const QCborMap &m)
340  {
341  QByteArray out(1, '{');
342  const char *comma = "";
343  for (auto pair : m) {
344  QScopedArrayPointer<char> key(format(pair.first));
345  QScopedArrayPointer<char> value(format(pair.second));
346  out += comma;
347  out += key.get();
348  out += ": ";
349  out += value.get();
350  comma = ", ";
351  }
352  out += '}';
353  return qstrdup(out.constData());
354  }
355 };
356 }
357 
358 template<> inline char *toString(const QCborValue &v)
359 {
361 }
362 
363 template<> inline char *toString(const QCborValueRef &v)
364 {
365  return toString(QCborValue(v));
366 }
367 
368 template<> inline char *toString(const QCborArray &a)
369 {
371 }
372 
373 template<> inline char *toString(const QCborMap &m)
374 {
376 }
377 
378 template <typename T1, typename T2>
379 inline char *toString(const std::pair<T1, T2> &pair)
380 {
381  const QScopedArrayPointer<char> first(toString(pair.first));
382  const QScopedArrayPointer<char> second(toString(pair.second));
383  return formatString("std::pair(", ")", 2, first.data(), second.data());
384 }
385 
386 template <typename Tuple, int... I>
387 inline char *toString(const Tuple & tuple, QtPrivate::IndexesList<I...>) {
388  using UP = std::unique_ptr<char[]>;
389  // Generate a table of N + 1 elements where N is the number of
390  // elements in the tuple.
391  // The last element is needed to support the empty tuple use case.
392  const UP data[] = {
393  UP(toString(std::get<I>(tuple)))..., UP{}
394  };
395  return formatString("std::tuple(", ")", sizeof...(I), data[I].get()...);
396 }
397 
398 template <class... Types>
399 inline char *toString(const std::tuple<Types...> &tuple)
400 {
401  static const std::size_t params_count = sizeof...(Types);
402  return toString(tuple, typename QtPrivate::Indexes<params_count>::Value());
403 }
404 
405 inline char *toString(std::nullptr_t)
406 {
407  return toString(QLatin1String("nullptr"));
408 }
409 
410 template<>
411 inline bool qCompare(QString const &t1, QLatin1String const &t2, const char *actual,
412  const char *expected, const char *file, int line)
413 {
414  return qCompare(t1, QString(t2), actual, expected, file, line);
415 }
416 template<>
417 inline bool qCompare(QLatin1String const &t1, QString const &t2, const char *actual,
418  const char *expected, const char *file, int line)
419 {
420  return qCompare(QString(t1), t2, actual, expected, file, line);
421 }
422 
423 // Compare sequences of equal size
424 template <typename ActualIterator, typename ExpectedIterator>
425 bool _q_compareSequence(ActualIterator actualIt, ActualIterator actualEnd,
426  ExpectedIterator expectedBegin, ExpectedIterator expectedEnd,
427  const char *actual, const char *expected,
428  const char *file, int line)
429 {
430  char msg[1024];
431  msg[0] = '\0';
432 
433  const qsizetype actualSize = actualEnd - actualIt;
434  const qsizetype expectedSize = expectedEnd - expectedBegin;
435  bool isOk = actualSize == expectedSize;
436 
437  if (!isOk) {
438  qsnprintf(msg, sizeof(msg), "Compared lists have different sizes.\n"
439  " Actual (%s) size: %zd\n"
440  " Expected (%s) size: %zd", actual, actualSize,
441  expected, expectedSize);
442  }
443 
444  for (auto expectedIt = expectedBegin; isOk && expectedIt < expectedEnd; ++actualIt, ++expectedIt) {
445  if (!(*actualIt == *expectedIt)) {
446  const qsizetype i = qsizetype(expectedIt - expectedBegin);
447  char *val1 = toString(*actualIt);
448  char *val2 = toString(*expectedIt);
449 
450  qsnprintf(msg, sizeof(msg), "Compared lists differ at index %zd.\n"
451  " Actual (%s): %s\n"
452  " Expected (%s): %s", i, actual, val1 ? val1 : "<null>",
453  expected, val2 ? val2 : "<null>");
454  isOk = false;
455 
456  delete [] val1;
457  delete [] val2;
458  }
459  }
460  return compare_helper(isOk, msg, nullptr, nullptr, actual, expected, file, line);
461 }
462 
463 namespace Internal {
464 
465 #if defined(TESTCASE_LOWDPI)
466 void disableHighDpi()
467 {
468  qputenv("QT_ENABLE_HIGHDPI_SCALING", "0");
469 }
470 Q_CONSTRUCTOR_FUNCTION(disableHighDpi);
471 #endif
472 
473 } // namespace Internal
474 
475 template <typename T>
476 inline bool qCompare(QList<T> const &t1, QList<T> const &t2, const char *actual, const char *expected,
477  const char *file, int line)
478 {
479  return _q_compareSequence(t1.cbegin(), t1.cend(), t2.cbegin(), t2.cend(),
480  actual, expected, file, line);
481 }
482 
483 template <typename T, int N>
484 bool qCompare(QList<T> const &t1, std::initializer_list<T> t2,
485  const char *actual, const char *expected,
486  const char *file, int line)
487 {
488  return _q_compareSequence(t1.cbegin(), t1.cend(), t2.cbegin(), t2.cend(),
489  actual, expected, file, line);
490 }
491 
492 // Compare QList against array
493 template <typename T, int N>
494 bool qCompare(QList<T> const &t1, const T (& t2)[N],
495  const char *actual, const char *expected,
496  const char *file, int line)
497 {
498  return _q_compareSequence(t1.cbegin(), t1.cend(), t2, t2 + N,
499  actual, expected, file, line);
500 }
501 
502 template <typename T>
503 inline bool qCompare(QFlags<T> const &t1, T const &t2, const char *actual, const char *expected,
504  const char *file, int line)
505 {
506  using Int = typename QFlags<T>::Int;
507  return qCompare(Int(t1), Int(t2), actual, expected, file, line);
508 }
509 
510 template <typename T>
511 inline bool qCompare(QFlags<T> const &t1, int const &t2, const char *actual, const char *expected,
512  const char *file, int line)
513 {
514  using Int = typename QFlags<T>::Int;
515  return qCompare(Int(t1), Int(t2), actual, expected, file, line);
516 }
517 
518 template<>
519 inline bool qCompare(qint64 const &t1, qint32 const &t2, const char *actual,
520  const char *expected, const char *file, int line)
521 {
522  return qCompare(t1, static_cast<qint64>(t2), actual, expected, file, line);
523 }
524 
525 template<>
526 inline bool qCompare(qint64 const &t1, quint32 const &t2, const char *actual,
527  const char *expected, const char *file, int line)
528 {
529  return qCompare(t1, static_cast<qint64>(t2), actual, expected, file, line);
530 }
531 
532 template<>
533 inline bool qCompare(quint64 const &t1, quint32 const &t2, const char *actual,
534  const char *expected, const char *file, int line)
535 {
536  return qCompare(t1, static_cast<quint64>(t2), actual, expected, file, line);
537 }
538 
539 template<>
540 inline bool qCompare(qint32 const &t1, qint64 const &t2, const char *actual,
541  const char *expected, const char *file, int line)
542 {
543  return qCompare(static_cast<qint64>(t1), t2, actual, expected, file, line);
544 }
545 
546 template<>
547 inline bool qCompare(quint32 const &t1, qint64 const &t2, const char *actual,
548  const char *expected, const char *file, int line)
549 {
550  return qCompare(static_cast<qint64>(t1), t2, actual, expected, file, line);
551 }
552 
553 template<>
554 inline bool qCompare(quint32 const &t1, quint64 const &t2, const char *actual,
555  const char *expected, const char *file, int line)
556 {
557  return qCompare(static_cast<quint64>(t1), t2, actual, expected, file, line);
558 }
559 namespace Internal {
560 
561 template <typename T>
562 class HasInitMain // SFINAE test for the presence of initMain()
563 {
564 private:
565  using YesType = char[1];
566  using NoType = char[2];
567 
568  template <typename C> static YesType& test( decltype(&C::initMain) ) ;
569  template <typename C> static NoType& test(...);
570 
571 public:
572  enum { value = sizeof(test<T>(nullptr)) == sizeof(YesType) };
573 };
574 
575 template<typename T>
577 {
578  T::initMain();
579 }
580 
581 template<typename T>
583 {
584 }
585 
586 } // namespace Internal
587 
588 } // namespace QTest
590 
591 #ifdef QT_TESTCASE_BUILDDIR
592 # define QTEST_SET_MAIN_SOURCE_PATH QTest::setMainSourcePath(__FILE__, QT_TESTCASE_BUILDDIR);
593 #else
594 # define QTEST_SET_MAIN_SOURCE_PATH QTest::setMainSourcePath(__FILE__);
595 #endif
596 
597 // Hooks for coverage-testing of QTestLib itself:
598 #if QT_CONFIG(testlib_selfcover) && defined(__COVERAGESCANNER__)
599 struct QtCoverageScanner
600 {
601  QtCoverageScanner(const char *name)
602  {
603  __coveragescanner_clear();
604  __coveragescanner_testname(name);
605  }
606  ~QtCoverageScanner()
607  {
608  __coveragescanner_save();
609  __coveragescanner_testname("");
610  }
611 };
612 #define TESTLIB_SELFCOVERAGE_START(name) QtCoverageScanner _qtCoverageScanner(name);
613 #else
614 #define TESTLIB_SELFCOVERAGE_START(name)
615 #endif
616 
617 // Internal (but used by some testlib selftests to hack argc and argv).
618 // Tests should normally implement initMain() if they have set-up to do before
619 // instantiating the test class.
620 #define QTEST_MAIN_WRAPPER(TestObject, ...) \
621 int main(int argc, char *argv[]) \
622 { \
623  TESTLIB_SELFCOVERAGE_START(#TestObject) \
624  QT_PREPEND_NAMESPACE(QTest::Internal::callInitMain)<TestObject>(); \
625  __VA_ARGS__ \
626  TestObject tc; \
627  QTEST_SET_MAIN_SOURCE_PATH \
628  return QTest::qExec(&tc, argc, argv); \
629 }
630 
631 // For when you don't even want a QApplication:
632 #define QTEST_APPLESS_MAIN(TestObject) QTEST_MAIN_WRAPPER(TestObject)
633 
634 #include <QtTest/qtestsystem.h>
635 
636 #if defined(QT_NETWORK_LIB)
637 # include <QtTest/qtest_network.h>
638 #endif
639 
640 // Internal
641 #define QTEST_QAPP_SETUP(klaz) \
642  klaz app(argc, argv); \
643  app.setAttribute(Qt::AA_Use96Dpi, true);
644 
645 #if defined(QT_WIDGETS_LIB)
646 # include <QtTest/qtest_widgets.h>
647 # ifdef QT_KEYPAD_NAVIGATION
648 # define QTEST_DISABLE_KEYPAD_NAVIGATION QApplication::setNavigationMode(Qt::NavigationModeNone);
649 # else
650 # define QTEST_DISABLE_KEYPAD_NAVIGATION
651 # endif
652 // Internal
653 # define QTEST_MAIN_SETUP() QTEST_QAPP_SETUP(QApplication) QTEST_DISABLE_KEYPAD_NAVIGATION
654 #elif defined(QT_GUI_LIB)
655 # include <QtTest/qtest_gui.h>
656 // Internal
657 # define QTEST_MAIN_SETUP() QTEST_QAPP_SETUP(QGuiApplication)
658 #else
659 // Internal
660 # define QTEST_MAIN_SETUP() QTEST_QAPP_SETUP(QCoreApplication)
661 #endif // QT_GUI_LIB
662 
663 // For most tests:
664 #define QTEST_MAIN(TestObject) QTEST_MAIN_WRAPPER(TestObject, QTEST_MAIN_SETUP())
665 
666 // For command-line tests
667 #define QTEST_GUILESS_MAIN(TestObject) \
668  QTEST_MAIN_WRAPPER(TestObject, QTEST_QAPP_SETUP(QCoreApplication))
669 
670 #endif
small capitals from c petite p scientific f u
Definition: afcover.h:88
small capitals from c petite p scientific i
[1]
Definition: afcover.h:80
const char msg[]
Definition: arch.cpp:46
#define value
[5]
FT_UInt idx
Definition: cffcmap.c:135
The QBitArray class provides an array of bits.
Definition: qbitarray.h:49
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:85
qsizetype size() const noexcept
Definition: qbytearray.h:470
const char * constData() const noexcept
Definition: qbytearray.h:144
qsizetype length() const noexcept
Definition: qbytearray.h:472
static QByteArray number(int, int base=10)
QByteArray & append(char c)
The QCborArray class is used to hold an array of CBOR elements.
Definition: qcborarray.h:56
The QCborMap class is used to hold an associative container representable in CBOR.
Definition: qcbormap.h:57
The QCborValue class encapsulates a value in CBOR.
Definition: qcborvalue.h:86
@ RegularExpression
Definition: qcborvalue.h:129
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:84
The QDate class provides date functions.
Definition: qdatetime.h:64
constexpr bool isValid() const
Definition: qdatetime.h:72
The QDateTime class provides date and time functions.
Definition: qdatetime.h:238
bool isValid() const
Definition: qdatetime.cpp:3741
The QFlags class provides a type-safe way of storing OR-combinations of enum values.
Definition: qflags.h:89
std::conditional< std::is_unsigned< typename std::underlying_type< Enum >::type >::value, unsigned int, signed int >::type Int
Definition: qflags.h:92
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
Definition: qstring.h:84
Definition: qlist.h:108
The QMetaEnum class provides meta-data about an enumerator.
Definition: qmetaobject.h:220
const char * valueToKey(int value) const
The QModelIndex class is used to locate data in a data model.
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:242
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:52
The QRectF class defines a finite rectangle in the plane using floating point precision.
Definition: qrect.h:511
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:59
The QScopedArrayPointer class stores a pointer to a dynamically allocated array of objects,...
T * get() const noexcept
T * data() const noexcept
The QSizeF class defines the size of a two-dimensional object using floating point precision.
Definition: qsize.h:235
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:55
The QString class provides a Unicode character string.
Definition: qstring.h:388
static QString fromLatin1(QByteArrayView ba)
Definition: qstring.cpp:5488
static QString number(int, int base=10)
Definition: qstring.cpp:7538
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QStrin...
Definition: qstringview.h:122
The QTime class provides clock time functions.
Definition: qdatetime.h:166
bool isValid() const
Definition: qdatetime.cpp:1753
The QUrl class provides a convenient interface for working with URLs.
Definition: qurl.h:130
bool isValid() const
Definition: qurl.cpp:1897
QByteArray toEncoded(FormattingOptions options=FullyEncoded) const
Definition: qurl.cpp:2987
QString errorString() const
Definition: qurl.cpp:3618
The QUuid class stores a Universally Unique Identifier (UUID).
Definition: quuid.h:67
QByteArray toByteArray(StringFormat mode=WithBraces) const
Definition: quuid.cpp:624
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:95
QString str
[2]
QDate date
[1]
int Int
Definition: ftraster.c:307
#define I(x, y, z)
Definition: md5.c:55
bool isOk(ResultWas::OfType resultType)
std::enable_if< HasInitMain< T >::value, void >::type callInitMain()
Definition: qtest.h:576
[15]
Definition: tst_encoder.cpp:33
bool qCompare(QString const &t1, QLatin1String const &t2, const char *actual, const char *expected, const char *file, int line)
Definition: qtest.h:411
Q_TESTLIB_EXPORT bool compare_helper(bool success, const char *failureMsg, char *val1, char *val2, const char *actual, const char *expected, const char *file, int line)
Definition: qtestcase.cpp:2802
bool _q_compareSequence(ActualIterator actualIt, ActualIterator actualEnd, ExpectedIterator expectedBegin, ExpectedIterator expectedEnd, const char *actual, const char *expected, const char *file, int line)
Definition: qtest.h:425
char * formatString(const char *prefix, const char *suffix, size_t numArguments,...)
Definition: qtestcase.cpp:1370
char * toPrettyCString(const char *p, int length)
Definition: qtestcase.cpp:1463
char * toPrettyUnicode(QStringView string)
Definition: qtestcase.cpp:1559
char * toString(const MyPoint &point)
string comma
Definition: cordic.py:8
#define QString()
Definition: parse-defines.h:51
Q_CORE_EXPORT int qsnprintf(char *str, size_t n, const char *fmt,...)
Q_CORE_EXPORT char * qstrdup(const char *)
QCborTag
Definition: qcborcommon.h:66
QCborSimpleType
Definition: qcborcommon.h:59
Q_CONSTRUCTOR_FUNCTION(initializeStandardUserDefaults)
EGLOutputLayerEXT EGLint EGLAttrib value
unsigned int quint32
Definition: qglobal.h:288
int qint32
Definition: qglobal.h:287
unsigned long long quint64
Definition: qglobal.h:299
ptrdiff_t qsizetype
Definition: qglobal.h:308
long long qint64
Definition: qglobal.h:298
unsigned short ushort
Definition: qglobal.h:333
const char * typeName
Definition: qmetatype.cpp:869
GLenum type
Definition: qopengl.h:270
GLsizei const GLfloat * v
[13]
const GLfloat * m
GLuint64 key
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
[4]
GLenum GLuint GLenum GLsizei const GLchar * buf
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLuint name
GLint first
GLint GLsizei GLsizei GLenum format
const GLubyte * c
Definition: qopenglext.h:12701
GLdouble GLdouble t
[9]
Definition: qopenglext.h:243
GLdouble s
[6]
Definition: qopenglext.h:235
GLfloat GLfloat p
[1]
Definition: qopenglext.h:12698
SSL_CTX int(*) void arg)
QByteArray ba
[0]
QFile file
[0]
QTextStream out(stdout)
[7]
QCborValue(QCborTag(2), QByteArray("\x01\0\0\0\0\0\0\0\0", 9))
[0]
QDateTime dateTime
[12]
QTime time
[5]
QSize t2(10, 12)
http get(QUrl::toPercentEncoding("/index.html"))
The QCborError class holds the error condition found while parsing or validating a CBOR stream.
Definition: qcborcommon.h:99
static char * formatSimpleType(QCborSimpleType st)
Definition: qtest.h:246
static char * format(QCborValue::Type type, const T &t)
Definition: qtest.h:277
static char * format(const QCborValue &v)
Definition: qtest.h:283
static char * format(const QCborMap &m)
Definition: qtest.h:339
static char * formatTag(QCborTag tag, const QCborValue &taggedValue)
Definition: qtest.h:253
static char * innerFormat(QCborValue::Type t, const char *str)
Definition: qtest.h:261
static char * format(const QCborArray &a)
Definition: qtest.h:325
makeIndexSequence< N > Value
Definition: main.cpp:38
XmlOutput::xml_output tag(const QString &name)
Definition: xmloutput.h:154