summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@nokia.com>2010-05-28 13:17:48 (GMT)
committerMartin Smith <martin.smith@nokia.com>2010-05-28 13:17:48 (GMT)
commit19fc2c24f02ecef0c9a466d5351aa44ceb973bf3 (patch)
tree63e64d36f718517e558317276a0e9804e9889640 /tests/auto
parentb0b4ca6547807fc602176c1ad262f15f6858116a (diff)
parent71425f24893fecb15cd4d01e6dc3d391051e9d6b (diff)
downloadQt-19fc2c24f02ecef0c9a466d5351aa44ceb973bf3.zip
Qt-19fc2c24f02ecef0c9a466d5351aa44ceb973bf3.tar.gz
Qt-19fc2c24f02ecef0c9a466d5351aa44ceb973bf3.tar.bz2
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qdeclarativepathview/data/pathview0.qml6
-rw-r--r--tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp6
-rw-r--r--tests/auto/qscriptcontext/tst_qscriptcontext.cpp45
3 files changed, 55 insertions, 2 deletions
diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml
index a3afd38..8956205 100644
--- a/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml
+++ b/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml
@@ -4,6 +4,8 @@ Rectangle {
id: root
property int currentA: -1
property int currentB: -1
+ property real delegateWidth: 60
+ property real delegateHeight: 20
width: 240
height: 320
color: "#ffffff"
@@ -13,8 +15,8 @@ Rectangle {
Rectangle {
id: wrapper
objectName: "wrapper"
- height: 20
- width: 60
+ height: root.delegateHeight
+ width: root.delegateWidth
color: PathView.isCurrentItem ? "lightsteelblue" : "white"
border.color: "black"
Text {
diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
index f32a6c7..dffc7ac 100644
--- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
+++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
@@ -445,6 +445,12 @@ void tst_QDeclarativePathView::pathMoved()
pathview->setOffset(0.0);
QCOMPARE(firstItem->pos() + offset, start);
+ // Change delegate size
+ canvas->rootObject()->setProperty("delegateWidth", 30);
+ QCOMPARE(firstItem->width(), 30.0);
+ offset.setX(firstItem->width()/2);
+ QTRY_COMPARE(firstItem->pos() + offset, start);
+
delete canvas;
}
diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
index 100e195..617c183 100644
--- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
+++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
@@ -84,6 +84,7 @@ private slots:
void jsActivationObject();
void qobjectAsActivationObject();
void parentContextCallee_QT2270();
+ void popNativeContextScope();
};
tst_QScriptContext::tst_QScriptContext()
@@ -539,6 +540,50 @@ void tst_QScriptContext::pushAndPopContext()
}
}
+void tst_QScriptContext::popNativeContextScope()
+{
+ QScriptEngine eng;
+ QScriptContext *ctx = eng.pushContext();
+ QVERIFY(ctx->popScope().isObject()); // the activation object
+
+ QCOMPARE(ctx->scopeChain().size(), 1);
+ QVERIFY(ctx->scopeChain().at(0).strictlyEquals(eng.globalObject()));
+ // This was different in 4.5: scope and activation were decoupled
+ QVERIFY(ctx->activationObject().strictlyEquals(eng.globalObject()));
+
+ QVERIFY(!eng.evaluate("var foo = 123; function bar() {}").isError());
+ QVERIFY(eng.globalObject().property("foo").isNumber());
+ QVERIFY(eng.globalObject().property("bar").isFunction());
+
+ QScriptValue customScope = eng.newObject();
+ ctx->pushScope(customScope);
+ QCOMPARE(ctx->scopeChain().size(), 2);
+ QVERIFY(ctx->scopeChain().at(0).strictlyEquals(customScope));
+ QVERIFY(ctx->scopeChain().at(1).strictlyEquals(eng.globalObject()));
+ QVERIFY(ctx->activationObject().strictlyEquals(eng.globalObject()));
+ ctx->setActivationObject(customScope);
+ QVERIFY(ctx->activationObject().strictlyEquals(customScope));
+ QCOMPARE(ctx->scopeChain().size(), 2);
+ QVERIFY(ctx->scopeChain().at(0).strictlyEquals(customScope));
+ QEXPECT_FAIL("", "QTBUG-11012", Continue);
+ QVERIFY(ctx->scopeChain().at(1).strictlyEquals(eng.globalObject()));
+
+ QVERIFY(!eng.evaluate("baz = 456; var foo = 789; function barbar() {}").isError());
+ QEXPECT_FAIL("", "QTBUG-11012", Continue);
+ QVERIFY(eng.globalObject().property("baz").isNumber());
+ QVERIFY(customScope.property("foo").isNumber());
+ QVERIFY(customScope.property("barbar").isFunction());
+
+ QVERIFY(ctx->popScope().strictlyEquals(customScope));
+ QCOMPARE(ctx->scopeChain().size(), 1);
+ QEXPECT_FAIL("", "QTBUG-11012", Continue);
+ QVERIFY(ctx->scopeChain().at(0).strictlyEquals(eng.globalObject()));
+
+ // Need to push another object, otherwise we crash in popContext() (QTBUG-11012)
+ ctx->pushScope(customScope);
+ eng.popContext();
+}
+
void tst_QScriptContext::lineNumber()
{
QScriptEngine eng;