From f602d82b542fb41099f6a1eb5a73a0e341e68fa0 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Fri, 10 Dec 2010 13:22:18 +0100 Subject: We should not cache ICO files. Otherwise first .ico file will be cached for this extension and all the other icons will have the same appearance. Reviewed-by: prasanth --- src/gui/itemviews/qfileiconprovider.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- cgit v0.12 From 275cf4baf5fb4c0fe28c192a1f5c295cb6032549 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 10 Dec 2010 17:01:19 +0100 Subject: QScript tests, sync the tests with the v8 branch --- tests/auto/qscriptvalue/tst_qscriptvalue.cpp | 60 +++++++++++++++++++++++++++- tests/auto/qscriptvalue/tst_qscriptvalue.h | 5 ++- 2 files changed, 63 insertions(+), 2 deletions(-) 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("program"); + QTest::addColumn("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: -- cgit v0.12