diff options
Diffstat (limited to 'tests/auto/widgets/widgets/qdial')
-rw-r--r-- | tests/auto/widgets/widgets/qdial/CMakeLists.txt | 11 | ||||
-rw-r--r-- | tests/auto/widgets/widgets/qdial/tst_qdial.cpp | 28 |
2 files changed, 28 insertions, 11 deletions
diff --git a/tests/auto/widgets/widgets/qdial/CMakeLists.txt b/tests/auto/widgets/widgets/qdial/CMakeLists.txt index e76cc4a7db..5e300eec94 100644 --- a/tests/auto/widgets/widgets/qdial/CMakeLists.txt +++ b/tests/auto/widgets/widgets/qdial/CMakeLists.txt @@ -1,13 +1,20 @@ -# Generated from qdial.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## tst_qdial Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qdial LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qdial SOURCES tst_qdial.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::Gui Qt::Widgets ) diff --git a/tests/auto/widgets/widgets/qdial/tst_qdial.cpp b/tests/auto/widgets/widgets/qdial/tst_qdial.cpp index 3008714576..d0274ace2a 100644 --- a/tests/auto/widgets/widgets/qdial/tst_qdial.cpp +++ b/tests/auto/widgets/widgets/qdial/tst_qdial.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> @@ -17,6 +17,7 @@ private slots: void valueChanged(); void sliderMoved(); void wrappingCheck(); + void minEqualMaxValueOutsideRange(); void notchSize_data(); void notchSize(); @@ -52,14 +53,14 @@ void tst_QDial::valueChanged() dial.setMaximum(100); QSignalSpy spy(&dial, SIGNAL(valueChanged(int))); dial.setValue(50); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); dial.setValue(25); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); // repeat! dial.setValue(25); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_QDial::sliderMoved() @@ -88,8 +89,8 @@ void tst_QDial::sliderMoved() QMouseEvent moveevent(QEvent::MouseMove, init, dial.mapToGlobal(init), Qt::LeftButton, Qt::LeftButton, {}); qApp->sendEvent(&dial, &moveevent); - QCOMPARE( sliderspy.count(), 1); - QCOMPARE( valuespy.count(), 0); + QCOMPARE( sliderspy.size(), 1); + QCOMPARE( valuespy.size(), 0); } @@ -98,14 +99,14 @@ void tst_QDial::sliderMoved() QMouseEvent moveevent(QEvent::MouseMove, init, dial.mapToGlobal(init), Qt::LeftButton, Qt::LeftButton, {}); qApp->sendEvent(&dial, &moveevent); - QCOMPARE( sliderspy.count(), 2); - QCOMPARE( valuespy.count(), 0); + QCOMPARE( sliderspy.size(), 2); + QCOMPARE( valuespy.size(), 0); } QMouseEvent releaseevent(QEvent::MouseButtonRelease, init, dial.mapToGlobal(init), Qt::LeftButton, Qt::LeftButton, {}); qApp->sendEvent(&dial, &releaseevent); - QCOMPARE( valuespy.count(), 1); // valuechanged signal should be called at this point + QCOMPARE( valuespy.size(), 1); // valuechanged signal should be called at this point } @@ -172,6 +173,15 @@ void tst_QDial::wrappingCheck() } } +// QTBUG-104641 +void tst_QDial::minEqualMaxValueOutsideRange() +{ + QDial dial; + dial.setRange(30, 30); + dial.setWrapping(true); + dial.setValue(45); +} + /* Verify that the notchSizes calculated don't change compared to Qt 5.15 results for dial sizes at the edge values of the |