summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-07-21 01:34:18 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-07-21 01:34:18 (GMT)
commit4e193343630db3c3efaa67670e73e2b5a89cf69a (patch)
treedb33b3194e2dd66d921b43c6e3a3a8342e596451 /tests/auto
parentc2c28428123cfd3a3994117bfea88a0ae68f6884 (diff)
parent64833c0a648211f3fe7547436f022edc0ceb51ac (diff)
downloadQt-4e193343630db3c3efaa67670e73e2b5a89cf69a.zip
Qt-4e193343630db3c3efaa67670e73e2b5a89cf69a.tar.gz
Qt-4e193343630db3c3efaa67670e73e2b5a89cf69a.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml17
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp27
-rw-r--r--tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml37
-rw-r--r--tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp35
-rw-r--r--tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp8
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml4
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml4
7 files changed, 124 insertions, 8 deletions
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml b/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml
new file mode 100644
index 0000000..804559c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml
@@ -0,0 +1,17 @@
+import Qt 4.7
+
+Rectangle {
+ width: 200
+ height: 200
+ color: "blue"
+
+ Rectangle {
+ id: myRect
+ objectName: "myRect"
+ width: 100
+ height: 100
+ Behavior on x {
+ NumberAnimation {}
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
index 5c2c145..bb7fc7b 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
+++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
@@ -80,6 +80,7 @@ private slots:
void startup();
void groupedPropertyCrash();
void runningTrue();
+ void sameValue();
};
void tst_qdeclarativebehaviors::simpleBehavior()
@@ -384,6 +385,32 @@ void tst_qdeclarativebehaviors::runningTrue()
QTRY_VERIFY(runningSpy.count() > 0);
}
+//QTBUG-12295
+void tst_qdeclarativebehaviors::sameValue()
+{
+ QDeclarativeEngine engine;
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/qtbug12295.qml"));
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QDeclarativeRectangle *target = rect->findChild<QDeclarativeRectangle*>("myRect");
+ QVERIFY(target);
+
+ target->setX(100);
+ QCOMPARE(target->x(), qreal(100));
+
+ target->setProperty("x", 0);
+ QTRY_VERIFY(target->x() != qreal(0) && target->x() != qreal(100));
+
+ target->setX(100);
+ QCOMPARE(target->x(), qreal(100));
+
+ //this is the main point of the test -- the behavior needs to be triggered again
+ //even though we set 0 twice in a row.
+ target->setProperty("x", 0);
+ QTRY_VERIFY(target->x() != qreal(0) && target->x() != qreal(100));
+}
+
QTEST_MAIN(tst_qdeclarativebehaviors)
#include "tst_qdeclarativebehaviors.moc"
diff --git a/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml b/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml
new file mode 100644
index 0000000..e6b6020
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml
@@ -0,0 +1,37 @@
+import Qt 4.7
+Rectangle {
+ id: container
+ color: "red"
+ height: 200
+ width: 200
+ Column {
+ id: column
+ objectName: "column"
+ anchors.left: container.right
+ anchors.bottom: container.bottom
+
+ Rectangle {
+ id: rectangle
+ color: "blue"
+ height: 100
+ width: 200
+ }
+ Rectangle {
+ color: "blue"
+ height: 100
+ width: 200
+ }
+ }
+ states: State {
+ name: "reanchored"
+ AnchorChanges {
+ target: column
+ anchors.left: undefined
+ anchors.right: container.right
+ }
+ PropertyChanges {
+ target: rectangle
+ opacity: 0
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
index 639b2f3..7bc4fd4 100644
--- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
+++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
@@ -121,6 +121,7 @@ private slots:
void anchorChanges4();
void anchorChanges5();
void anchorChangesCrash();
+ void anchorRewindBug();
void script();
void restoreEntryValues();
void explicitChanges();
@@ -807,6 +808,40 @@ void tst_qdeclarativestates::anchorChangesCrash()
delete rect;
}
+// QTBUG-12273
+void tst_qdeclarativestates::anchorRewindBug()
+{
+ QDeclarativeEngine engine;
+
+ QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorRewindBug.qml");
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QDeclarativeItem * column = rect->findChild<QDeclarativeItem*>("column");
+
+ QVERIFY(column != 0);
+ QVERIFY(!QDeclarativeItemPrivate::get(column)->heightValid);
+ QVERIFY(!QDeclarativeItemPrivate::get(column)->widthValid);
+ QCOMPARE(column->height(), 200.0);
+ QDeclarativeItemPrivate::get(rect)->setState("reanchored");
+
+ // column height and width should stay implicit
+ // and column's implicit resizing should still work
+ QVERIFY(!QDeclarativeItemPrivate::get(column)->heightValid);
+ QVERIFY(!QDeclarativeItemPrivate::get(column)->widthValid);
+ QCOMPARE(column->height(), 100.0);
+
+ QDeclarativeItemPrivate::get(rect)->setState("");
+
+ // column height and width should stay implicit
+ // and column's implicit resizing should still work
+ QVERIFY(!QDeclarativeItemPrivate::get(column)->heightValid);
+ QVERIFY(!QDeclarativeItemPrivate::get(column)->widthValid);
+ QCOMPARE(column->height(), 200.0);
+
+ delete rect;
+}
+
void tst_qdeclarativestates::script()
{
QDeclarativeEngine engine;
diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
index 53862ec..821394d 100644
--- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
+++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
@@ -848,22 +848,22 @@ void tst_qdeclarativetext::letterSpacing()
QCOMPARE(textObject->font().letterSpacing(), 0.0);
}
{
- QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.letterSpacing: -50 }";
+ QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.letterSpacing: -2 }";
QDeclarativeComponent textComponent(&engine);
textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create());
QVERIFY(textObject != 0);
- QCOMPARE(textObject->font().letterSpacing(), -50.);
+ QCOMPARE(textObject->font().letterSpacing(), -2.);
}
{
- QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.letterSpacing: 200 }";
+ QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.letterSpacing: 3 }";
QDeclarativeComponent textComponent(&engine);
textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create());
QVERIFY(textObject != 0);
- QCOMPARE(textObject->font().letterSpacing(), 200.);
+ QCOMPARE(textObject->font().letterSpacing(), 3.);
}
}
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml
index 73dd4d7..e268a60 100644
--- a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml
+++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml
@@ -34,10 +34,10 @@ Rectangle {
text: s.text; font.underline: true; font.overline: true; font.strikeout: true
}
Text {
- text: s.text; font.letterSpacing: 200
+ text: s.text; font.letterSpacing: 2
}
Text {
- text: s.text; font.underline: true; font.letterSpacing: 200; font.capitalization: "AllUppercase"; color: "blue"
+ text: s.text; font.underline: true; font.letterSpacing: 2; font.capitalization: "AllUppercase"; color: "blue"
}
Text {
text: s.text; font.overline: true; font.wordSpacing: 25; font.capitalization: "Capitalize"; color: "green"
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml
index b41b93a..a883b9c 100644
--- a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml
+++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml
@@ -34,10 +34,10 @@ Rectangle {
text: s.text; font.underline: true; font.overline: true; font.strikeout: true
}
Text {
- text: s.text; font.letterSpacing: 200
+ text: s.text; font.letterSpacing: 2
}
Text {
- text: s.text; font.underline: true; font.letterSpacing: 200; font.capitalization: "AllUppercase"; color: "blue"
+ text: s.text; font.underline: true; font.letterSpacing: 2; font.capitalization: "AllUppercase"; color: "blue"
}
Text {
text: s.text; font.overline: true; font.wordSpacing: 25; font.capitalization: "Capitalize"; color: "green"