diff options
Diffstat (limited to 'tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp')
-rw-r--r-- | tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index ae6d62c332..d717f26c52 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -69,6 +69,7 @@ #include <QtWidgets/QGraphicsView> #include <QtWidgets/QGraphicsProxyWidget> #include <QtGui/qwindow.h> +#include <qtimer.h> #include "../../../qtest-config.h" @@ -76,7 +77,7 @@ #include "tst_qwidget_mac_helpers.h" // Abstract the ObjC stuff out so not everyone must run an ObjC++ compile. #endif -#include <QtTest/QtTest> +#include <QtTest/QTest> #ifdef Q_OS_WIN # include <QtCore/qt_windows.h> @@ -446,6 +447,8 @@ private slots: void resizeStaticContentsChildWidget_QTBUG35282(); + void qmlSetParentHelper(); + private: bool ensureScreenSize(int width, int height); QWidget *testWidget; @@ -1495,8 +1498,7 @@ void tst_QWidget::mapFromAndTo() subWindow2->setGeometry(75, 75, 100, 100); subSubWindow->setGeometry(10, 10, 10, 10); -#if !defined(Q_OS_WINCE) && !defined(Q_OS_QNX) \ - || (defined(Q_OS_BLACKBERRY) && !defined(Q_OS_BLACKBERRY_TABLET)) +#if !defined(Q_OS_WINCE) && !defined(Q_OS_QNX) || defined(Q_OS_BLACKBERRY) //update visibility if (windowMinimized) { if (!windowHidden) { @@ -2460,14 +2462,14 @@ void tst_QWidget::hideWhenFocusWidgetIsChild() QSKIP("X11: Your window manager is too broken for this test"); QVERIFY(qApp->focusWidget()); - actualFocusWidget.sprintf("%p %s %s", qApp->focusWidget(), qApp->focusWidget()->objectName().toLatin1().constData(), qApp->focusWidget()->metaObject()->className()); - expectedFocusWidget.sprintf("%p %s %s", edit, edit->objectName().toLatin1().constData(), edit->metaObject()->className()); + actualFocusWidget = QString::asprintf("%p %s %s", qApp->focusWidget(), qApp->focusWidget()->objectName().toLatin1().constData(), qApp->focusWidget()->metaObject()->className()); + expectedFocusWidget = QString::asprintf("%p %s %s", edit, edit->objectName().toLatin1().constData(), edit->metaObject()->className()); QCOMPARE(actualFocusWidget, expectedFocusWidget); parentWidget->hide(); qApp->processEvents(); - actualFocusWidget.sprintf("%p %s %s", qApp->focusWidget(), qApp->focusWidget()->objectName().toLatin1().constData(), qApp->focusWidget()->metaObject()->className()); - expectedFocusWidget.sprintf("%p %s %s", edit2, edit2->objectName().toLatin1().constData(), edit2->metaObject()->className()); + actualFocusWidget = QString::asprintf("%p %s %s", qApp->focusWidget(), qApp->focusWidget()->objectName().toLatin1().constData(), qApp->focusWidget()->metaObject()->className()); + expectedFocusWidget = QString::asprintf("%p %s %s", edit2, edit2->objectName().toLatin1().constData(), edit2->metaObject()->className()); QCOMPARE(actualFocusWidget, expectedFocusWidget); } @@ -7335,7 +7337,7 @@ void tst_QWidget::updateWhileMinimized() { if (m_platform == QStringLiteral("wayland")) QSKIP("Wayland: This fails. Figure out why."); -#if defined(Q_OS_QNX) && (!defined(Q_OS_BLACKBERRY) || defined(Q_OS_BLACKBERRY_TABLET)) +#if defined(Q_OS_QNX) && !defined(Q_OS_BLACKBERRY) QSKIP("Platform does not support showMinimized()"); #endif UpdateWidget widget; @@ -7890,7 +7892,7 @@ void tst_QWidget::doubleRepaint() // Minmize: Should not trigger a repaint. widget.showMinimized(); QTest::qWait(10); -#if defined(Q_OS_QNX) && (!defined(Q_OS_BLACKBERRY) || defined(Q_OS_BLACKBERRY_TABLET)) +#if defined(Q_OS_QNX) && !defined(Q_OS_BLACKBERRY) QEXPECT_FAIL("", "Platform does not support showMinimized()", Continue); #endif QCOMPARE(widget.numPaintEvents, 0); @@ -10414,5 +10416,20 @@ void tst_QWidget::resizeStaticContentsChildWidget_QTBUG35282() msgComparisonFailed(childWidget.numPaintEvents, ">=", 1)); } +void tst_QWidget::qmlSetParentHelper() +{ +#ifdef QT_BUILD_INTERNAL + QWidget parent; + QWidget child; + QVERIFY(QAbstractDeclarativeData::setWidgetParent); + QAbstractDeclarativeData::setWidgetParent(&child, &parent); + QVERIFY(child.parentWidget() == &parent); + QAbstractDeclarativeData::setWidgetParent(&child, 0); + QVERIFY(!child.parentWidget()); +#else + QSKIP("Needs QT_BUILD_INTERNAL"); +#endif +} + QTEST_MAIN(tst_QWidget) #include "tst_qwidget.moc" |