tests/auto/qscriptvalue/tst_qscriptvalue.cpp
changeset 19 fcece45ef507
parent 18 2f34d5167611
child 23 89e065397ea6
equal deleted inserted replaced
18:2f34d5167611 19:fcece45ef507
  2569         QCOMPARE(ret4.property("length").isNumber(), true);
  2569         QCOMPARE(ret4.property("length").isNumber(), true);
  2570         QCOMPARE(ret4.property("length").toNumber(), 0.0);
  2570         QCOMPARE(ret4.property("length").toNumber(), 0.0);
  2571         // call with something else as arguments
  2571         // call with something else as arguments
  2572         QScriptValue ret5 = fun.call(QScriptValue(), QScriptValue(&eng, 123.0));
  2572         QScriptValue ret5 = fun.call(QScriptValue(), QScriptValue(&eng, 123.0));
  2573         QCOMPARE(ret5.isError(), true);
  2573         QCOMPARE(ret5.isError(), true);
       
  2574         // call with a non-array object as arguments
       
  2575         QScriptValue ret6 = fun.call(QScriptValue(), eng.globalObject());
       
  2576         QVERIFY(ret6.isError());
       
  2577         QCOMPARE(ret6.toString(), QString::fromLatin1("TypeError: Arguments must be an array"));
  2574     }
  2578     }
  2575 
  2579 
  2576     // calling things that are not functions
  2580     // calling things that are not functions
  2577     QVERIFY(!QScriptValue(false).call().isValid());
  2581     QVERIFY(!QScriptValue(false).call().isValid());
  2578     QVERIFY(!QScriptValue(123).call().isValid());
  2582     QVERIFY(!QScriptValue(123).call().isValid());
  2701         QCOMPARE(ret4.property("length").isNumber(), true);
  2705         QCOMPARE(ret4.property("length").isNumber(), true);
  2702         QCOMPARE(ret4.property("length").toNumber(), 0.0);
  2706         QCOMPARE(ret4.property("length").toNumber(), 0.0);
  2703         // construct with something else as arguments
  2707         // construct with something else as arguments
  2704         QScriptValue ret5 = fun.construct(QScriptValue(&eng, 123.0));
  2708         QScriptValue ret5 = fun.construct(QScriptValue(&eng, 123.0));
  2705         QCOMPARE(ret5.isError(), true);
  2709         QCOMPARE(ret5.isError(), true);
       
  2710         // construct with a non-array object as arguments
       
  2711         QScriptValue ret6 = fun.construct(eng.globalObject());
       
  2712         QVERIFY(ret6.isError());
       
  2713         QCOMPARE(ret6.toString(), QString::fromLatin1("TypeError: Arguments must be an array"));
  2706     }
  2714     }
  2707 
  2715 
  2708     // construct on things that are not functions
  2716     // construct on things that are not functions
  2709     QVERIFY(!QScriptValue(false).construct().isValid());
  2717     QVERIFY(!QScriptValue(false).construct().isValid());
  2710     QVERIFY(!QScriptValue(123).construct().isValid());
  2718     QVERIFY(!QScriptValue(123).construct().isValid());