diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2013-09-05 00:19:51 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-10 13:29:27 +0200 |
commit | 105d6758d96e2c723c885efa4dc82938f2cc2d1f (patch) | |
tree | abd6f5d20469e8a1d86167a63ccd6a16f34b1b25 /tests | |
parent | 5f4df5a39be121ca60cac2b06cf94bead76d74d9 (diff) |
Introduce TaskbarProgress::stop()
Change-Id: Id37e6c5e41ab196cd72148b3242332796b1c54ef
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Ivan Vizir <define-true-false@yandex.com>
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qwintaskbarprogress/tst_qwintaskbarprogress.cpp | 32 | ||||
-rw-r--r-- | tests/manual/taskbar/main.qml | 43 |
2 files changed, 59 insertions, 16 deletions
diff --git a/tests/auto/qwintaskbarprogress/tst_qwintaskbarprogress.cpp b/tests/auto/qwintaskbarprogress/tst_qwintaskbarprogress.cpp index aa88276..e5e1a63 100644 --- a/tests/auto/qwintaskbarprogress/tst_qwintaskbarprogress.cpp +++ b/tests/auto/qwintaskbarprogress/tst_qwintaskbarprogress.cpp @@ -52,6 +52,7 @@ private slots: void testRange(); void testPause(); void testVisibility(); + void testStop(); }; void tst_QWinTaskbarProgress::testValue() @@ -162,6 +163,12 @@ void tst_QWinTaskbarProgress::testPause() QCOMPARE(pausedSpy.count(), 2); QCOMPARE(pausedSpy.last().at(0).toBool(), false); + progress->stop(); + progress->pause(); + QVERIFY(!progress->isPaused()); + QCOMPARE(pausedSpy.count(), 2); + + progress->resume(); progress->pause(); QVERIFY(progress->isPaused()); QCOMPARE(pausedSpy.count(), 3); @@ -194,6 +201,31 @@ void tst_QWinTaskbarProgress::testVisibility() QCOMPARE(visibleSpy.last().at(0).toBool(), false); } +void tst_QWinTaskbarProgress::testStop() +{ + QWinTaskbarButton btn; + QWinTaskbarProgress *progress = btn.progress(); + QVERIFY(progress); + QVERIFY(!progress->isStopped()); + + QSignalSpy stoppedSpy(progress, SIGNAL(stoppedChanged(bool))); + QVERIFY(stoppedSpy.isValid()); + + progress->pause(); + QVERIFY(progress->isPaused()); + QVERIFY(!progress->isStopped()); + progress->stop(); + QVERIFY(!progress->isPaused()); + QVERIFY(progress->isStopped()); + QCOMPARE(stoppedSpy.count(), 1); + QCOMPARE(stoppedSpy.last().at(0).toBool(), true); + + progress->resume(); + QVERIFY(!progress->isStopped()); + QCOMPARE(stoppedSpy.count(), 2); + QCOMPARE(stoppedSpy.last().at(0).toBool(), false); +} + QTEST_MAIN(tst_QWinTaskbarProgress) #include "tst_qwintaskbarprogress.moc" diff --git a/tests/manual/taskbar/main.qml b/tests/manual/taskbar/main.qml index 539b827..7c7af2a 100644 --- a/tests/manual/taskbar/main.qml +++ b/tests/manual/taskbar/main.qml @@ -57,9 +57,9 @@ ApplicationWindow { id: taskbar progress.visible: progressBox.checked - progress.minimum: minSpinBox.value - progress.maximum: maxSpinBox.value - progress.value: valueSlider.value + progress.minimum: indeterminateBox.checked ? 0 : minSpinBox.value + progress.maximum: indeterminateBox.checked ? 0 : maxSpinBox.value + progress.value: indeterminateBox.checked ? 0 : valueSlider.value overlayIcon: overlayBox.checked && overlayCombo.currentIndex >= 0 ? overlayModel.get(overlayCombo.currentIndex).source : "" } @@ -107,7 +107,7 @@ ApplicationWindow { Layout.fillWidth: true GridLayout { - columns: 5 + columns: 3 rowSpacing: 10 columnSpacing: 20 anchors.fill: parent @@ -117,21 +117,12 @@ ApplicationWindow { Slider { id: valueSlider - value: 50 + value: 82 stepSize: 1 minimumValue: minSpinBox.value maximumValue: maxSpinBox.value - Layout.columnSpan: 3 - } - - Button { - readonly property string playText: "\u25BA" // BLACK RIGHT-POINTING POINTER - readonly property string pauseText: "\u25AE\u25AE" // BLACK VERTICAL RECTANGLE - - text: taskbar.progress.paused ? playText : pauseText - onClicked: taskbar.progress.paused ? taskbar.progress.resume() : taskbar.progress.pause() - Layout.fillHeight: true - Layout.rowSpan: 2 + enabled: !indeterminateBox.checked + Layout.columnSpan: 2 } Label { text: "Minimum:" } @@ -142,9 +133,21 @@ ApplicationWindow { stepSize: 1 minimumValue: -1000 maximumValue: 1000 + enabled: !indeterminateBox.checked Layout.fillWidth: true } + Button { + readonly property string playSymbol: "\u25BA" // BLACK RIGHT-POINTING POINTER + readonly property string pauseSymbol: "\u25AE\u25AE" // BLACK VERTICAL RECTANGLE + readonly property string stopSymbol: "\u2587" // BLACK SQUARE + + text: taskbar.progress.stopped ? playSymbol : taskbar.progress.paused ? stopSymbol : pauseSymbol + onClicked: taskbar.progress.stopped ? taskbar.progress.resume() : taskbar.progress.paused ? taskbar.progress.stop() : taskbar.progress.pause() + Layout.fillHeight: true + Layout.rowSpan: 3 + } + Label { text: "Maximum:" } SpinBox { id: maxSpinBox @@ -153,8 +156,16 @@ ApplicationWindow { stepSize: 1 minimumValue: -1000 maximumValue: 1000 + enabled: !indeterminateBox.checked Layout.fillWidth: true } + + Item { Layout.fillWidth: true } + + CheckBox { + id: indeterminateBox + text: "Indeterminate" + } } } } |