diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-02-23 17:01:24 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-02-25 14:16:44 +0000 |
commit | 33403f2c79d678afc5b76add2c517d99b9708c32 (patch) | |
tree | 796fb3e1607a14b9e9e7f00a2e35a326ec083ba6 /tests/auto/widgets | |
parent | 7bbde34ee012bbe90c4ce76736c6f71b16e64215 (diff) |
Fix crash when accessing QStyleHints before QGuiApplication is constructed.
Make styleHints a static member variable of QGuiApplicationPrivate and
fix accessor accordingly. Extend tst_QApplication::settableStyleHints()
to run without QApplication instance as well and add a similar test
to QGuiApplication.
Task-number: QTBUG-44499
Change-Id: I42b92ef38f7dd512d08d70accfa7dd4f09a22f01
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r-- | tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 7e950b33c1..bab3337c0c 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -172,6 +172,7 @@ private slots: void abortQuitOnShow(); + void settableStyleHints_data(); void settableStyleHints(); // Needs to run last as it changes style hints. }; @@ -2298,10 +2299,21 @@ void tst_QApplication::abortQuitOnShow() QCOMPARE(app.exec(), 1); } +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); |