diff options
author | Joona Petrell <joona.t.petrell@nokia.com> | 2010-07-06 01:11:59 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2010-07-13 03:55:13 (GMT) |
commit | e942f655236ea3c17bb3edba81630508b65af057 (patch) | |
tree | aad08bb9a15b5f62b0b0e10e9992bef92c902547 /tests | |
parent | 8170264c1f3db19b7fba6d4807f09c6c367d149d (diff) | |
download | Qt-e942f655236ea3c17bb3edba81630508b65af057.zip Qt-e942f655236ea3c17bb3edba81630508b65af057.tar.gz Qt-e942f655236ea3c17bb3edba81630508b65af057.tar.bz2 |
Fix TextEdit with no color property defined is drawn with wrong color
Task-number: QTBUG-11932
Reviewed-by: Martin Jones
(cherry picked from commit 5500ffeeaee3412272f0f4af844fbc1d4d78a3bb)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index fc329c8..4e4f45e 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -56,6 +56,7 @@ #include <QStyle> #include <QInputContext> #include <private/qapplication_p.h> +#include <private/qtextcontrol_p.h> #ifdef Q_OS_SYMBIAN // In Symbian OS test data is located in applications private dir @@ -492,6 +493,23 @@ void tst_qdeclarativetextedit::font() void tst_qdeclarativetextedit::color() { + //test initial color + { + QString componentStr = "import Qt 4.7\nTextEdit { text: \"Hello World\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + + QDeclarativeTextEditPrivate *textEditPrivate = static_cast<QDeclarativeTextEditPrivate*>(QDeclarativeItemPrivate::get(textEditObject)); + + QVERIFY(textEditObject); + QVERIFY(textEditPrivate); + QVERIFY(textEditPrivate->control); + + QPalette pal = textEditPrivate->control->palette(); + QCOMPARE(textEditPrivate->color, QColor("black")); + QCOMPARE(textEditPrivate->color, pal.color(QPalette::Text)); + } //test normal for (int i = 0; i < colorStrings.size(); i++) { |