summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-02-24 17:19:40 +0100
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-02-24 21:02:08 +0100
commit34b14a8472f44f8517577756e033b92ebd4c5912 (patch)
tree66a0575156d0a17a835430137e218e2b3f04cc65 /tests/auto/widgets
parentd34353a065c443aac20376cbd88323480d769183 (diff)
parentedd555425a08f9e074f0a4d9333862636ccaae8d (diff)
Merge remote-tracking branch 'origin/5.4' into 5.5
Conflicts: examples/xml/htmlinfo/simpleexample.html examples/xml/rsslisting/rsslisting.cpp qmake/generators/win32/msbuild_objectmodel.cpp src/3rdparty/harfbuzz-ng/src/hb-private.hh src/corelib/global/qlogging.cpp src/corelib/io/qstorageinfo_unix.cpp src/corelib/thread/qwaitcondition_unix.cpp src/gui/kernel/qguiapplication.cpp src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp src/testlib/doc/src/qt-webpages.qdoc tests/auto/other/qaccessibility/tst_qaccessibility.cpp Change-Id: Ib272ff0bc30a1a5d51275eb3cd2f201dc82c11ff
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp11
-rw-r--r--tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp18
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp6
-rw-r--r--tests/auto/widgets/widgets/qsplashscreen/qsplashscreen.pro4
-rw-r--r--tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.cpp78
5 files changed, 112 insertions, 5 deletions
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index 1492dcd6ad..c1027dac18 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -175,6 +175,7 @@ private slots:
void windowFrameMargins();
void QTBUG_6986_sendMouseEventToAlienWidget();
void mapToGlobal();
+ void mapToGlobalWithoutScene();
void QTBUG_43780_visibility();
};
@@ -3690,6 +3691,16 @@ void tst_QGraphicsProxyWidget::mapToGlobal() // QTBUG-41135
.arg(embeddedCenterGlobal.x()).arg(embeddedCenterGlobal.y())));
}
+void tst_QGraphicsProxyWidget::mapToGlobalWithoutScene() // QTBUG-44509
+{
+ QGraphicsProxyWidget proxyWidget;
+ QWidget *embeddedWidget = new QWidget;
+ proxyWidget.setWidget(embeddedWidget);
+ const QPoint localPos(0, 0);
+ const QPoint globalPos = embeddedWidget->mapToGlobal(localPos);
+ QCOMPARE(embeddedWidget->mapFromGlobal(globalPos), localPos);
+}
+
// QTBUG_43780: Embedded widgets have isWindow()==true but showing them should not
// trigger the top-level widget code path of show() that closes all popups
// (for example combo popups).
diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
index d5fea19c41..7f3c289fb4 100644
--- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
+++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
@@ -96,6 +96,7 @@ private slots:
void taskQTBUG_40609_addingWidgetToItsOwnLayout();
void taskQTBUG_40609_addingLayoutToItself();
void replaceWidget();
+ void dontCrashWhenExtendsToEnd();
private:
QWidget *testWidget;
@@ -1728,5 +1729,22 @@ void tst_QGridLayout::replaceWidget()
}
}
+void tst_QGridLayout::dontCrashWhenExtendsToEnd()
+{
+ QWidget window;
+ window.resize(320,200);
+ QWidget parent(&window);
+ QLabel *lbl0 = new QLabel(QLatin1String("lbl0:"));
+ QLabel *lbl1 = new QLabel(QLatin1String("lbl1:"));
+ QPushButton *pb = new QPushButton(QLatin1String("pb1"));
+ QGridLayout *l = new QGridLayout(&parent);
+ l->addWidget(lbl0, 0, 0);
+ l->addWidget(lbl1, 1, 0);
+ // adding an item in the bottom right corner than spans to the end (!)...
+ l->addWidget(pb, 1, 1, -1, -1);
+ // ...should not cause a crash when the items are distributed....
+ l->setGeometry(QRect(0, 0, 200, 50)); // DONT CRASH HERE
+}
+
QTEST_MAIN(tst_QGridLayout)
#include "tst_qgridlayout.moc"
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 587fa250c4..d717f26c52 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -2166,8 +2166,6 @@ public:
void tst_QWidget::resizeEvent()
{
- QSKIP("QTBUG-30744");
-
{
QWidget wParent;
wParent.resize(200, 200);
@@ -3239,7 +3237,7 @@ void tst_QWidget::restoreVersion1Geometry()
widget.showNormal();
QTest::qWait(10);
- if (m_platform == QStringLiteral("xcb") || m_platform == QStringLiteral("windows"))
+ if (m_platform == QStringLiteral("xcb"))
QSKIP("QTBUG-26421");
if (expectedWindowState != Qt::WindowNoState) {
@@ -3680,8 +3678,6 @@ void tst_QWidget::optimizedResizeMove()
void tst_QWidget::optimizedResize_topLevel()
{
- QSKIP("We do not yet have static contents support, see QTBUG-28012");
-
StaticWidget topLevel;
topLevel.gotPaintEvent = false;
topLevel.show();
diff --git a/tests/auto/widgets/widgets/qsplashscreen/qsplashscreen.pro b/tests/auto/widgets/widgets/qsplashscreen/qsplashscreen.pro
new file mode 100644
index 0000000000..0241d69077
--- /dev/null
+++ b/tests/auto/widgets/widgets/qsplashscreen/qsplashscreen.pro
@@ -0,0 +1,4 @@
+CONFIG += testcase
+TARGET = tst_qsplashscreen
+QT += widgets testlib
+SOURCES += tst_qsplashscreen.cpp
diff --git a/tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.cpp b/tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.cpp
new file mode 100644
index 0000000000..f9632a5974
--- /dev/null
+++ b/tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.cpp
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** 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.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** 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 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
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** 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$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+#include <QSplashScreen>
+
+class tst_QSplashScreen : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void checkCloseTime();
+};
+
+class CloseEventSplash : public QSplashScreen
+{
+public:
+ CloseEventSplash(const QPixmap &pix) : QSplashScreen(pix), receivedCloseEvent(false) {}
+ bool receivedCloseEvent;
+protected:
+ void closeEvent(QCloseEvent *event)
+ {
+ receivedCloseEvent = true;
+ QSplashScreen::closeEvent(event);
+ }
+};
+
+void tst_QSplashScreen::checkCloseTime()
+{
+ QPixmap pix(100, 100);
+ pix.fill(Qt::red);
+ CloseEventSplash splash(pix);
+ QVERIFY(!splash.receivedCloseEvent);
+ QWidget w;
+ splash.show();
+ QTimer::singleShot(500, &w, SLOT(show()));
+ QVERIFY(!splash.receivedCloseEvent);
+ splash.finish(&w);
+ QVERIFY(splash.receivedCloseEvent);
+ // We check the window handle because if this is not valid, then
+ // it can't have been exposed
+ QVERIFY(w.windowHandle());
+ QVERIFY(w.windowHandle()->isExposed());
+}
+
+QTEST_MAIN(tst_QSplashScreen)
+#include "tst_qsplashscreen.moc"