QCOMPARE(undefined.toString(), QString("undefined"));
QCOMPARE(qjsvalue_cast<QString>(undefined), QString());
- QJSValue null = eng.nullValue();
+ QJSValue null = eng.evaluate("null");
QCOMPARE(null.toString(), QString("null"));
QCOMPARE(qjsvalue_cast<QString>(null), QString());
QCOMPARE(qIsNaN(undefined.toNumber()), true);
QCOMPARE(qIsNaN(qjsvalue_cast<qreal>(undefined)), true);
- QJSValue null = eng.nullValue();
+ QJSValue null = eng.evaluate("null");
QCOMPARE(null.toNumber(), 0.0);
QCOMPARE(qjsvalue_cast<qreal>(null), 0.0);
QCOMPARE(undefined.toBool(), false);
QCOMPARE(qjsvalue_cast<bool>(undefined), false);
- QJSValue null = eng.nullValue();
+ QJSValue null = eng.evaluate("null");
QCOMPARE(null.toBool(), false);
QCOMPARE(qjsvalue_cast<bool>(null), false);
QCOMPARE(undefined.toBool(), false);
QCOMPARE(qjsvalue_cast<bool>(undefined), false);
- QJSValue null = eng.nullValue();
+ QJSValue null = eng.evaluate("null");
QCOMPARE(null.toBool(), false);
QCOMPARE(qjsvalue_cast<bool>(null), false);
QCOMPARE(undefined.toVariant(), QVariant());
QCOMPARE(qjsvalue_cast<QVariant>(undefined), QVariant());
- QJSValue null = eng.nullValue();
+ QJSValue null = eng.evaluate("null");
QCOMPARE(null.toVariant(), QVariant());
QCOMPARE(qjsvalue_cast<QVariant>(null), QVariant());
QTest::newRow("int bound") << engine->toScriptValue(123);
QTest::newRow("string bound") << engine->toScriptValue(QString::fromLatin1("ciao"));
QTest::newRow("undefined bound") << engine->undefinedValue();
- QTest::newRow("null bound") << engine->nullValue();
+ QTest::newRow("null bound") << engine->evaluate("null");
QTest::newRow("object") << engine->newObject();
QTest::newRow("array") << engine->newArray();
QTest::newRow("date") << engine->evaluate("new Date(124)");
QVERIFY(!QJSValue().toDateTime().isValid());
QVERIFY(!QJSValue(123).toDateTime().isValid());
QVERIFY(!QJSValue(false).toDateTime().isValid());
- QVERIFY(!eng.nullValue().toDateTime().isValid());
+ QVERIFY(!eng.evaluate("null").toDateTime().isValid());
QVERIFY(!eng.undefinedValue().toDateTime().isValid());
}
QVERIFY(qjsvalue_cast<QRegExp>(QJSValue()).isEmpty());
QVERIFY(qjsvalue_cast<QRegExp>(QJSValue(123)).isEmpty());
QVERIFY(qjsvalue_cast<QRegExp>(QJSValue(false)).isEmpty());
- QVERIFY(qjsvalue_cast<QRegExp>(eng.nullValue()).isEmpty());
+ QVERIFY(qjsvalue_cast<QRegExp>(eng.evaluate("null")).isEmpty());
QVERIFY(qjsvalue_cast<QRegExp>(eng.undefinedValue()).isEmpty());
}
QTest::newRow("invalid") << QJSValue() << false;
QTest::newRow("number") << QJSValue(123) << false;
QTest::newRow("bool") << QJSValue(false) << false;
- QTest::newRow("null") << engine->nullValue() << false;
+ QTest::newRow("null") << engine->evaluate("null") << false;
QTest::newRow("undefined") << engine->undefinedValue() << false;
}
QTest::newRow("invalid") << QJSValue() << false;
QTest::newRow("number") << QJSValue(123) << false;
QTest::newRow("bool") << QJSValue(false) << false;
- QTest::newRow("null") << engine->nullValue() << false;
+ QTest::newRow("null") << engine->evaluate("null") << false;
QTest::newRow("undefined") << engine->undefinedValue() << false;
}
QTest::newRow("invalid") << QJSValue() << false;
QTest::newRow("number") << QJSValue(123) << false;
QTest::newRow("bool") << QJSValue(false) << false;
- QTest::newRow("null") << engine->nullValue() << false;
+ QTest::newRow("null") << engine->evaluate("null") << false;
QTest::newRow("undefined") << engine->undefinedValue() << false;
QTest::newRow("newObject") << engine->newObject() << false;
QTest::newRow("new Object") << engine->evaluate("new Object()") << false;
QTest::newRow("invalid") << QJSValue() << false;
QTest::newRow("number") << QJSValue(123) << false;
QTest::newRow("bool") << QJSValue(false) << false;
- QTest::newRow("null") << engine->nullValue() << false;
+ QTest::newRow("null") << engine->evaluate("null") << false;
QTest::newRow("undefined") << engine->undefinedValue() << false;
}
QTest::addColumn<QJSValue>("value");
QTest::newRow("undefined (bound)") << engine->undefinedValue();
- QTest::newRow("null (bound)") << engine->nullValue();
+ QTest::newRow("null (bound)") << engine->evaluate("null");
QTest::newRow("string (bound)") << engine->toScriptValue("Pong");
QTest::newRow("bool (bound)") << engine->toScriptValue(false);
QTest::newRow("number") << engine->toScriptValue(123);
QTest::newRow("string") << engine->toScriptValue("pong");
QTest::newRow("bool") << engine->toScriptValue(true);
- QTest::newRow("null") << QJSValue(engine->nullValue());
+ QTest::newRow("null") << QJSValue(engine->evaluate("null"));
QTest::newRow("undefined") << QJSValue(engine->undefinedValue());
QTest::newRow("object") << QJSValue(engine->newObject());
QTest::newRow("date") << QJSValue(engine->evaluate("new Date()"));
QCOMPARE(ret2.property(1).strictlyEquals(ret.property(1)), true);
QCOMPARE(ret2.property(2).strictlyEquals(ret.property(2)), true);
// call with null as arguments
- QJSValue ret3 = fun.call(QJSValue(), eng.nullValue());
+ QJSValue ret3 = fun.call(QJSValue(), eng.evaluate("null"));
QCOMPARE(ret3.isError(), false);
QCOMPARE(ret3.property("length").isNumber(), true);
QCOMPARE(ret3.property("length").toNumber(), 0.0);
QTest::newRow("int bound") << engine->toScriptValue(123);
QTest::newRow("string bound") << engine->toScriptValue(QString::fromLatin1("ciao"));
QTest::newRow("undefined bound") << engine->undefinedValue();
- QTest::newRow("null bound") << engine->nullValue();
+ QTest::newRow("null bound") << engine->evaluate("null");
}
void tst_QJSValue::call_nonFunction()
QTest::newRow("int bound") << engine->toScriptValue(123);
QTest::newRow("string bound") << engine->toScriptValue(QString::fromLatin1("ciao"));
QTest::newRow("undefined bound") << engine->undefinedValue();
- QTest::newRow("null bound") << engine->nullValue();
+ QTest::newRow("null bound") << engine->evaluate("null");
}
void tst_QJSValue::construct_nonFunction()
QCOMPARE(ret2.property(1).strictlyEquals(ret.property(1)), true);
QCOMPARE(ret2.property(2).strictlyEquals(ret.property(2)), true);
// construct with null as arguments
- QJSValue ret3 = fun.callAsConstructor(eng.nullValue());
+ QJSValue ret3 = fun.callAsConstructor(eng.evaluate("null");
QCOMPARE(ret3.isError(), false);
QCOMPARE(ret3.property("length").isNumber(), true);
QCOMPARE(ret3.property("length").toNumber(), 0.0);
QCOMPARE(date2.equals(date2), true);
QJSValue undefined = eng.undefinedValue();
- QJSValue null = eng.nullValue();
+ QJSValue null = eng.evaluate("null");
QCOMPARE(undefined.equals(undefined), true);
QCOMPARE(null.equals(null), true);
QCOMPARE(undefined.equals(null), true);
QVERIFY(!date1.strictlyEquals(QJSValue()));
QJSValue undefined = eng.undefinedValue();
- QJSValue null = eng.nullValue();
+ QJSValue null = eng.evaluate("null");
QCOMPARE(undefined.strictlyEquals(undefined), true);
QCOMPARE(null.strictlyEquals(null), true);
QCOMPARE(undefined.strictlyEquals(null), false);