summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-11-11 04:39:18 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-11-11 04:39:18 (GMT)
commit8a2ae5245787cbfbeaf82c8f296da4d5a404db40 (patch)
tree69b11ade9c8e3476b91200c7e375a4894158dee7 /tests
parent96e0af6be46e51dd3445cfbf23c09833c97c9f2c (diff)
parentd3a6103783b161d6d35a00cb50fef50e73b6a4b6 (diff)
downloadQt-8a2ae5245787cbfbeaf82c8f296da4d5a404db40.zip
Qt-8a2ae5245787cbfbeaf82c8f296da4d5a404db40.tar.gz
Qt-8a2ae5245787cbfbeaf82c8f296da4d5a404db40.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: remove pointless assignment of deprecated variable fix tst_headers Fixed a shell syntax error in configure Clear X11 structure before use Make operator QRectF const Fix GC-related crash in QScriptValue::setData() get rid of dependency on QtGui Removed implicity QtGui linking from icd.pro as it is not needed. DFB: Make sure QPixmap::hasAlpha is respected fix build on mingw Fix some painting issues in QDirectFBPaintEngine QNAM: Do not need QNetworkSession in AlwaysCache load mode Don't crash if QScriptClass property getter returns an invalid value QNAM: Remove dead waitForUpstreamBytesWritten() code QNAM: Remove dead waitForDownstreamReadyRead() code fix memleak in test
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qscriptclass/tst_qscriptclass.cpp21
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp13
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.h1
-rw-r--r--tests/auto/qtextdocument/tst_qtextdocument.cpp1
-rw-r--r--tests/benchmarks/corelib/tools/qstring/data.cpp19
-rw-r--r--tests/benchmarks/corelib/tools/qstring/data.h7
-rw-r--r--tests/benchmarks/corelib/tools/qstring/generatelist.pl8
7 files changed, 54 insertions, 16 deletions
diff --git a/tests/auto/qscriptclass/tst_qscriptclass.cpp b/tests/auto/qscriptclass/tst_qscriptclass.cpp
index b4dbe73..da6c76f 100644
--- a/tests/auto/qscriptclass/tst_qscriptclass.cpp
+++ b/tests/auto/qscriptclass/tst_qscriptclass.cpp
@@ -66,6 +66,7 @@ public:
private slots:
void newInstance();
void getAndSetProperty();
+ void getProperty_invalidValue();
void enumerate();
void extension();
};
@@ -741,6 +742,26 @@ void tst_QScriptClass::getAndSetProperty()
QVERIFY(!obj1.property(bar).isValid());
}
+void tst_QScriptClass::getProperty_invalidValue()
+{
+ QScriptEngine eng;
+ TestClass cls(&eng);
+ cls.addCustomProperty(eng.toStringHandle("foo"), QScriptClass::HandlesReadAccess,
+ /*id=*/0, QScriptValue::ReadOnly, QScriptValue());
+ QScriptValue obj = eng.newObject(&cls);
+
+ QVERIFY(obj.property("foo").isUndefined());
+
+ eng.globalObject().setProperty("obj", obj);
+ QVERIFY(eng.evaluate("obj.hasOwnProperty('foo'))").toBool());
+ // The JS environment expects that a valid value is returned,
+ // otherwise we could crash.
+ QVERIFY(eng.evaluate("obj.foo").isUndefined());
+ QVERIFY(eng.evaluate("obj.foo + ''").isString());
+ QVERIFY(eng.evaluate("Object.getOwnPropertyDescriptor(obj, 'foo').value").isUndefined());
+ QVERIFY(eng.evaluate("Object.getOwnPropertyDescriptor(obj, 'foo').value +''").isString());
+}
+
void tst_QScriptClass::enumerate()
{
QScriptEngine eng;
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index 639df36..53e2699 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -2253,6 +2253,19 @@ void tst_QScriptValue::getSetData()
QVERIFY(!object.data().isValid());
}
+void tst_QScriptValue::setData_QTBUG15144()
+{
+ QScriptEngine eng;
+ QScriptValue obj = eng.newObject();
+ for (int i = 0; i < 10000; ++i) {
+ // Create an object with property 'fooN' on it, and immediately kill
+ // the reference to the object so it and the property name become garbage.
+ eng.evaluate(QString::fromLatin1("o = {}; o.foo%0 = 10; o = null;").arg(i));
+ // Setting the data will cause a JS string to be allocated, which could
+ // trigger a GC. This should not cause a crash.
+ obj.setData("foodfight");
+ }
+}
class TestScriptClass : public QScriptClass
{
public:
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.h b/tests/auto/qscriptvalue/tst_qscriptvalue.h
index 462749a..aa6bc6c 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.h
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.h
@@ -216,6 +216,7 @@ private slots:
void getSetProperty();
void arrayElementGetterSetter();
void getSetData();
+ void setData_QTBUG15144();
void getSetScriptClass();
void call();
void construct();
diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp
index 808299b..23f6a6c 100644
--- a/tests/auto/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp
@@ -2054,6 +2054,7 @@ void tst_QTextDocument::clonePreservesIndentWidth()
doc->setIndentWidth(42);
QTextDocument *clone = doc->clone();
QCOMPARE(clone->indentWidth(), qreal(42));
+ delete clone;
}
void tst_QTextDocument::blockCount()
diff --git a/tests/benchmarks/corelib/tools/qstring/data.cpp b/tests/benchmarks/corelib/tools/qstring/data.cpp
index 6d1a069..d44a796 100644
--- a/tests/benchmarks/corelib/tools/qstring/data.cpp
+++ b/tests/benchmarks/corelib/tools/qstring/data.cpp
@@ -1,5 +1,8 @@
// This is a generated file - DO NOT EDIT
-static const ushort stringCollectionData[] __attribute__((aligned(16))) = {
+
+#include "data.h"
+
+const ushort stringCollectionData[] __attribute__((aligned(16))) = {
// #0
65535,
99, 111, 109, 112, 105, 108, 101, 114, 32, 118, 101, 114, 115, 105, 111, 110, 115, 47,
@@ -1123,15 +1126,9 @@ static const ushort stringCollectionData[] __attribute__((aligned(16))) = {
65535,
84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61,
65535,65534,65533, // 5216
-
-
};
-static struct StringCollection
-{
- int len;
- int offset1, offset2;
- ushort align1, align2;
-} stringCollection[] = {
+
+const struct StringCollection stringCollection[] = {
{18, 1, 29, 3666, 106}, // #0
{18, 53, 77, 106, 1978}, // #1
{20, 97, 125, 2850, 3210}, // #2
@@ -1274,8 +1271,8 @@ static struct StringCollection
{12, 5153, 5169, 130, 2930}, // #139
{12, 5185, 5201, 242, 2930}, // #140
};
-static const int stringCollectionCount = 141;
-static const int stringCollectionMaxLen = 51;
+const int stringCollectionCount = 141;
+const int stringCollectionMaxLen = 51;
// average comparison length: 12.0922
// cache-line crosses: 6 (2.1%)
// alignment histogram:
diff --git a/tests/benchmarks/corelib/tools/qstring/data.h b/tests/benchmarks/corelib/tools/qstring/data.h
index c7a7467..ce733fb 100644
--- a/tests/benchmarks/corelib/tools/qstring/data.h
+++ b/tests/benchmarks/corelib/tools/qstring/data.h
@@ -39,6 +39,9 @@
**
****************************************************************************/
+#ifndef DATA_H
+#define DATA_H
+
#include <qglobal.h>
struct StringCollection
@@ -49,5 +52,7 @@ struct StringCollection
};
extern const ushort stringCollectionData[];
-extern StringCollection stringCollection[];
+extern const StringCollection stringCollection[];
extern const int stringCollectionCount;
+
+#endif // DATA_H
diff --git a/tests/benchmarks/corelib/tools/qstring/generatelist.pl b/tests/benchmarks/corelib/tools/qstring/generatelist.pl
index d027adb..48a8518 100644
--- a/tests/benchmarks/corelib/tools/qstring/generatelist.pl
+++ b/tests/benchmarks/corelib/tools/qstring/generatelist.pl
@@ -103,9 +103,10 @@ sub printUshortArray($$$) {
return ($offset + $headpadding, $offset + $headpadding + $len + $tailpadding);
}
+print "// This is a generated file - DO NOT EDIT\n\n";
+
print "#include \"data.h\"\n\n";
-print "// This is a generated file - DO NOT EDIT\n";
print "const ushort stringCollectionData[] __attribute__((aligned(64))) = {\n";
$count = 0;
$offset = 0;
@@ -160,11 +161,10 @@ while (1) {
$totalsize += $len;
$maxlen = $len if $len > $maxlen;
}
-print "\n};\n";
+print "};\n";
close IN;
-print "struct StringCollection stringCollection[] = {\n";
-
+print "const struct StringCollection stringCollection[] = {\n";
for $i (0..$count-1) {
print " {",
$data[$i]->{len}, ", ",