|
@@ -20,6 +20,7 @@
|
|
|
|
|
|
// Qt includes
|
|
|
#include <QApplication>
|
|
|
+#include <QCleanlooksStyle>
|
|
|
#include <QString>
|
|
|
#include <QStyle>
|
|
|
#include <QStyleOptionSlider>
|
|
@@ -34,6 +35,7 @@ class ctkRangeSliderTester: public QObject
|
|
|
{
|
|
|
Q_OBJECT
|
|
|
private slots:
|
|
|
+ void initTestCase();
|
|
|
void testGUIEvents();
|
|
|
void testTooltips();
|
|
|
|
|
@@ -47,6 +49,13 @@ private slots:
|
|
|
};
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
+void ctkRangeSliderTester::initTestCase()
|
|
|
+{
|
|
|
+ // Mouse position on handles does not with with gtk style.
|
|
|
+ QApplication::setStyle(new QCleanlooksStyle());
|
|
|
+}
|
|
|
+
|
|
|
+// ----------------------------------------------------------------------------
|
|
|
void ctkRangeSliderTester::testGUIEvents()
|
|
|
{
|
|
|
ctkRangeSlider rangeSlider;
|
|
@@ -149,6 +158,9 @@ void ctkRangeSliderTester::testHandleMouseEvents()
|
|
|
QStyle::CC_Slider, &option, QStyle::SC_SliderHandle, &rangeSlider );
|
|
|
rangeSlider.resize(100 + sliderHandleSize.width(), 20);
|
|
|
|
|
|
+ rangeSlider.show();
|
|
|
+ QTest::qWaitForWindowShown(&rangeSlider);
|
|
|
+
|
|
|
QFETCH(bool, minHandle);
|
|
|
QFETCH(bool, symmetricMoves);
|
|
|
QFETCH(int, moveInPx);
|
|
@@ -168,6 +180,9 @@ void ctkRangeSliderTester::testHandleMouseEvents()
|
|
|
|
|
|
QTest::mouseMove(&rangeSlider, currentCursorPos);
|
|
|
QTest::mousePress(&rangeSlider, Qt::LeftButton, 0, currentCursorPos);
|
|
|
+ const bool isHandleDown = minHandle ? rangeSlider.isMinimumSliderDown() :
|
|
|
+ rangeSlider.isMaximumSliderDown();
|
|
|
+ QVERIFY(isHandleDown);
|
|
|
currentCursorPos += QPoint(moveInPx, 0);
|
|
|
ctkTest::mouseMove(&rangeSlider, Qt::LeftButton, 0, currentCursorPos);
|
|
|
QTest::mouseRelease(&rangeSlider, Qt::LeftButton, 0, currentCursorPos);
|