diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2023-10-06 15:31:41 +0200 |
---|---|---|
committer | Ivan Solovev <ivan.solovev@qt.io> | 2023-10-06 16:52:47 +0200 |
commit | d529400fe58c2a638acfada31d27223c1ef0c504 (patch) | |
tree | 2ba3fb0ef5f59aa9f609e9841526b2cbc2ba62a4 | |
parent | 4737be4414888e180fd3bb0ffb06d34be3f315b5 (diff) |
Extend tests for bindable properties
QTestPrivate namespace has a set of helper functions to test bindable
properties.
Use them to test the bindable properties of QWebChannel, as they could
potentially have issues with binding loops.
The updated tests didn't reveal any issues, so no further action is
required.
Fixes: QTBUG-116544
Pick-to: 6.6 6.5
Change-Id: I2f826fe0d286b8370edba34bd6d8e3553512a387
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
-rw-r--r-- | tests/auto/webchannel/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/auto/webchannel/tst_webchannel.cpp | 20 | ||||
-rw-r--r-- | tests/auto/webchannel/tst_webchannel.h | 1 |
3 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/webchannel/CMakeLists.txt b/tests/auto/webchannel/CMakeLists.txt index ae747bb..35382a2 100644 --- a/tests/auto/webchannel/CMakeLists.txt +++ b/tests/auto/webchannel/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_test(tst_webchannel LIBRARIES Qt::CorePrivate Qt::WebChannelPrivate + Qt::TestPrivate ) qt_internal_extend_target(tst_webchannel CONDITION TARGET Qt::Qml diff --git a/tests/auto/webchannel/tst_webchannel.cpp b/tests/auto/webchannel/tst_webchannel.cpp index bf28187..0a5e48d 100644 --- a/tests/auto/webchannel/tst_webchannel.cpp +++ b/tests/auto/webchannel/tst_webchannel.cpp @@ -9,6 +9,7 @@ #include <QtWebChannel/private/qmetaobjectpublisher_p.h> #include <QtTest> +#include <QtTest/private/qpropertytesthelper_p.h> #ifdef WEBCHANNEL_TESTS_CAN_USE_JS_ENGINE #include <QJSEngine> #endif @@ -1306,6 +1307,25 @@ void TestWebChannel::testQPropertyBlockUpdates() QCOMPARE(transport.messagesSent().size(), 1u); } +void TestWebChannel::testBindings() +{ + QWebChannel channel; + + QTestPrivate::testReadWritePropertyBasics(channel, true, false, "blockUpdates"); + if (QTest::currentTestFailed()) { + qDebug("Failed property test for QWebChannel::blockUpdates"); + return; + } + + QVERIFY(!channel.blockUpdates()); + + QTestPrivate::testReadWritePropertyBasics(channel, 100, 200, "propertyUpdateInterval"); + if (QTest::currentTestFailed()) { + qDebug("Failed property test for QWebChannel::propertyUpdateInterval"); + return; + } +} + void TestWebChannel::testPropertyMultipleTransports() { DummyTransport transport1; diff --git a/tests/auto/webchannel/tst_webchannel.h b/tests/auto/webchannel/tst_webchannel.h index c1e3ee3..327d6a2 100644 --- a/tests/auto/webchannel/tst_webchannel.h +++ b/tests/auto/webchannel/tst_webchannel.h @@ -372,6 +372,7 @@ private slots: void testPropertyUpdateInterval(); void testPropertyMultipleTransports(); void testQPropertyBlockUpdates(); + void testBindings(); void testDeletionDuringMethodInvocation_data(); void testDeletionDuringMethodInvocation(); |