summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativetextedit
diff options
context:
space:
mode:
authorJoona Petrell <joona.t.petrell@nokia.com>2010-07-06 01:11:59 (GMT)
committerJoona Petrell <joona.t.petrell@nokia.com>2010-07-06 01:16:14 (GMT)
commit5500ffeeaee3412272f0f4af844fbc1d4d78a3bb (patch)
tree6b9c124f72272a4cc6f84c1ce1627126720d2e67 /tests/auto/declarative/qdeclarativetextedit
parent8274fdc7ee8ecc03bb879ea79e9b3b3b4ca9ab37 (diff)
downloadQt-5500ffeeaee3412272f0f4af844fbc1d4d78a3bb.zip
Qt-5500ffeeaee3412272f0f4af844fbc1d4d78a3bb.tar.gz
Qt-5500ffeeaee3412272f0f4af844fbc1d4d78a3bb.tar.bz2
Fix TextEdit with no color property defined is drawn with wrong color
Task-number: QTBUG-11932 Reviewed-by: Martin Jones
Diffstat (limited to 'tests/auto/declarative/qdeclarativetextedit')
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp18
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 65d45b1..2025504 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -57,6 +57,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++)
{