summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-10-01 22:15:55 +0200
committerLiang Qi <liang.qi@qt.io>2016-10-01 22:15:55 +0200
commit3e949b75fd298a30fa4e8b281ecf21fcb038efbe (patch)
tree592bb2d6ca846a9d3aee66bc829d21ae8ba8c056 /tests/auto/widgets
parent4518345b80b0ee1101ecb0e7349728abd237aa6e (diff)
parentd2b4a789c39eb770068b002d2bc9ceb764dedf3d (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: mkspecs/features/mac/default_pre.prf mkspecs/macx-ios-clang/features/resolve_config.prf qtbase.pro Change-Id: I65b5ebca4942a4f295bdd4ac1568e5c347333aea
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp6
-rw-r--r--tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp48
2 files changed, 26 insertions, 28 deletions
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
index a107260d23..a506bbb114 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -490,12 +490,12 @@ void tst_QStyleSheetStyle::widgetStyle()
window1->setStyleSheet(""); // remove stylesheet
QCOMPARE(window1->style(), qApp->style()); // is this cool or what
QCOMPARE(widget1->style(), qApp->style()); // annoying child follows...
- QStyle *wndStyle = QStyleFactory::create("Windows");
- window1->setStyle(wndStyle);
+ QScopedPointer<QStyle> wndStyle(QStyleFactory::create("Windows"));
+ window1->setStyle(wndStyle.data());
QCOMPARE(window1->style()->metaObject()->className(), "QStyleSheetStyle"); // auto wraps it
QCOMPARE(widget1->style(), window1->style()); // and auto propagates to child
qApp->setStyleSheet(""); // remove the app stylesheet
- QCOMPARE(window1->style(), wndStyle); // auto dewrap
+ QCOMPARE(window1->style(), wndStyle.data()); // auto dewrap
QCOMPARE(widget1->style(), qApp->style()); // and child state is restored
window1->setStyle(0); // let sanity prevail
qApp->setStyle(0);
diff --git a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp
index e68463a00e..17a5320433 100644
--- a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp
+++ b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp
@@ -702,8 +702,8 @@ void tst_QAbstractSlider::wheelEvent_data()
QTest::addColumn<int>("wheelScrollLines");
QTest::addColumn<bool>("withModifiers"); // use keyboard modifiers while scrolling? (CTRL and SHIFT)
QTest::addColumn<int>("deltaMultiple"); // multiples of WHEEL_DELTA
- QTest::addColumn<int>("sliderOrientation");
- QTest::addColumn<int>("wheelOrientation");
+ QTest::addColumn<Qt::Orientation>("sliderOrientation");
+ QTest::addColumn<Qt::Orientation>("wheelOrientation");
QTest::addColumn<int>("expectedSliderPosition");
QTest::addColumn<QPoint>("distanceFromBottomRight"); // mpointer's distance from bottom-right corner of widget
@@ -716,8 +716,8 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 20 // wheel scroll lines
<< false // with modifiers
<< 1 // delta
- << int(Qt::Vertical) // orientation of slider
- << int(Qt::Vertical) // orientation of wheel
+ << Qt::Vertical // orientation of slider
+ << Qt::Vertical // orientation of wheel
<< 20 // expected position after
<< QPoint(0,0);
@@ -730,8 +730,8 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 20 // wheel scroll lines
<< false // with modifiers
<< 1 // delta
- << int(Qt::Vertical) // orientation of slider
- << int(Qt::Vertical) // orientation of wheel
+ << Qt::Vertical // orientation of slider
+ << Qt::Vertical // orientation of wheel
#ifndef Q_OS_MAC
<< 1 // expected position after
#else
@@ -748,8 +748,8 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 20 // wheel scroll lines
<< false // with modifiers
<< 1 // delta
- << int(Qt::Horizontal) // orientation of slider
- << int(Qt::Vertical) // orientation of wheel
+ << Qt::Horizontal // orientation of slider
+ << Qt::Vertical // orientation of wheel
#ifndef Q_OS_MAC
<< 1 // expected position after
#else
@@ -767,8 +767,8 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 20 // wheel scroll lines
<< false // with modifiers
<< 1 // delta
- << int(Qt::Horizontal) // orientation of slider
- << int(Qt::Vertical) // orientation of wheel
+ << Qt::Horizontal // orientation of slider
+ << Qt::Vertical // orientation of wheel
#ifndef Q_OS_MAC
<< 1 // expected position after
#else
@@ -786,8 +786,8 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 20 // wheel scroll lines
<< false // with modifiers
<< -1 // delta
- << int(Qt::Horizontal) // orientation of slider
- << int(Qt::Horizontal) // orientation of wheel
+ << Qt::Horizontal // orientation of slider
+ << Qt::Horizontal // orientation of wheel
<< 30 // expected position after
<< QPoint(1,1);
@@ -800,8 +800,8 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 1 // wheel scroll lines
<< false // with modifiers
<< -2 // delta
- << int(Qt::Horizontal) // orientation of slider
- << int(Qt::Horizontal) // orientation of wheel
+ << Qt::Horizontal // orientation of slider
+ << Qt::Horizontal // orientation of wheel
<< 100 // expected position after
<< QPoint(0,0);
@@ -814,8 +814,8 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 1 // wheel scroll lines
<< false // with modifiers
<< 2 // delta
- << int(Qt::Horizontal) // orientation of slider
- << int(Qt::Horizontal) // orientation of wheel
+ << Qt::Horizontal // orientation of slider
+ << Qt::Horizontal // orientation of wheel
<< 0 // expected position after
<< QPoint(0,0);
@@ -828,8 +828,8 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 20 // wheel scroll lines
<< true // with modifiers
<< -1 // delta
- << int(Qt::Horizontal) // orientation of slider
- << int(Qt::Horizontal) // orientation of wheel
+ << Qt::Horizontal // orientation of slider
+ << Qt::Horizontal // orientation of wheel
<< 90 // expected position after
<< QPoint(0,0);
@@ -846,8 +846,8 @@ void tst_QAbstractSlider::wheelEvent()
QFETCH(int,wheelScrollLines);
QFETCH(bool,withModifiers);
QFETCH(int,deltaMultiple);
- QFETCH(int,sliderOrientation);
- QFETCH(int,wheelOrientation);
+ QFETCH(Qt::Orientation, sliderOrientation);
+ QFETCH(Qt::Orientation, wheelOrientation);
QFETCH(int,expectedSliderPosition);
QFETCH(QPoint,distanceFromBottomRight);
@@ -855,18 +855,16 @@ void tst_QAbstractSlider::wheelEvent()
QVERIFY(applicationInstance != 0);
QApplication::setWheelScrollLines(wheelScrollLines);
- Qt::Orientation orientation = *reinterpret_cast<Qt::Orientation*>(&sliderOrientation);
slider->setRange(minimum,maximum);
slider->setSliderPosition(initialSliderPosition);
slider->setSingleStep(singleStep);
slider->setPageStep(pageStep);
slider->setInvertedControls(invertedControls);
- slider->setOrientation(orientation);
+ slider->setOrientation(sliderOrientation);
Qt::KeyboardModifier k = withModifiers ? Qt::ControlModifier : Qt::NoModifier;
- orientation = *reinterpret_cast<Qt::Orientation*>(&wheelOrientation);
QWheelEvent event(slider->rect().bottomRight() + distanceFromBottomRight, WHEEL_DELTA * deltaMultiple,
- Qt::NoButton, k, orientation);
+ Qt::NoButton, k, wheelOrientation);
QVERIFY(applicationInstance->sendEvent(slider,&event));
#ifdef Q_OS_MAC
QEXPECT_FAIL("Normal data page", "QTBUG-23679", Continue);
@@ -878,7 +876,7 @@ void tst_QAbstractSlider::wheelEvent()
slider->setSliderPosition(initialSliderPosition);
k = withModifiers ? Qt::ShiftModifier : Qt::NoModifier;
event = QWheelEvent(slider->rect().bottomRight() + distanceFromBottomRight, WHEEL_DELTA * deltaMultiple,
- Qt::NoButton, k, orientation);
+ Qt::NoButton, k, wheelOrientation);
QSignalSpy spy1(slider, SIGNAL(actionTriggered(int)));
QSignalSpy spy2(slider, SIGNAL(valueChanged(int)));
QVERIFY(applicationInstance->sendEvent(slider,&event));