diff options
author | Axel Spoerl <Axel.Spoerl@qt.io> | 2022-01-12 10:59:32 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-01-18 17:29:11 +0000 |
commit | 5714d89a4dc276b64edcd9bee7168b241489e831 (patch) | |
tree | 094b1378279339190067a7b9ea11f2dfb3fb4969 /tests | |
parent | 90bd3e5ae2c0e4ea4eb1a97b441f3bcac0b2dc20 (diff) |
Add QDial test in tst_baseline_widgets
Task-number: QTBUG-99712
Change-Id: Ib133dd4c1395060be2aac4d3ca1b17eaccc24676
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a620a6bf15da07d66d00bf294a65d0820ce01bcc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/baseline/widgets/tst_baseline_widgets.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/baseline/widgets/tst_baseline_widgets.cpp b/tests/baseline/widgets/tst_baseline_widgets.cpp index 4798c12f68..6a3fb6d56c 100644 --- a/tests/baseline/widgets/tst_baseline_widgets.cpp +++ b/tests/baseline/widgets/tst_baseline_widgets.cpp @@ -49,6 +49,9 @@ private slots: void tst_QSpinBox_data(); void tst_QSpinBox(); + + void tst_QDial_data(); + void tst_QDial(); }; void tst_Widgets::tst_QSlider_data() @@ -213,6 +216,44 @@ void tst_Widgets::tst_QSpinBox() QBASELINE_CHECK(takeSnapshot(), "align_right"); } +void tst_Widgets::tst_QDial_data() +{ + QTest::addColumn<int>("minimum"); + QTest::addColumn<int>("maximum"); + QTest::addColumn<bool>("notchesVisible"); + QTest::addColumn<qreal>("notchTarget"); + + QTest::newRow("0..99_notches") << 0 << 99 << true << 3.7; + QTest::newRow("0..99_noNotches") << 0 << 99 << false << 3.7; + QTest::newRow("1..100_notches") << 1 << 100 << true << 5.7; + QTest::newRow("1..100_noNotches") << 1 << 100 << false << 3.7; + QTest::newRow("1..5_notches") << 1 << 5 << true << 8.7; + QTest::newRow("1..5_noNotches") << 1 << 5 << false << 3.7; +} + +void tst_Widgets::tst_QDial() +{ + QFETCH(int, minimum); + QFETCH(int, maximum); + QFETCH(bool, notchesVisible); + QFETCH(qreal, notchTarget); + + QVERIFY(maximum > minimum); + const int steps = maximum - minimum; + + QDial dial(testWindow()); + dial.setMinimum(minimum); + dial.setMaximum(maximum); + dial.setNotchTarget(notchTarget); + dial.setSliderPosition(minimum + (steps / 2)); + dial.setNotchesVisible(notchesVisible); + + QBoxLayout box(QBoxLayout::LeftToRight); + box.addWidget(&dial); + testWindow()->setLayout(&box); + takeStandardSnapshots(); +} + #define main _realmain QTEST_MAIN(tst_Widgets) #undef main |