From 264e67734359726a75ab2ca9853c1cfd606cb1d8 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 14 Jul 2016 13:14:24 +0200 Subject: Improve unxpected signal warning Give hints as to what could be the cause for the failure. A signal that is missing from the signals property will cause very confusing failure messages. Change-Id: Iefe7db2430b93ccc259a58482443d1116f67c456 Reviewed-by: J-P Nurmi --- tests/auto/controls/data/SignalSequenceSpy.qml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/controls/data/SignalSequenceSpy.qml b/tests/auto/controls/data/SignalSequenceSpy.qml index f2729f6f..798b8b9c 100644 --- a/tests/auto/controls/data/SignalSequenceSpy.qml +++ b/tests/auto/controls/data/SignalSequenceSpy.qml @@ -42,6 +42,11 @@ import QtQuick 2.5 QtObject { property QtObject target: null + // We could just listen to all signals (try { signal.connect(/*...*/) } catch (e)) + // if it weren't for the fact the spy is often declared as a property of the control, + // which creates a "spyChanged" signal, which leads to an unexpected spyChanged signal + // emission. However, we don't know what the property will be called, so the signals + // have to be listed explicitly. property var signals: [] property var expectedSequence: [] property int sequenceIndex: 0 @@ -114,7 +119,7 @@ QtObject { return } } - console.warn("SignalSequenceSpy: Received unexpected signal." + + console.warn("SignalSequenceSpy: Received unexpected signal (is \"" + expectedSignal + "\" listed in the signals array?)" + __mismatchValuesFormat(signalName, expectedSignal)) sequenceFailure = true } -- cgit v1.2.3