diff options
Diffstat (limited to 'tests/auto/declarative/qmlsystempalette/tst_qmlsystempalette.cpp')
-rw-r--r-- | tests/auto/declarative/qmlsystempalette/tst_qmlsystempalette.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlsystempalette/tst_qmlsystempalette.cpp b/tests/auto/declarative/qmlsystempalette/tst_qmlsystempalette.cpp index 039eaa8..2648463 100644 --- a/tests/auto/declarative/qmlsystempalette/tst_qmlsystempalette.cpp +++ b/tests/auto/declarative/qmlsystempalette/tst_qmlsystempalette.cpp @@ -38,7 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + #include <qtest.h> +#include <QDebug> #include <QtDeclarative/qmlengine.h> #include <QtDeclarative/qmlcomponent.h> #include <private/qmlsystempalette_p.h> @@ -56,6 +58,7 @@ private slots: void activePalette(); void inactivePalette(); void disabledPalette(); + void paletteChanged(); private: QmlEngine engine; @@ -149,6 +152,30 @@ void tst_qmlsystempalette::disabledPalette() delete object; } +void tst_qmlsystempalette::paletteChanged() +{ + QString componentStr = "import Qt 4.6\nSystemPalette { }"; + QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlSystemPalette *object = qobject_cast<QmlSystemPalette*>(component.create()); + + QVERIFY(object != 0); + + QPalette p; + p.setCurrentColorGroup(QPalette::Active); + p.setColor(QPalette::Active, QPalette::Text, QColor("red")); + p.setColor(QPalette::Active, QPalette::ButtonText, QColor("green")); + p.setColor(QPalette::Active, QPalette::WindowText, QColor("blue")); + + qApp->setPalette(p); + + object->setColorGroup(QmlSystemPalette::Active); + QTRY_COMPARE(QColor("red"), object->text()); + QTRY_COMPARE(QColor("green"), object->buttonText()); + QTRY_COMPARE(QColor("blue"), object->windowText()); + + delete object; +} + QTEST_MAIN(tst_qmlsystempalette) #include "tst_qmlsystempalette.moc" |