summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/kernel
diff options
context:
space:
mode:
authorHarald Hvaal <harald.hvaal@gmail.com>2015-03-28 21:03:29 +0100
committerHarald Hvaal <harald.hvaal@gmail.com>2015-04-20 06:39:31 +0000
commit8fb881900c7bb7895e7a2109a7dc880954bcf3a9 (patch)
treea2c11493971ee18987960c41e40d61c5204db3cc /tests/auto/gui/kernel
parent6526a4e1367fa134ff29952fcbdd0d7cc937003f (diff)
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 <jpnurmi@theqtcompany.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'tests/auto/gui/kernel')
-rw-r--r--tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp17
1 files changed, 17 insertions, 0 deletions
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<char*>("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()
{