summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2023-11-12 13:49:16 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2023-11-12 23:45:30 +0100
commite4315204b1412d74842b3167c3eb9a49dc233355 (patch)
tree290f40c7f146ec60fe296d92285a511b32650b93 /tests/auto/widgets/widgets
parentc1d389a132d291fb404bef11de3c1b45dbfa2afc (diff)
QDial: don't crash when min==max and setting a value != min & max
QDial::bound() is crashing when min == max due to a division by zero. Therefore check for this condition beforehand and return min. Pick-to: 6.6 6.5 6.2 5.15 Fixes: QTBUG-104641 Change-Id: I612625af1ad18333d59a7771abfdec602301b58e Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Diffstat (limited to 'tests/auto/widgets/widgets')
-rw-r--r--tests/auto/widgets/widgets/qdial/tst_qdial.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/widgets/widgets/qdial/tst_qdial.cpp b/tests/auto/widgets/widgets/qdial/tst_qdial.cpp
index 1d8c970ef4..ebdbe3645e 100644
--- a/tests/auto/widgets/widgets/qdial/tst_qdial.cpp
+++ b/tests/auto/widgets/widgets/qdial/tst_qdial.cpp
@@ -17,6 +17,7 @@ private slots:
void valueChanged();
void sliderMoved();
void wrappingCheck();
+ void minEqualMaxValueOutsideRange();
void notchSize_data();
void notchSize();
@@ -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