diff options
author | Marc Mutz <marc.mutz@qt.io> | 2024-03-21 22:47:33 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2024-03-22 15:31:39 +0100 |
commit | d2dbe2d7f75d32d5f0da0b1676630d7fed9a39a0 (patch) | |
tree | ebad0f317545a31c26e32a0c53e32c8687e1fe12 /tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp | |
parent | fa5cb840699b435a4e5a97fc714471b8339dbedd (diff) |
QSignalSpy: separate messages for invalid and non-signal meta-methods
If a signal was invalid, the code still called messageSignature(),
which returns a null QByteArray, and passed its constData() to
qWarning("%s"). That probably worked in our implementation, because it
falls back to QString::asprintf(), but it raised eyebrows, so avoid
calling messageSignature() on invalid QMetaMethod.
This changes the warning output, so adjust the test.
Task-number: QTBUG-123544
Change-Id: I41bc6650de091f61354ff91ee45659668f0e0223
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp')
-rw-r--r-- | tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp b/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp index 40dc83ec28..66f8b00505 100644 --- a/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp +++ b/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp @@ -485,12 +485,12 @@ void tst_QSignalSpy::spyOnMetaMethod_invalid_data() << QMetaMethod(); QTest::addRow("Empty signal") - << "QSignalSpy: Not a valid signal: ''"_ba + << "QSignalSpy: Null signal is not valid"_ba << new QObject(this) << QMetaMethod(); QTest::addRow("Method is not a signal") - << "QSignalSpy: Not a valid signal: 'deleteLater()'"_ba + << "QSignalSpy: Not a signal: 'deleteLater()'"_ba << new QObject(this) << QObject::staticMetaObject.method(QObject::staticMetaObject.indexOfMethod("deleteLater()")); } |