summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscriptvalue
diff options
context:
space:
mode:
authorJedrzej Nowacki <jedrzej.nowacki@nokia.com>2010-10-29 15:10:54 (GMT)
committerJedrzej Nowacki <jedrzej.nowacki@nokia.com>2010-11-01 08:01:05 (GMT)
commitc7221d3ce40f07ce702d732b72978de315b6b194 (patch)
treefec3c7af03dee28cc3f750c18f409033aa9bbd1e /tests/auto/qscriptvalue
parent583e7b9bbbd0a35a40dd1f1d8b415db40601722f (diff)
downloadQt-c7221d3ce40f07ce702d732b72978de315b6b194.zip
Qt-c7221d3ce40f07ce702d732b72978de315b6b194.tar.gz
Qt-c7221d3ce40f07ce702d732b72978de315b6b194.tar.bz2
Refactor tst_QScriptValue::instanceOf
The test was divided into two separate cases, it should reduce maintenance costs. Reviewed-by: Kent Hansen
Diffstat (limited to 'tests/auto/qscriptvalue')
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp13
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.h1
2 files changed, 10 insertions, 4 deletions
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index 5de0116..c7f496b 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -1599,6 +1599,15 @@ void tst_QScriptValue::toRegExp()
QVERIFY(eng.undefinedValue().toRegExp().isEmpty());
}
+void tst_QScriptValue::instanceOf_twoEngines()
+{
+ QScriptEngine eng;
+ QScriptValue obj = eng.newObject();
+ QScriptEngine otherEngine;
+ QTest::ignoreMessage(QtWarningMsg, "QScriptValue::instanceof: cannot perform operation on a value created in a different engine");
+ QCOMPARE(obj.instanceOf(otherEngine.globalObject().property("Object")), false);
+}
+
void tst_QScriptValue::instanceOf()
{
QScriptEngine eng;
@@ -1629,10 +1638,6 @@ void tst_QScriptValue::instanceOf()
QCOMPARE(arr.instanceOf(eng.evaluate("QObject")), false);
QCOMPARE(QScriptValue().instanceOf(arr), false);
-
- QScriptEngine otherEngine;
- QTest::ignoreMessage(QtWarningMsg, "QScriptValue::instanceof: cannot perform operation on a value created in a different engine");
- QCOMPARE(obj.instanceOf(otherEngine.globalObject().property("Object")), false);
}
void tst_QScriptValue::isArray_data()
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.h b/tests/auto/qscriptvalue/tst_qscriptvalue.h
index 782fb67..977b3a5 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.h
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.h
@@ -94,6 +94,7 @@ private slots:
void toQObject();
void toDateTime();
void toRegExp();
+ void instanceOf_twoEngines();
void instanceOf();
void isArray_data();
void isArray();