diff options
Diffstat (limited to 'tests/auto/widgets/kernel/qapplication')
6 files changed, 96 insertions, 59 deletions
diff --git a/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/main.cpp b/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/main.cpp index 32a39d00a5..f647d877c5 100644 --- a/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/main.cpp +++ b/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/main.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$ diff --git a/tests/auto/widgets/kernel/qapplication/modal/base.cpp b/tests/auto/widgets/kernel/qapplication/modal/base.cpp index 83fc9b8b2d..d6e0c48509 100644 --- a/tests/auto/widgets/kernel/qapplication/modal/base.cpp +++ b/tests/auto/widgets/kernel/qapplication/modal/base.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$ diff --git a/tests/auto/widgets/kernel/qapplication/modal/base.h b/tests/auto/widgets/kernel/qapplication/modal/base.h index c976327d99..0baef451b8 100644 --- a/tests/auto/widgets/kernel/qapplication/modal/base.h +++ b/tests/auto/widgets/kernel/qapplication/modal/base.h @@ -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$ diff --git a/tests/auto/widgets/kernel/qapplication/modal/main.cpp b/tests/auto/widgets/kernel/qapplication/modal/main.cpp index e3deaddfc6..c29378030a 100644 --- a/tests/auto/widgets/kernel/qapplication/modal/main.cpp +++ b/tests/auto/widgets/kernel/qapplication/modal/main.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$ diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index ab08df22dc..c9a1a64135 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.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$ @@ -149,7 +149,9 @@ private slots: void execAfterExit(); +#ifndef QT_NO_WHEELEVENT void wheelScrollLines(); +#endif void task109149(); @@ -172,6 +174,9 @@ private slots: void abortQuitOnShow(); + void staticFunctions(); + + void settableStyleHints_data(); void settableStyleHints(); // Needs to run last as it changes style hints. }; @@ -1841,6 +1846,7 @@ void tst_QApplication::execAfterExit() QCOMPARE(exitCode, 0); } +#ifndef QT_NO_WHEELEVENT void tst_QApplication::wheelScrollLines() { int argc = 1; @@ -1848,6 +1854,7 @@ void tst_QApplication::wheelScrollLines() // If wheelScrollLines returns 0, the mose wheel will be disabled. QVERIFY(app.wheelScrollLines() > 0); } +#endif // !QT_NO_WHEELEVENT void tst_QApplication::style() { @@ -2006,9 +2013,6 @@ void tst_QApplication::touchEventPropagation() int argc = 1; QApplication app(argc, &argv0); - const bool mouseEventSynthesizing = QGuiApplicationPrivate::platformIntegration() - ->styleHint(QPlatformIntegration::SynthesizeMouseFromTouchEvents).toBool(); - QList<QTouchEvent::TouchPoint> pressedTouchPoints; QTouchEvent::TouchPoint press(0); press.setState(Qt::TouchPointPressed); @@ -2047,7 +2051,7 @@ void tst_QApplication::touchEventPropagation() touchPointList(releasedTouchPoints)); QCoreApplication::processEvents(); QVERIFY(!window.seenTouchEvent); - QCOMPARE(window.seenMouseEvent, mouseEventSynthesizing); // QApplication may transform ignored touch events in mouse events + QVERIFY(window.seenMouseEvent); // QApplication may transform ignored touch events in mouse events window.reset(); window.setAttribute(Qt::WA_AcceptTouchEvents); @@ -2061,7 +2065,7 @@ void tst_QApplication::touchEventPropagation() touchPointList(releasedTouchPoints)); QCoreApplication::processEvents(); QVERIFY(window.seenTouchEvent); - QCOMPARE(window.seenMouseEvent, mouseEventSynthesizing); + QVERIFY(window.seenMouseEvent); window.reset(); window.acceptTouchEvent = true; @@ -2100,9 +2104,9 @@ void tst_QApplication::touchEventPropagation() touchPointList(releasedTouchPoints)); QCoreApplication::processEvents(); QVERIFY(!widget.seenTouchEvent); - QCOMPARE(widget.seenMouseEvent, mouseEventSynthesizing); + QVERIFY(widget.seenMouseEvent); QVERIFY(!window.seenTouchEvent); - QCOMPARE(window.seenMouseEvent, mouseEventSynthesizing); + QVERIFY(window.seenMouseEvent); window.reset(); widget.reset(); @@ -2117,9 +2121,9 @@ void tst_QApplication::touchEventPropagation() touchPointList(releasedTouchPoints)); QCoreApplication::processEvents(); QVERIFY(widget.seenTouchEvent); - QCOMPARE(widget.seenMouseEvent, mouseEventSynthesizing); + QVERIFY(widget.seenMouseEvent); QVERIFY(!window.seenTouchEvent); - QCOMPARE(window.seenMouseEvent, mouseEventSynthesizing); + QVERIFY(window.seenMouseEvent); window.reset(); widget.reset(); @@ -2134,7 +2138,7 @@ void tst_QApplication::touchEventPropagation() touchPointList(releasedTouchPoints)); QCoreApplication::processEvents(); QVERIFY(widget.seenTouchEvent); - QCOMPARE(widget.seenMouseEvent, mouseEventSynthesizing); + QVERIFY(widget.seenMouseEvent); QVERIFY(!window.seenTouchEvent); QVERIFY(!window.seenMouseEvent); @@ -2169,9 +2173,9 @@ void tst_QApplication::touchEventPropagation() touchPointList(releasedTouchPoints)); QCoreApplication::processEvents(); QVERIFY(!widget.seenTouchEvent); - QCOMPARE(widget.seenMouseEvent, mouseEventSynthesizing); + QVERIFY(widget.seenMouseEvent); QVERIFY(window.seenTouchEvent); - QCOMPARE(window.seenMouseEvent, mouseEventSynthesizing); + QVERIFY(window.seenMouseEvent); window.reset(); widget.reset(); @@ -2186,13 +2190,13 @@ void tst_QApplication::touchEventPropagation() touchPointList(releasedTouchPoints)); QCoreApplication::processEvents(); QVERIFY(!widget.seenTouchEvent); - QCOMPARE(widget.seenMouseEvent, mouseEventSynthesizing); + QVERIFY(!widget.seenMouseEvent); QVERIFY(window.seenTouchEvent); QVERIFY(!window.seenMouseEvent); window.reset(); widget.reset(); - widget.acceptMouseEvent = true; // it matters, touch events are propagated in parallel to synthesized mouse events + widget.acceptMouseEvent = true; // doesn't matter, touch events are propagated first window.acceptTouchEvent = true; QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, @@ -2204,8 +2208,8 @@ void tst_QApplication::touchEventPropagation() touchPointList(releasedTouchPoints)); QCoreApplication::processEvents(); QVERIFY(!widget.seenTouchEvent); - QCOMPARE(widget.seenMouseEvent, mouseEventSynthesizing); - QCOMPARE(!window.seenTouchEvent, mouseEventSynthesizing); + QVERIFY(!widget.seenMouseEvent); + QVERIFY(window.seenTouchEvent); QVERIFY(!window.seenMouseEvent); } } @@ -2301,10 +2305,43 @@ void tst_QApplication::abortQuitOnShow() QCOMPARE(app.exec(), 1); } +// Test that static functions do not crash if there is no application instance. +void tst_QApplication::staticFunctions() +{ + QApplication::setStyle(QStringLiteral("blub")); + QApplication::colorSpec(); + QApplication::setColorSpec(42); + QApplication::allWidgets(); + QApplication::topLevelWidgets(); + QApplication::desktop(); + QApplication::activePopupWidget(); + QApplication::activeModalWidget(); + QApplication::focusWidget(); + QApplication::activeWindow(); + QApplication::setActiveWindow(Q_NULLPTR); + QApplication::widgetAt(QPoint(0, 0)); + QApplication::topLevelAt(QPoint(0, 0)); + QApplication::setGlobalStrut(QSize(0, 0)); + QApplication::globalStrut(); + QApplication::isEffectEnabled(Qt::UI_General); + QApplication::setEffectEnabled(Qt::UI_General, false); +} + +void tst_QApplication::settableStyleHints_data() +{ + QTest::addColumn<bool>("appInstance"); + QTest::newRow("app") << true; + QTest::newRow("no-app") << false; +} + void tst_QApplication::settableStyleHints() { + QFETCH(bool, appInstance); int argc = 0; - QApplication app(argc, 0); + QScopedPointer<QApplication> app; + if (appInstance) + app.reset(new QApplication(argc, 0)); + QApplication::setCursorFlashTime(437); QCOMPARE(QApplication::cursorFlashTime(), 437); QApplication::setDoubleClickInterval(128); diff --git a/tests/auto/widgets/kernel/qapplication/wincmdline/main.cpp b/tests/auto/widgets/kernel/qapplication/wincmdline/main.cpp index ccb60dc237..2d86b46875 100644 --- a/tests/auto/widgets/kernel/qapplication/wincmdline/main.cpp +++ b/tests/auto/widgets/kernel/qapplication/wincmdline/main.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$ |