From d03c8de38f5838c237b8c2fb50739d770c5fc14e Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 5 Oct 2016 15:57:47 +0200 Subject: Add QQuickDial::live [ChangeLog][Controls][Dial] Added a live-property that determines whether the dial provides live updates for the value-property while the handle is dragged. Change-Id: I8da1190df1e9093f81271a8e11f2cea55759573f Reviewed-by: Mitch Curtis --- tests/auto/controls/data/tst_dial.qml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/controls/data/tst_dial.qml b/tests/auto/controls/data/tst_dial.qml index e6446d3e..6dd65593 100644 --- a/tests/auto/controls/data/tst_dial.qml +++ b/tests/auto/controls/data/tst_dial.qml @@ -172,9 +172,10 @@ TestCase { function test_dragging_data() { return [ - { tag: "default", from: 0, to: 1, leftValue: 0.20, topValue: 0.5, rightValue: 0.8, bottomValue: 1.0 }, - { tag: "scaled2", from: 0, to: 2, leftValue: 0.4, topValue: 1.0, rightValue: 1.6, bottomValue: 2.0 }, - { tag: "scaled1", from: -1, to: 0, leftValue: -0.8, topValue: -0.5, rightValue: -0.2, bottomValue: 0.0 } + { tag: "default", from: 0, to: 1, leftValue: 0.20, topValue: 0.5, rightValue: 0.8, bottomValue: 1.0, live: false }, + { tag: "scaled2", from: 0, to: 2, leftValue: 0.4, topValue: 1.0, rightValue: 1.6, bottomValue: 2.0, live: false }, + { tag: "scaled1", from: -1, to: 0, leftValue: -0.8, topValue: -0.5, rightValue: -0.2, bottomValue: 0.0, live: false }, + { tag: "live", from: 0, to: 1, leftValue: 0.20, topValue: 0.5, rightValue: 0.8, bottomValue: 1.0, live: true } ] } @@ -183,32 +184,35 @@ TestCase { verify(dial.wrap); dial.from = data.from; dial.to = data.to; + dial.live = data.live; valueSpy.target = dial; verify(valueSpy.valid); + var minimumExpectedValueCount = data.live ? 2 : 1; + // drag to the left mouseDrag(dial, dial.width / 2, dial.height / 2, -dial.width / 2, 0, Qt.LeftButton); fuzzyCompare(dial.value, data.leftValue, 0.1); - verify(valueSpy.count > 0); + verify(valueSpy.count >= minimumExpectedValueCount); valueSpy.clear(); // drag to the top mouseDrag(dial, dial.width / 2, dial.height / 2, 0, -dial.height / 2, Qt.LeftButton); fuzzyCompare(dial.value, data.topValue, 0.1); - verify(valueSpy.count > 0); + verify(valueSpy.count >= minimumExpectedValueCount); valueSpy.clear(); // drag to the right mouseDrag(dial, dial.width / 2, dial.height / 2, dial.width / 2, 0, Qt.LeftButton); fuzzyCompare(dial.value, data.rightValue, 0.1); - verify(valueSpy.count > 0); + verify(valueSpy.count >= minimumExpectedValueCount); valueSpy.clear(); // drag to the bottom (* 0.6 to ensure we don't go over to the minimum position) mouseDrag(dial, dial.width / 2, dial.height / 2, 10, dial.height / 2, Qt.LeftButton); fuzzyCompare(dial.value, data.bottomValue, 0.1); - verify(valueSpy.count > 0); + verify(valueSpy.count >= minimumExpectedValueCount); valueSpy.clear(); } -- cgit v1.2.3