summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-09-23 02:56:29 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-09-23 02:56:29 (GMT)
commit6c98c8b0c8739814d9367d5c29f5c4034ebda0b1 (patch)
tree7d0079d8f519bc48945cbc8622a99b33ea0450b1
parent4594ccff8ee55a5bbc640f764e0767da885a3c9f (diff)
downloadQt-6c98c8b0c8739814d9367d5c29f5c4034ebda0b1.zip
Qt-6c98c8b0c8739814d9367d5c29f5c4034ebda0b1.tar.gz
Qt-6c98c8b0c8739814d9367d5c29f5c4034ebda0b1.tar.bz2
QFxTextEdit test passes again
-rw-r--r--src/declarative/fx/qfxtextedit.cpp3
-rw-r--r--tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp6
2 files changed, 5 insertions, 4 deletions
diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp
index f7b92a4..ce06348 100644
--- a/src/declarative/fx/qfxtextedit.cpp
+++ b/src/declarative/fx/qfxtextedit.cpp
@@ -1051,7 +1051,8 @@ void QFxTextEdit::updateSize()
if(d->cursor)
cursorWidth = d->cursor->width();
newWidth += cursorWidth;
- newWidth += 3;// ### Need a better way of ensuring cursor is in width
+ if(!d->document->isEmpty())
+ newWidth += 3;// ### Need a better way of accounting for space between char and cursor
setImplicitWidth(newWidth);
setImplicitHeight(d->text.isEmpty() ? fm.height() : (int)d->document->size().height());
diff --git a/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp b/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp
index ffbb09b..e38e0e7 100644
--- a/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp
+++ b/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp
@@ -130,7 +130,7 @@ void tst_qfxtextedit::width()
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
- QCOMPARE(textEditObject->width(), 0.);
+ QCOMPARE(textEditObject->width(), 1.);//+1 for cursor
}
for (int i = 0; i < standard.size(); i++)
@@ -144,7 +144,7 @@ void tst_qfxtextedit::width()
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
- QCOMPARE(textEditObject->width(), qreal(metricWidth));
+ QCOMPARE(textEditObject->width(), qreal(metricWidth + 1 + 3));//+3 is the current way of accounting for space between cursor and last character.
}
for (int i = 0; i < richText.size(); i++)
@@ -160,7 +160,7 @@ void tst_qfxtextedit::width()
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
- QCOMPARE(textEditObject->width(), qreal(documentWidth));
+ QCOMPARE(textEditObject->width(), qreal(documentWidth + 1 + 3));
}
}