| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | namespace QTest | - |
| 8 | { | - |
| 9 | | - |
| 10 | inline static void qPrintMessage(const QByteArray &ba) | - |
| 11 | { | - |
| 12 | QTestLog::info(ba.constData(), 0, 0); | - |
| 13 | } | 0 |
| 14 | | - |
| 15 | static QList<QByteArray> *ignoreClasses() { static QGlobalStatic<QList<QByteArray> > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QList<QByteArray> *x = new QList<QByteArray>; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QList<QByteArray> > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } never executed: delete x; never executed: return thisGlobalStatic.pointer.load(); never evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) never evaluated: !thisGlobalStatic.pointer.load() never evaluated: !thisGlobalStatic.destroyed | 0 |
| 16 | static int iLevel = 0; | - |
| 17 | static int ignoreLevel = 0; | - |
| 18 | enum { IndentSpacesCount = 4 }; | - |
| 19 | | - |
| 20 | static void qSignalDumperCallback(QObject *caller, int signal_index, void **argv) | - |
| 21 | { | - |
| 22 | qt_noop(); qt_noop(); (void)argv;; | - |
| 23 | const QMetaObject *mo = caller->metaObject(); | - |
| 24 | qt_noop(); | - |
| 25 | QMetaMethod member = QMetaObjectPrivate::signal(mo, signal_index); | - |
| 26 | qt_noop(); | - |
| 27 | | - |
| 28 | if (QTest::ignoreClasses() && QTest::ignoreClasses()->contains(mo->className())) { never evaluated: QTest::ignoreClasses() never evaluated: QTest::ignoreClasses()->contains(mo->className()) | 0 |
| 29 | ++QTest::ignoreLevel; | - |
| 30 | return; | 0 |
| 31 | } | - |
| 32 | | - |
| 33 | QByteArray str; | - |
| 34 | str.fill(' ', QTest::iLevel++ * QTest::IndentSpacesCount); | - |
| 35 | str += "Signal: "; | - |
| 36 | str += mo->className(); | - |
| 37 | str += '('; | - |
| 38 | | - |
| 39 | QString objname = caller->objectName(); | - |
| 40 | str += objname.toLocal8Bit(); | - |
| 41 | if (!objname.isEmpty()) never evaluated: !objname.isEmpty() | 0 |
| 42 | str += ' '; never executed: str += ' '; | 0 |
| 43 | str += QByteArray::number(quintptr(caller), 16); | - |
| 44 | | - |
| 45 | str += ") "; | - |
| 46 | str += member.name(); | - |
| 47 | str += " ("; | - |
| 48 | | - |
| 49 | QList<QByteArray> args = member.parameterTypes(); | - |
| 50 | for (int i = 0; i < args.count(); ++i) { never evaluated: i < args.count() | 0 |
| 51 | const QByteArray &arg = args.at(i); | - |
| 52 | int typeId = QMetaType::type(args.at(i).constData()); | - |
| 53 | if (arg.endsWith('*') || arg.endsWith('&')) { never evaluated: arg.endsWith('*') never evaluated: arg.endsWith('&') | 0 |
| 54 | str += '('; | - |
| 55 | str += arg; | - |
| 56 | str += ')'; | - |
| 57 | if (arg.endsWith('&')) never evaluated: arg.endsWith('&') | 0 |
| 58 | str += '@'; never executed: str += '@'; | 0 |
| 59 | | - |
| 60 | quintptr addr = quintptr(*reinterpret_cast<void **>(argv[i + 1])); | - |
| 61 | str.append(QByteArray::number(addr, 16)); | - |
| 62 | } else if (typeId != QMetaType::UnknownType) { never evaluated: typeId != QMetaType::UnknownType | 0 |
| 63 | qt_noop(); | - |
| 64 | str.append(arg) | - |
| 65 | .append('(') | - |
| 66 | .append(QVariant(typeId, argv[i + 1]).toString().toLocal8Bit()) | - |
| 67 | .append(')'); | - |
| 68 | } | 0 |
| 69 | str.append(", "); | - |
| 70 | } | 0 |
| 71 | if (str.endsWith(", ")) never evaluated: str.endsWith(", ") | 0 |
| 72 | str.chop(2); never executed: str.chop(2); | 0 |
| 73 | str.append(')'); | - |
| 74 | qPrintMessage(str); | - |
| 75 | } | 0 |
| 76 | | - |
| 77 | static void qSignalDumperCallbackSlot(QObject *caller, int method_index, void **argv) | - |
| 78 | { | - |
| 79 | qt_noop(); qt_noop(); (void)argv;; | - |
| 80 | const QMetaObject *mo = caller->metaObject(); | - |
| 81 | qt_noop(); | - |
| 82 | QMetaMethod member = mo->method(method_index); | - |
| 83 | if (!member.isValid()) never evaluated: !member.isValid() | 0 |
| 84 | return; | 0 |
| 85 | | - |
| 86 | if (QTest::ignoreLevel || never evaluated: QTest::ignoreLevel | 0 |
| 87 | (QTest::ignoreClasses() && QTest::ignoreClasses()->contains(mo->className()))) never evaluated: QTest::ignoreClasses() never evaluated: QTest::ignoreClasses()->contains(mo->className()) | 0 |
| 88 | return; | 0 |
| 89 | | - |
| 90 | QByteArray str; | - |
| 91 | str.fill(' ', QTest::iLevel * QTest::IndentSpacesCount); | - |
| 92 | str += "Slot: "; | - |
| 93 | str += mo->className(); | - |
| 94 | str += '('; | - |
| 95 | | - |
| 96 | QString objname = caller->objectName(); | - |
| 97 | str += objname.toLocal8Bit(); | - |
| 98 | if (!objname.isEmpty()) never evaluated: !objname.isEmpty() | 0 |
| 99 | str += ' '; never executed: str += ' '; | 0 |
| 100 | str += QByteArray::number(quintptr(caller), 16); | - |
| 101 | | - |
| 102 | str += ") "; | - |
| 103 | str += member.methodSignature(); | - |
| 104 | qPrintMessage(str); | - |
| 105 | } | 0 |
| 106 | | - |
| 107 | static void qSignalDumperCallbackEndSignal(QObject *caller, int ) | - |
| 108 | { | - |
| 109 | qt_noop(); qt_noop(); | - |
| 110 | if (QTest::ignoreClasses() never evaluated: QTest::ignoreClasses() | 0 |
| 111 | && QTest::ignoreClasses()->contains(caller->metaObject()->className())) { never evaluated: QTest::ignoreClasses()->contains(caller->metaObject()->className()) | 0 |
| 112 | --QTest::ignoreLevel; | - |
| 113 | qt_noop(); | - |
| 114 | return; | 0 |
| 115 | } | - |
| 116 | --QTest::iLevel; | - |
| 117 | qt_noop(); | - |
| 118 | } | 0 |
| 119 | | - |
| 120 | } | - |
| 121 | | - |
| 122 | void QSignalDumper::startDump() | - |
| 123 | { | - |
| 124 | static QSignalSpyCallbackSet set = { QTest::qSignalDumperCallback, | - |
| 125 | QTest::qSignalDumperCallbackSlot, QTest::qSignalDumperCallbackEndSignal, 0 }; | - |
| 126 | qt_register_signal_spy_callbacks(set); | - |
| 127 | } | 0 |
| 128 | | - |
| 129 | void QSignalDumper::endDump() | - |
| 130 | { | - |
| 131 | static QSignalSpyCallbackSet nset = { 0, 0, 0 ,0 }; | - |
| 132 | qt_register_signal_spy_callbacks(nset); | - |
| 133 | } executed: }Execution Count:394 | 394 |
| 134 | | - |
| 135 | void QSignalDumper::ignoreClass(const QByteArray &klass) | - |
| 136 | { | - |
| 137 | if (QTest::ignoreClasses()) never evaluated: QTest::ignoreClasses() | 0 |
| 138 | QTest::ignoreClasses()->append(klass); never executed: QTest::ignoreClasses()->append(klass); | 0 |
| 139 | } | 0 |
| 140 | | - |
| 141 | void QSignalDumper::clearIgnoredClasses() | - |
| 142 | { | - |
| 143 | if (QTest::ignoreClasses()) never evaluated: QTest::ignoreClasses() | 0 |
| 144 | QTest::ignoreClasses()->clear(); never executed: QTest::ignoreClasses()->clear(); | 0 |
| 145 | } | 0 |
| 146 | | - |
| 147 | | - |
| 148 | | - |
| | |