summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-12-13 06:52:01 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-12-13 06:52:01 (GMT)
commit8729352726bbdca80e2813eee815e6a1a3ad06ff (patch)
treee1a3f886dbe575ee24b2929525fe69a23fc51dff
parentc8a2533cb39ce0c7479880cd889ad594d569ecc0 (diff)
parent954cbb597f322acbc5f023f22503311ce2fc791a (diff)
downloadQt-8729352726bbdca80e2813eee815e6a1a3ad06ff.zip
Qt-8729352726bbdca80e2813eee815e6a1a3ad06ff.tar.gz
Qt-8729352726bbdca80e2813eee815e6a1a3ad06ff.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2: QScript tests, sync the tests with the v8 branch We should not cache ICO files.
-rw-r--r--src/gui/itemviews/qfileiconprovider.cpp2
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp60
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.h5
3 files changed, 64 insertions, 3 deletions
diff --git a/src/gui/itemviews/qfileiconprovider.cpp b/src/gui/itemviews/qfileiconprovider.cpp
index 4748f89..570c0ab 100644
--- a/src/gui/itemviews/qfileiconprovider.cpp
+++ b/src/gui/itemviews/qfileiconprovider.cpp
@@ -234,7 +234,7 @@ QIcon QFileIconProviderPrivate::getWinIcon(const QFileInfo &fileInfo) const
const QString fileExtension = QLatin1Char('.') + fileInfo.suffix().toUpper();
QString key;
- if (fileInfo.isFile() && !fileInfo.isExecutable() && !fileInfo.isSymLink())
+ if (fileInfo.isFile() && !fileInfo.isExecutable() && !fileInfo.isSymLink() && fileExtension != QLatin1String(".ICO"))
key = QLatin1String("qt_") + fileExtension;
QPixmap pixmap;
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index 5a50e49..ec33e81 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -1970,7 +1970,7 @@ void tst_QScriptValue::getSetProperty_gettersAndSetters()
QCOMPARE(object.property("foo").isUndefined(), true);
}
-void tst_QScriptValue::getSetProperty_gettersAndSettersThrowError()
+void tst_QScriptValue::getSetProperty_gettersAndSettersThrowErrorNative()
{
// getter/setter that throws an error
QScriptEngine eng;
@@ -1984,6 +1984,32 @@ void tst_QScriptValue::getSetProperty_gettersAndSettersThrowError()
QVERIFY(ret.isError());
QVERIFY(eng.hasUncaughtException());
QVERIFY(ret.strictlyEquals(eng.uncaughtException()));
+ QCOMPARE(ret.toString(), QLatin1String("Error: get foo"));
+ eng.evaluate("Object"); // clear exception state...
+ QVERIFY(!eng.hasUncaughtException());
+ object.setProperty("foo", str);
+ QVERIFY(eng.hasUncaughtException());
+ QCOMPARE(eng.uncaughtException().toString(), QLatin1String("Error: set foo"));
+}
+
+void tst_QScriptValue::getSetProperty_gettersAndSettersThrowErrorJS()
+{
+ // getter/setter that throws an error (from js function)
+ QScriptEngine eng;
+ QScriptValue str = QScriptValue(&eng, "bar");
+
+ eng.evaluate("o = new Object; "
+ "o.__defineGetter__('foo', function() { throw new Error('get foo') }); "
+ "o.__defineSetter__('foo', function() { throw new Error('set foo') }); ");
+ QScriptValue object = eng.evaluate("o");
+ QVERIFY(!eng.hasUncaughtException());
+ QScriptValue ret = object.property("foo");
+ QEXPECT_FAIL("", "Exception thrown from js function are not returned by the JSC port", Continue);
+ QVERIFY(ret.isError());
+ QVERIFY(eng.hasUncaughtException());
+ QEXPECT_FAIL("", "Exception thrown from js function are not returned by the JSC port", Continue);
+ QVERIFY(ret.strictlyEquals(eng.uncaughtException()));
+ QCOMPARE(eng.uncaughtException().toString(), QLatin1String("Error: get foo"));
eng.evaluate("Object"); // clear exception state...
QVERIFY(!eng.hasUncaughtException());
object.setProperty("foo", str);
@@ -2051,6 +2077,12 @@ void tst_QScriptValue::getSetProperty_gettersAndSettersChange()
QVERIFY(!object.property("x").isValid());
object.setProperty("foo", num);
QVERIFY(object.property("x").equals(num));
+
+ eng.globalObject().setProperty("object", object);
+ QScriptValue res = eng.evaluate("object.x = 89; var a = object.foo; object.foo = 65; a");
+ QCOMPARE(res.toInt32(), 89);
+ QCOMPARE(object.property("x").toInt32(), 65);
+ QCOMPARE(object.property("foo").toInt32(), 65);
}
void tst_QScriptValue::getSetProperty_array()
@@ -3931,4 +3963,30 @@ void tst_QScriptValue::nestedObjectToVariant()
QCOMPARE(o.toVariant(), expected);
}
+void tst_QScriptValue::propertyFlags_data()
+{
+ QTest::addColumn<QString>("program");
+ QTest::addColumn<uint>("expected");
+
+ QTest::newRow("nothing") << "" << 0u;
+ QTest::newRow("getter") << "o.__defineGetter__('prop', function() { return 'blah' } );\n" << uint(QScriptValue::PropertyGetter);
+ QTest::newRow("setter") << "o.__defineSetter__('prop', function(a) { this.setted_prop2 = a; } );\n" << uint(QScriptValue::PropertySetter);
+ QTest::newRow("getterSetter") << "o.__defineGetter__('prop', function() { return 'ploup' } );\n"
+ "o.__defineSetter__('prop', function(a) { this.setted_prop3 = a; } );\n" << uint(QScriptValue::PropertySetter|QScriptValue::PropertyGetter);
+ QTest::newRow("nothing2") << "o.prop = 'nothing'" << 0u;
+}
+
+void tst_QScriptValue::propertyFlags()
+{
+ QFETCH(QString, program);
+ QFETCH(uint, expected);
+ QScriptEngine eng;
+ eng.evaluate("o = new Object;");
+ eng.evaluate(program);
+ QScriptValue o = eng.evaluate("o");
+
+ QCOMPARE(uint(o.propertyFlags("prop")), expected);
+}
+
+
QTEST_MAIN(tst_QScriptValue)
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.h b/tests/auto/qscriptvalue/tst_qscriptvalue.h
index 46f5526..6f55bc3 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.h
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.h
@@ -127,7 +127,8 @@ private slots:
void getSetProperty_resolveMode();
void getSetProperty_twoEngines();
void getSetProperty_gettersAndSetters();
- void getSetProperty_gettersAndSettersThrowError();
+ void getSetProperty_gettersAndSettersThrowErrorNative();
+ void getSetProperty_gettersAndSettersThrowErrorJS();
void getSetProperty_gettersAndSettersOnNative();
void getSetProperty_gettersAndSettersOnGlobalObject();
void getSetProperty_gettersAndSettersChange();
@@ -178,6 +179,8 @@ private slots:
void objectId();
void nestedObjectToVariant_data();
void nestedObjectToVariant();
+ void propertyFlags_data();
+ void propertyFlags();
private: