summaryrefslogtreecommitdiffstats
path: root/tests/auto/qabstractslider
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@nokia.com>2010-07-23 10:53:47 +0200
committerHarald Fernengel <harald.fernengel@nokia.com>2010-11-02 15:27:34 +0100
commitd16b01310af4f9f1ec8b82eb883863745a7c9204 (patch)
treeceef1aa31052ab5d4fd41dbe8006b47d94fd6791 /tests/auto/qabstractslider
parent08864c3ec88abf5fdb782ffe972e2576fc703e8c (diff)
Fixed QAbstractSlider autotest to use a dummy toplevel widget
Diffstat (limited to 'tests/auto/qabstractslider')
-rw-r--r--tests/auto/qabstractslider/tst_qabstractslider.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/auto/qabstractslider/tst_qabstractslider.cpp b/tests/auto/qabstractslider/tst_qabstractslider.cpp
index cf069db4fe..cd41d05b9c 100644
--- a/tests/auto/qabstractslider/tst_qabstractslider.cpp
+++ b/tests/auto/qabstractslider/tst_qabstractslider.cpp
@@ -55,6 +55,8 @@
class Slider : public QAbstractSlider
{
public:
+ Slider(QWidget *parent)
+ : QAbstractSlider(parent) {}
using QAbstractSlider::setRepeatAction;
using QAbstractSlider::repeatAction;
};
@@ -95,6 +97,7 @@ private slots:
private:
void waitUntilTimeElapsed(const QTime& t, int ms);
+ QWidget *topLevel;
Slider *slider;
int previousAction;
int reportedMinimum;
@@ -113,7 +116,8 @@ Q_DECLARE_METATYPE(QPoint)
void tst_QAbstractSlider::initTestCase()
{
- slider = new Slider;
+ topLevel = new QWidget;
+ slider = new Slider(topLevel);
slider->setObjectName("testWidget");
slider->resize(100,100);
slider->show();
@@ -129,7 +133,7 @@ void tst_QAbstractSlider::initTestCase()
void tst_QAbstractSlider::cleanupTestCase()
{
- delete slider;
+ delete topLevel;
}
void tst_QAbstractSlider::actionTriggered(int action)
@@ -735,7 +739,6 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 100 // expected position after
#endif
<< QPoint(1,1);
-
QTest::newRow("Different orientation") << 0 // initial position
<< 0 // minimum
<< 100 // maximum
@@ -774,7 +777,6 @@ void tst_QAbstractSlider::wheelEvent_data()
#endif
<< QPoint(0,0);
-
QTest::newRow("Inverted controls") << 50 // initial position
<< 0 // minimum
<< 100 // maximum
@@ -924,6 +926,7 @@ void tst_QAbstractSlider::sliderPressedReleased()
QFETCH(uint, subControl);
QFETCH(int, expectedCount);
+ QWidget topLevel;
QAbstractSlider *slider;
switch (control) {
default:
@@ -931,11 +934,11 @@ void tst_QAbstractSlider::sliderPressedReleased()
return;
break;
case QStyle::CC_Slider:
- slider = new QSlider;
+ slider = new QSlider(&topLevel);
slider->setLayoutDirection(Qt::LeftToRight); // Makes "upside down" much easier to compute
break;
case QStyle::CC_ScrollBar:
- slider = new QScrollBar;
+ slider = new QScrollBar(&topLevel);
break;
}
@@ -949,7 +952,7 @@ void tst_QAbstractSlider::sliderPressedReleased()
QSignalSpy spy2(slider, SIGNAL(sliderReleased()));
// Mac Style requires the control to be active to get the correct values...
- slider->show();
+ topLevel.show();
slider->activateWindow();
QStyleOptionSlider option;