1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
From 872093116f2b8cee869f38cdccf527b22d1f1ea1 Mon Sep 17 00:00:00 2001
From: Ronan Abhamon <ronan.abhamon@belledonne-communications.com>
Date: Fri, 15 Jun 2018 15:20:35 +0200
Subject: [PATCH] fix(ExclusiveButtons.spec.qml): do not use SignalSpy in Qt
5.11, click is emitted twice instead of one
---
.../Form/Buttons/ExclusiveButtons.spec.qml | 28 ++++++++++---------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/ui/modules/Common/Form/Buttons/ExclusiveButtons.spec.qml b/ui/modules/Common/Form/Buttons/ExclusiveButtons.spec.qml
index be92a1c4..0154fa95 100644
--- ui/modules/Common/Form/Buttons/ExclusiveButtons.spec.qml
+++ ui/modules/Common/Form/Buttons/ExclusiveButtons.spec.qml
@@ -27,13 +27,6 @@ Item {
texts: ['A', 'B', 'C', 'D', 'E']
}
-
- SignalSpy {
- id: spy
-
- signalName: 'clicked'
- target: exclusiveButtons
- }
}
}
@@ -54,24 +47,33 @@ Item {
function test_signals (data) {
var container = buildExclusiveButtons(data.defaultSelectedButton)
- var spy = container.data[1]
var exclusiveButtons = container.data[0]
-
var buttonToClick = data.buttonToClick
// Test default selected button.
compare(exclusiveButtons.selectedButton, data.defaultSelectedButton)
+ var button = -1
+ var count = 0
+
+ exclusiveButtons.clicked.connect(function (_button) {
+ button = _button;
+ count += 1
+ })
+
// Test a click to change the selected button.
mouseClick(exclusiveButtons.data[buttonToClick])
- spy.wait(100)
- compare(spy.signalArguments[0][0], buttonToClick)
+
+ compare(button, buttonToClick)
compare(exclusiveButtons.selectedButton, buttonToClick)
+ compare(count, 1)
// No signal must be emitted.
mouseClick(exclusiveButtons.data[buttonToClick])
- wait(100)
- compare(spy.count, 1)
+
+ compare(button, buttonToClick)
+ compare(exclusiveButtons.selectedButton, buttonToClick)
+ compare(count, 1)
container.destroy()
}
|