summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/kernel
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-09-29 00:38:01 +0200
committerLiang Qi <liang.qi@qt.io>2016-09-29 00:38:01 +0200
commitcdb56c42fc1145ad25560720fb95df2bfa760a20 (patch)
tree4dbe524a511b9343464e8509bd5352715aebdfa9 /tests/auto/widgets/kernel
parent87583738f960e83918da3b66e455e75c144fbf8e (diff)
parente918334045612ec2c7c6203845ad05c4a1972e87 (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts: mkspecs/features/uikit/xcodebuild.mk tests/auto/other/lancelot/tst_lancelot.cpp tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp Change-Id: Ia0ae2de86094120281abd445138877c2cc3e882c
Diffstat (limited to 'tests/auto/widgets/kernel')
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp25
-rw-r--r--tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp4
-rw-r--r--tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp8
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp10
4 files changed, 17 insertions, 30 deletions
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index eda51e31a9..411b925adb 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -1715,25 +1715,6 @@ void tst_QApplication::focusOut()
QTest::qWait(2000);
}
-class SpontaneousEvent
-{
- Q_GADGET
- QDOC_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
- Q_ENUMS(Type)
-public:
- enum Type {
- Void
- };
-
- virtual ~SpontaneousEvent() {}
-
- QEventPrivate *d;
- ushort t;
-
- ushort posted : 1;
- ushort spont : 1;
-};
-
void tst_QApplication::focusMouseClick()
{
int argc = 1;
@@ -1751,14 +1732,14 @@ void tst_QApplication::focusMouseClick()
// now send a mouse button press event and check what happens with the focus
// it should be given to the parent widget
QMouseEvent ev(QEvent::MouseButtonPress, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
- reinterpret_cast<SpontaneousEvent *>(&ev)->spont = 1;
+ QSpontaneKeyEvent::setSpontaneous(&ev);
QVERIFY(ev.spontaneous());
qApp->notify(&w2, &ev);
QCOMPARE(QApplication::focusWidget(), &w);
// then we give the inner widget strong focus -> it should get focus
w2.setFocusPolicy(Qt::StrongFocus);
- reinterpret_cast<SpontaneousEvent *>(&ev)->spont = 1;
+ QSpontaneKeyEvent::setSpontaneous(&ev);
QVERIFY(ev.spontaneous());
qApp->notify(&w2, &ev);
QTRY_COMPARE(QApplication::focusWidget(), &w2);
@@ -1766,7 +1747,7 @@ void tst_QApplication::focusMouseClick()
// now back to tab focus and click again (it already had focus) -> focus should stay
// (focus was revoked as of QTBUG-34042)
w2.setFocusPolicy(Qt::TabFocus);
- reinterpret_cast<SpontaneousEvent *>(&ev)->spont = 1;
+ QSpontaneKeyEvent::setSpontaneous(&ev);
QVERIFY(ev.spontaneous());
qApp->notify(&w2, &ev);
QCOMPARE(QApplication::focusWidget(), &w2);
diff --git a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
index e87598617a..0b35db1b5f 100644
--- a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
+++ b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
@@ -183,7 +183,7 @@ void tst_QBoxLayout::sizeConstraints()
window.show();
QTest::qWaitForWindowExposed(&window);
QSize sh = window.sizeHint();
- lay->takeAt(1);
+ delete lay->takeAt(1);
QVERIFY(sh.width() >= window.sizeHint().width() &&
sh.height() >= window.sizeHint().height());
@@ -512,7 +512,7 @@ void tst_QBoxLayout::replaceWidget()
QCOMPARE(boxLayout->indexOf(replaceFrom), 1);
QCOMPARE(boxLayout->indexOf(replaceTo), -1);
- boxLayout->replaceWidget(replaceFrom, replaceTo);
+ delete boxLayout->replaceWidget(replaceFrom, replaceTo);
QCOMPARE(boxLayout->indexOf(replaceFrom), -1);
QCOMPARE(boxLayout->indexOf(replaceTo), 1);
diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
index 3c4c1a1d41..c1ab5f51be 100644
--- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
+++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
@@ -341,6 +341,8 @@ void tst_QGridLayout::setMinAndMaxSize()
layout.removeItem(spacer);
+ delete spacer;
+ spacer = Q_NULLPTR;
rightChild.hide();
QApplication::sendPostedEvents(0, 0);
@@ -1577,10 +1579,10 @@ void tst_QGridLayout::contentsRect()
void tst_QGridLayout::distributeMultiCell()
{
QWidget w;
- Qt42Style *style = new Qt42Style();
- style->spacing = 9;
+ Qt42Style style;
+ style.spacing = 9;
- w.setStyle(style);
+ w.setStyle(&style);
QGridLayout grid;
w.setLayout(&grid);
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index eaa4c8a636..5f3fed1f66 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -4997,7 +4997,8 @@ void tst_QWidget::moveChild()
ColorWidget parent(0, Qt::Window | Qt::WindowStaysOnTopHint);
// prevent custom styles
- parent.setStyle(QStyleFactory::create(QLatin1String("Windows")));
+ const QScopedPointer<QStyle> style(QStyleFactory::create(QLatin1String("Windows")));
+ parent.setStyle(style.data());
ColorWidget child(&parent, Qt::Widget, Qt::blue);
parent.setGeometry(QRect(QPoint(QApplication::desktop()->availableGeometry(&parent).topLeft()) + QPoint(50, 50),
@@ -5042,7 +5043,8 @@ void tst_QWidget::showAndMoveChild()
QSKIP("Wayland: This fails. Figure out why.");
QWidget parent(0, Qt::Window | Qt::WindowStaysOnTopHint);
// prevent custom styles
- parent.setStyle(QStyleFactory::create(QLatin1String("Windows")));
+ const QScopedPointer<QStyle> style(QStyleFactory::create(QLatin1String("Windows")));
+ parent.setStyle(style.data());
QDesktopWidget desktop;
QRect desktopDimensions = desktop.availableGeometry(&parent);
@@ -6542,7 +6544,9 @@ void tst_QWidget::renderWithPainter()
{
QWidget widget(0, Qt::Tool);
// prevent custom styles
- widget.setStyle(QStyleFactory::create(QLatin1String("Windows")));
+
+ const QScopedPointer<QStyle> style(QStyleFactory::create(QLatin1String("Windows")));
+ widget.setStyle(style.data());
widget.show();
widget.resize(70, 50);
widget.setAutoFillBackground(true);