diff options
author | Yann Bodson <yann.bodson@nokia.com> | 2009-11-06 04:25:26 (GMT) |
---|---|---|
committer | Yann Bodson <yann.bodson@nokia.com> | 2009-11-06 04:25:26 (GMT) |
commit | 28b9a4c1bfb6632a10f19bd51528f30205207da0 (patch) | |
tree | d0573166c35f3e3b5ff89dbaaed133aa6a9586f5 /tests | |
parent | 2787177ff160e79b2274b07f688ca96b0acb4ee1 (diff) | |
download | Qt-28b9a4c1bfb6632a10f19bd51528f30205207da0.zip Qt-28b9a4c1bfb6632a10f19bd51528f30205207da0.tar.gz Qt-28b9a4c1bfb6632a10f19bd51528f30205207da0.tar.bz2 |
test paletteChanged()
Diffstat (limited to 'tests')
-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" |