summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/kernel/qobject/tst_qobject.cpp')
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index f1e04511cd..8875998433 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -102,6 +102,7 @@ private slots:
#ifndef QT_NO_PROCESS
void recursiveSignalEmission();
#endif
+ void signalBlocking();
void blockingQueuedConnection();
void childEvents();
void installEventFilter();
@@ -454,7 +455,7 @@ void tst_QObject::connectSlotsByName()
sender.setObjectName("Sender");
QTest::ignoreMessage(QtWarningMsg, "QMetaObject::connectSlotsByName: No matching signal for on_child_signal()");
- QTest::ignoreMessage(QtWarningMsg, "QMetaObject::connectSlotsByName: Connecting slot on_Sender_signalManyParams() with the first of the following compatible signals: (\"signalManyParams(int,int,int,QString,bool)\", \"signalManyParams(int,int,int,QString,bool,bool)\") ");
+ QTest::ignoreMessage(QtWarningMsg, "QMetaObject::connectSlotsByName: Connecting slot on_Sender_signalManyParams() with the first of the following compatible signals: (\"signalManyParams(int,int,int,QString,bool)\", \"signalManyParams(int,int,int,QString,bool,bool)\")");
QMetaObject::connectSlotsByName(&receiver);
receiver.called_slots.clear();
@@ -2949,6 +2950,9 @@ void tst_QObject::dynamicProperties()
QVERIFY(!obj.setProperty("myuserproperty", "Hello"));
QCOMPARE(obj.changedDynamicProperties.count(), 1);
QCOMPARE(obj.changedDynamicProperties.first(), QByteArray("myuserproperty"));
+ //check if there is no redundant DynamicPropertyChange events
+ QVERIFY(!obj.setProperty("myuserproperty", "Hello"));
+ QCOMPARE(obj.changedDynamicProperties.count(), 1);
obj.changedDynamicProperties.clear();
QCOMPARE(obj.property("myuserproperty").toString(), QString("Hello"));
@@ -2981,6 +2985,30 @@ void tst_QObject::recursiveSignalEmission()
}
#endif
+void tst_QObject::signalBlocking()
+{
+ SenderObject sender;
+ ReceiverObject receiver;
+
+ receiver.connect(&sender, SIGNAL(signal1()), SLOT(slot1()));
+
+ sender.emitSignal1();
+ QVERIFY(receiver.called(1));
+ receiver.reset();
+
+ sender.blockSignals(true);
+
+ sender.emitSignal1();
+ QVERIFY(!receiver.called(1));
+ receiver.reset();
+
+ sender.blockSignals(false);
+
+ sender.emitSignal1();
+ QVERIFY(receiver.called(1));
+ receiver.reset();
+}
+
void tst_QObject::blockingQueuedConnection()
{
{