summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-07-21 04:16:34 (GMT)
committerToby Tomkins <toby.tomkins@nokia.com>2010-07-26 06:24:18 (GMT)
commit26a1acf139f7a444bc68d9a1540d418c41aa89ec (patch)
tree2943aee398fab53819db821c2cd3d4781820758d /tests
parent19835bd63a99e1b71b80f68fac249f4d207975ec (diff)
downloadQt-26a1acf139f7a444bc68d9a1540d418c41aa89ec.zip
Qt-26a1acf139f7a444bc68d9a1540d418c41aa89ec.tar.gz
Qt-26a1acf139f7a444bc68d9a1540d418c41aa89ec.tar.bz2
Bounding rect of text was not always calculated correctly.
The boundingRect depended upon the image cache which may not become valid until after boundingRect is called. Task-number: QTBUG-12291 Reviewed-by: Michael Brasser (cherry picked from commit 3aeafb4839f49f524f10eae65be27fd189d37060)
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativetext/data/rotated.qml18
-rw-r--r--tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp19
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativetext/data/rotated.qml b/tests/auto/declarative/qdeclarativetext/data/rotated.qml
new file mode 100644
index 0000000..01eec44
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetext/data/rotated.qml
@@ -0,0 +1,18 @@
+import Qt 4.7
+
+Rectangle {
+ width : 200
+ height : 100
+
+ Text {
+ objectName: "text"
+ x: 20
+ y: 20
+ height : 20
+ width : 80
+ text : "Something"
+ rotation : 30
+ transformOrigin : Item.TopLeft
+ }
+}
+
diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
index 821394d..658f381 100644
--- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
+++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
@@ -97,6 +97,8 @@ private slots:
void clickLink();
+ void QTBUG_12291();
+
private:
QStringList standard;
QStringList richText;
@@ -898,6 +900,23 @@ void tst_qdeclarativetext::wordSpacing()
}
}
+void tst_qdeclarativetext::QTBUG_12291()
+{
+ QDeclarativeView *canvas = createView(SRCDIR "/data/rotated.qml");
+
+ canvas->show();
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas));
+
+ QObject *ob = canvas->rootObject();
+ QVERIFY(ob != 0);
+
+ QDeclarativeText *text = ob->findChild<QDeclarativeText*>("text");
+ QVERIFY(text);
+ QVERIFY(text->boundingRect().isValid());
+}
+
class EventSender : public QGraphicsItem
{
public: