summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-07-21 04:16:34 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-07-21 04:16:34 (GMT)
commit3aeafb4839f49f524f10eae65be27fd189d37060 (patch)
tree5d35f55d8e68d8a2f5c2ab79d8614eed6a0ff28a /tests/auto/declarative
parent21806ff0921641b4e4d9d39721ab4ebeae74dddc (diff)
downloadQt-3aeafb4839f49f524f10eae65be27fd189d37060.zip
Qt-3aeafb4839f49f524f10eae65be27fd189d37060.tar.gz
Qt-3aeafb4839f49f524f10eae65be27fd189d37060.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
Diffstat (limited to 'tests/auto/declarative')
-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: