From 8fb881900c7bb7895e7a2109a7dc880954bcf3a9 Mon Sep 17 00:00:00 2001 From: Harald Hvaal Date: Sat, 28 Mar 2015 21:03:29 +0100 Subject: Enable checking for whether the system palette was explicitly set In order to obey a palette set globally on QApplication, an application attribute for checking if it's set at all is added. Task-number: QTBUG-39800 Change-Id: I26b965e6e18e0e1ca4df03cf343b3527df3636b2 Reviewed-by: J-P Nurmi Reviewed-by: Friedemann Kleint --- .../gui/kernel/qguiapplication/tst_qguiapplication.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/auto/gui/kernel') diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp index b921e1519f..19365bffdd 100644 --- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -76,6 +76,7 @@ private slots: void genericPluginsAndWindowSystemEvents(); void layoutDirection(); void globalShareContext(); + void testSetPaletteAttribute(); void staticFunctions(); @@ -968,6 +969,22 @@ void tst_QGuiApplication::globalShareContext() #endif } +void tst_QGuiApplication::testSetPaletteAttribute() +{ + QCoreApplication::setAttribute(Qt::AA_SetPalette, false); + int argc = 1; + char *argv[] = { const_cast("tst_qguiapplication") }; + + QGuiApplication app(argc, argv); + + QVERIFY(!QCoreApplication::testAttribute(Qt::AA_SetPalette)); + QPalette palette; + palette.setColor(QPalette::Foreground, Qt::red); + QGuiApplication::setPalette(palette); + + QVERIFY(QCoreApplication::testAttribute(Qt::AA_SetPalette)); +} + // Test that static functions do not crash if there is no application instance. void tst_QGuiApplication::staticFunctions() { -- cgit v1.2.3