Remove "All rights reserved" line from license headers.
[profile/ivi/qtdeclarative.git] / tests / benchmarks / declarative / js / qjsvalue / tst_qjsvalue.cpp
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
5 **
6 ** This file is part of the test suite of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16 **
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
20 **
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
28 **
29 ** Other Usage
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
32 **
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 #include <qtest.h>
43 #include <QtDeclarative/qjsvalue.h>
44 #include <QtDeclarative/qjsengine.h>
45
46 Q_DECLARE_METATYPE(QJSValue)
47
48 class tst_QJSValue : public QObject
49 {
50     Q_OBJECT
51
52 public:
53     tst_QJSValue();
54     virtual ~tst_QJSValue();
55
56 public slots:
57     void init();
58     void cleanup();
59
60 private slots:
61     void boolConstructor();
62     void floatConstructor();
63     void numberConstructor();
64     void stringConstructor();
65     void nullConstructor();
66     void undefinedConstructor();
67     void boolConstructorWithEngine();
68     void floatConstructorWithEngine();
69     void intConstructorWithEngine();
70     void stringConstructorWithEngine();
71     void undefinedConstructorWithEngine();
72     void copyConstructor_data();
73     void copyConstructor();
74     void call_data();
75     void call();
76     void construct_data();
77     void construct();
78 #if 0 // no data
79     void data();
80     void setData();
81     void data_noData_data();
82     void data_noData();
83 #endif
84     void equalsSelf_data();
85     void equalsSelf();
86 #if 0 // no less then
87     void lessThanSelf_data();
88     void lessThanSelf();
89 #endif
90     void strictlyEqualsSelf_data();
91     void strictlyEqualsSelf();
92     void isArray_data();
93     void isArray();
94     void isBool_data();
95     void isBool();
96     void isDate_data();
97     void isDate();
98     void isError_data();
99     void isError();
100     void isCallable_data();
101     void isCallable();
102     void isNull_data();
103     void isNull();
104     void isNumber_data();
105     void isNumber();
106     void isObject_data();
107     void isObject();
108 #if 0 // no qmetaobject
109     void isQMetaObject_data();
110     void isQMetaObject();
111 #endif
112     void isQObject_data();
113     void isQObject();
114     void isRegExp_data();
115     void isRegExp();
116     void isString_data();
117     void isString();
118     void isUndefined_data();
119     void isUndefined();
120     void isVariant_data();
121     void isVariant();
122     void toBool_data();
123     void toBool();
124     void toDateTime_data();
125     void toDateTime();
126     void toInt_data();
127     void toInt();
128     void toNumber_data();
129     void toNumber();
130     void toRegExp_data();
131     void toRegExp();
132     void toString_data();
133     void toString();
134     void toUInt_data();
135     void toUInt();
136 #if 0 // no qmetaobject
137     void toQMetaObject_data();
138     void toQMetaObject();
139 #endif
140     void toQObject_data();
141     void toQObject();
142     void toVariant_data();
143     void toVariant();
144     void property_data();
145     void property();
146 #if 0  // no string handle
147     void propertyById_data();
148     void propertyById();
149 #endif
150     void propertyByIndex();
151     void setProperty_data();
152     void setProperty();
153 #if 0  // no string handle
154     void setPropertyById_data();
155     void setPropertyById();
156 #endif
157     void setPropertyByIndex();
158 #if 0 // no propertyFlags for now
159     void propertyFlags_data();
160     void propertyFlags();
161     void propertyFlagsById_data();
162     void propertyFlagsById();
163 #endif
164     void prototype_data();
165     void prototype();
166     void setPrototype();
167 #if 0 // no script class
168     void scriptClass_data();
169     void scriptClass();
170     void setScriptClass();
171 #endif
172 #if 0 // no string handle
173     void readMetaProperty();
174     void writeMetaProperty();
175 #endif
176
177 private:
178     void defineStandardTestValues();
179     void newEngine()
180     {
181         delete m_engine;
182         m_engine = new QJSEngine;
183     }
184
185     QJSEngine *m_engine;
186 };
187
188 tst_QJSValue::tst_QJSValue()
189     : m_engine(0)
190 {
191 }
192
193 tst_QJSValue::~tst_QJSValue()
194 {
195     delete m_engine;
196 }
197
198 void tst_QJSValue::init()
199 {
200 }
201
202 void tst_QJSValue::cleanup()
203 {
204 }
205
206 void tst_QJSValue::boolConstructor()
207 {
208     QBENCHMARK {
209         QJSValue val(true);
210     }
211 }
212
213 void tst_QJSValue::floatConstructor()
214 {
215     QBENCHMARK {
216         QJSValue val(123.0);
217     }
218 }
219
220 void tst_QJSValue::numberConstructor()
221 {
222     QBENCHMARK {
223         (void)QJSValue(123);
224     }
225 }
226
227 void tst_QJSValue::stringConstructor()
228 {
229     QString str = QString::fromLatin1("ciao");
230     QBENCHMARK {
231         (void)QJSValue(str);
232     }
233 }
234
235 void tst_QJSValue::nullConstructor()
236 {
237     QBENCHMARK {
238         QJSValue val(QJSValue::NullValue);
239     }
240 }
241
242 void tst_QJSValue::undefinedConstructor()
243 {
244     QBENCHMARK {
245         QJSValue val(QJSValue::UndefinedValue);
246     }
247 }
248
249 void tst_QJSValue::boolConstructorWithEngine()
250 {
251     newEngine();
252     QBENCHMARK {
253         m_engine->toScriptValue(true);
254     }
255 }
256
257 void tst_QJSValue::floatConstructorWithEngine()
258 {
259     newEngine();
260     QBENCHMARK {
261         m_engine->toScriptValue(123.0);
262     }
263 }
264
265 void tst_QJSValue::intConstructorWithEngine()
266 {
267     newEngine();
268     QBENCHMARK {
269         m_engine->toScriptValue(123);
270     }
271 }
272
273 void tst_QJSValue::stringConstructorWithEngine()
274 {
275     newEngine();
276     QString str = QString::fromLatin1("ciao");
277     QBENCHMARK {
278         m_engine->toScriptValue(str);
279     }
280 }
281
282 void tst_QJSValue::undefinedConstructorWithEngine()
283 {
284     newEngine();
285     QVariant var;
286     QBENCHMARK {
287         m_engine->toScriptValue(var);
288     }
289 }
290
291 void tst_QJSValue::copyConstructor_data()
292 {
293     defineStandardTestValues();
294 }
295
296 void tst_QJSValue::copyConstructor()
297 {
298     QFETCH(QJSValue, val);
299     QBENCHMARK {
300         QJSValue copy(val);
301     }
302 }
303
304 void tst_QJSValue::call_data()
305 {
306     newEngine();
307     QTest::addColumn<QString>("code");
308     QTest::newRow("empty function") << QString::fromLatin1("(function(){})");
309     QTest::newRow("function returning number") << QString::fromLatin1("(function(){ return 123; })");
310     QTest::newRow("closure") << QString::fromLatin1("(function(a, b){ return function() { return a + b; }; })(1, 2)");
311 }
312
313 void tst_QJSValue::call()
314 {
315     QFETCH(QString, code);
316     QJSValue fun = m_engine->evaluate(code);
317     QVERIFY(fun.isCallable());
318     QBENCHMARK {
319         (void)fun.call();
320     }
321 }
322
323 void tst_QJSValue::construct_data()
324 {
325     newEngine();
326     QTest::addColumn<QString>("code");
327     QTest::newRow("empty function") << QString::fromLatin1("(function(){})");
328     QTest::newRow("simple constructor") << QString::fromLatin1("(function(){ this.x = 10; this.y = 20; })");
329 }
330
331 void tst_QJSValue::construct()
332 {
333     QFETCH(QString, code);
334     QJSValue fun = m_engine->evaluate(code);
335     QVERIFY(fun.isCallable());
336     QBENCHMARK {
337         (void)fun.callAsConstructor();
338     }
339 }
340
341 #if 0
342 void tst_QJSValue::data()
343 {
344     newEngine();
345     QJSValue obj = m_engine->newObject();
346     obj.setData(QJSValue(m_engine, 123));
347     QBENCHMARK {
348         obj.data();
349     }
350 }
351
352 void tst_QJSValue::setData()
353 {
354     newEngine();
355     QJSValue obj = m_engine->newObject();
356     QJSValue val(m_engine, 123);
357     QBENCHMARK {
358         obj.setData(val);
359     }
360 }
361
362 void tst_QJSValue::data_noData_data()
363 {
364     defineStandardTestValues();
365 }
366
367 void tst_QJSValue::data_noData()
368 {
369     QFETCH(QJSValue, val);
370     QVERIFY(!val.data().isValid());
371     QBENCHMARK {
372         val.data();
373     }
374 }
375 #endif
376
377 void tst_QJSValue::equalsSelf_data()
378 {
379     defineStandardTestValues();
380 }
381
382 void tst_QJSValue::equalsSelf()
383 {
384     QFETCH(QJSValue, val);
385     QBENCHMARK {
386         val.equals(val);
387     }
388 }
389
390 #if 0
391 void tst_QJSValue::lessThanSelf_data()
392 {
393     defineStandardTestValues();
394 }
395
396 void tst_QJSValue::lessThanSelf()
397 {
398     QFETCH(QJSValue, val);
399     QBENCHMARK {
400         val.lessThan(val);
401     }
402 }
403 #endif
404
405 void tst_QJSValue::strictlyEqualsSelf_data()
406 {
407     defineStandardTestValues();
408 }
409
410 void tst_QJSValue::strictlyEqualsSelf()
411 {
412     QFETCH(QJSValue, val);
413     QBENCHMARK {
414         val.strictlyEquals(val);
415     }
416 }
417
418 void tst_QJSValue::isArray_data()
419 {
420     defineStandardTestValues();
421 }
422
423 void tst_QJSValue::isArray()
424 {
425     QFETCH(QJSValue, val);
426     QBENCHMARK {
427         val.isArray();
428     }
429 }
430
431 void tst_QJSValue::isBool_data()
432 {
433     defineStandardTestValues();
434 }
435
436 void tst_QJSValue::isBool()
437 {
438     QFETCH(QJSValue, val);
439     QBENCHMARK {
440         val.isBool();
441     }
442 }
443
444 void tst_QJSValue::isDate_data()
445 {
446     defineStandardTestValues();
447 }
448
449 void tst_QJSValue::isDate()
450 {
451     QFETCH(QJSValue, val);
452     QBENCHMARK {
453         val.isDate();
454     }
455 }
456
457 void tst_QJSValue::isError_data()
458 {
459     defineStandardTestValues();
460 }
461
462 void tst_QJSValue::isError()
463 {
464     QFETCH(QJSValue, val);
465     QBENCHMARK {
466         val.isError();
467     }
468 }
469
470 void tst_QJSValue::isCallable_data()
471 {
472     defineStandardTestValues();
473 }
474
475 void tst_QJSValue::isCallable()
476 {
477     QFETCH(QJSValue, val);
478     QBENCHMARK {
479         val.isCallable();
480     }
481 }
482
483 void tst_QJSValue::isNull_data()
484 {
485     defineStandardTestValues();
486 }
487
488 void tst_QJSValue::isNull()
489 {
490     QFETCH(QJSValue, val);
491     QBENCHMARK {
492         val.isNull();
493     }
494 }
495
496 void tst_QJSValue::isNumber_data()
497 {
498     defineStandardTestValues();
499 }
500
501 void tst_QJSValue::isNumber()
502 {
503     QFETCH(QJSValue, val);
504     QBENCHMARK {
505         val.isNumber();
506     }
507 }
508
509 void tst_QJSValue::isObject_data()
510 {
511     defineStandardTestValues();
512 }
513
514 void tst_QJSValue::isObject()
515 {
516     QFETCH(QJSValue, val);
517     QBENCHMARK {
518         val.isObject();
519     }
520 }
521
522 #if 0
523 void tst_QJSValue::isQMetaObject_data()
524 {
525     defineStandardTestValues();
526 }
527
528 void tst_QJSValue::isQMetaObject()
529 {
530     QFETCH(QJSValue, val);
531     QBENCHMARK {
532         val.isQMetaObject();
533     }
534 }
535 #endif
536
537 void tst_QJSValue::isQObject_data()
538 {
539     defineStandardTestValues();
540 }
541
542 void tst_QJSValue::isQObject()
543 {
544     QFETCH(QJSValue, val);
545     QBENCHMARK {
546         val.isQObject();
547     }
548 }
549
550 void tst_QJSValue::isRegExp_data()
551 {
552     defineStandardTestValues();
553 }
554
555 void tst_QJSValue::isRegExp()
556 {
557     QFETCH(QJSValue, val);
558     QBENCHMARK {
559         val.isRegExp();
560     }
561 }
562
563 void tst_QJSValue::isString_data()
564 {
565     defineStandardTestValues();
566 }
567
568 void tst_QJSValue::isString()
569 {
570     QFETCH(QJSValue, val);
571     QBENCHMARK {
572         val.isString();
573     }
574 }
575
576 void tst_QJSValue::isUndefined_data()
577 {
578     defineStandardTestValues();
579 }
580
581 void tst_QJSValue::isUndefined()
582 {
583     QFETCH(QJSValue, val);
584     QBENCHMARK {
585         val.isUndefined();
586     }
587 }
588
589 void tst_QJSValue::isVariant_data()
590 {
591     defineStandardTestValues();
592 }
593
594 void tst_QJSValue::isVariant()
595 {
596     QFETCH(QJSValue, val);
597     QBENCHMARK {
598         val.isVariant();
599     }
600 }
601
602 void tst_QJSValue::toBool_data()
603 {
604     defineStandardTestValues();
605 }
606
607 void tst_QJSValue::toBool()
608 {
609     QFETCH(QJSValue, val);
610     QBENCHMARK {
611         val.toBool();
612     }
613 }
614
615 void tst_QJSValue::toDateTime_data()
616 {
617     defineStandardTestValues();
618 }
619
620 void tst_QJSValue::toDateTime()
621 {
622     QFETCH(QJSValue, val);
623     QBENCHMARK {
624         val.toDateTime();
625     }
626 }
627
628 void tst_QJSValue::toInt_data()
629 {
630     defineStandardTestValues();
631 }
632
633 void tst_QJSValue::toInt()
634 {
635     QFETCH(QJSValue, val);
636     QBENCHMARK {
637         val.toInt();
638     }
639 }
640
641 void tst_QJSValue::toNumber_data()
642 {
643     defineStandardTestValues();
644 }
645
646 void tst_QJSValue::toNumber()
647 {
648     QFETCH(QJSValue, val);
649     QBENCHMARK {
650         val.toNumber();
651     }
652 }
653
654 void tst_QJSValue::toRegExp_data()
655 {
656     defineStandardTestValues();
657 }
658
659 void tst_QJSValue::toRegExp()
660 {
661     QFETCH(QJSValue, val);
662     QBENCHMARK {
663         qjsvalue_cast<QRegExp>(val);
664     }
665 }
666
667 void tst_QJSValue::toString_data()
668 {
669     defineStandardTestValues();
670 }
671
672 void tst_QJSValue::toString()
673 {
674     QFETCH(QJSValue, val);
675     QBENCHMARK {
676         (void)val.toString();
677     }
678 }
679
680 #if 0
681 void tst_QJSValue::toQMetaObject_data()
682 {
683     defineStandardTestValues();
684 }
685
686 void tst_QJSValue::toQMetaObject()
687 {
688     QFETCH(QJSValue, val);
689     QBENCHMARK {
690         val.toQMetaObject();
691     }
692 }
693 #endif
694
695 void tst_QJSValue::toQObject_data()
696 {
697     defineStandardTestValues();
698 }
699
700 void tst_QJSValue::toQObject()
701 {
702     QFETCH(QJSValue, val);
703     QBENCHMARK {
704         (void)val.toQObject();
705     }
706 }
707
708 void tst_QJSValue::toUInt_data()
709 {
710     defineStandardTestValues();
711 }
712
713 void tst_QJSValue::toUInt()
714 {
715     QFETCH(QJSValue, val);
716     QBENCHMARK {
717         val.toUInt();
718     }
719 }
720
721 void tst_QJSValue::toVariant_data()
722 {
723     defineStandardTestValues();
724 }
725
726 void tst_QJSValue::toVariant()
727 {
728     QFETCH(QJSValue, val);
729     QBENCHMARK {
730         val.toVariant();
731     }
732 }
733 void tst_QJSValue::property_data()
734 {
735     QTest::addColumn<QString>("propertyName");
736     QTest::addColumn<bool>("create");
737     QTest::newRow("foo") << QString::fromLatin1("foo") << true;
738     QTest::newRow("hasOwnProperty") << QString::fromLatin1("hasOwnProperty") << false; // From Object.prototype.
739     QTest::newRow("noSuchProperty") << QString::fromLatin1("noSuchProperty") << false;
740 }
741
742 void tst_QJSValue::property()
743 {
744     QFETCH(QString, propertyName);
745     QFETCH(bool, create);
746     newEngine();
747     QJSValue obj = m_engine->newObject();
748     if (create)
749         obj.setProperty(propertyName, 123);
750     QBENCHMARK {
751         (void)obj.property(propertyName);
752     }
753 }
754
755 #if 0
756 void tst_QJSValue::propertyById_data()
757 {
758     property_data();
759 }
760
761 void tst_QJSValue::propertyById()
762 {
763     QFETCH(QString, propertyName);
764     QFETCH(bool, create);
765     newEngine();
766     QJSValue obj = m_engine->newObject();
767     QJSString id = m_engine->toStringHandle(propertyName);
768     if (create)
769         obj.setProperty(id, 123);
770     QBENCHMARK {
771         obj.property(id);
772     }
773 }
774 #endif
775
776 void tst_QJSValue::propertyByIndex()
777 {
778     newEngine();
779     QJSValue obj = m_engine->newObject();
780     obj.setProperty(123, 456);
781     QBENCHMARK {
782         obj.property(123);
783     }
784 }
785
786 void tst_QJSValue::setProperty_data()
787 {
788     newEngine();
789     QTest::addColumn<QString>("propertyName");
790     QTest::addColumn<QJSValue>("val");
791     QTest::newRow("foo") << QString::fromLatin1("foo") << QJSValue(123);
792     QTest::newRow("bar") << QString::fromLatin1("bar") << m_engine->toScriptValue(123);
793     QTest::newRow("baz") << QString::fromLatin1("baz") << QJSValue();
794     QTest::newRow("toString") << QString::fromLatin1("toString") << m_engine->toScriptValue(true);
795 }
796
797 void tst_QJSValue::setProperty()
798 {
799     QFETCH(QString, propertyName);
800     QFETCH(QJSValue, val);
801     QJSValue obj = m_engine->newObject();
802     QBENCHMARK {
803         obj.setProperty(propertyName, val);
804     }
805 }
806
807 #if 0
808 void tst_QJSValue::setPropertyById_data()
809 {
810     setProperty_data();
811 }
812
813 void tst_QJSValue::setPropertyById()
814 {
815     QFETCH(QString, propertyName);
816     QFETCH(QJSValue, val);
817     QJSValue obj = m_engine->newObject();
818     QJSString id = m_engine->toStringHandle(propertyName);
819     QBENCHMARK {
820         obj.setProperty(id, val);
821     }
822 }
823 #endif
824
825 void tst_QJSValue::setPropertyByIndex()
826 {
827     newEngine();
828     QJSValue obj = m_engine->newObject();
829     QJSValue val(456);
830     QBENCHMARK {
831         obj.setProperty(123, 456);
832     }
833 }
834
835 #if 0
836 void tst_QJSValue::propertyFlags_data()
837 {
838     property_data();
839 }
840
841 void tst_QJSValue::propertyFlags()
842 {
843     QFETCH(QString, propertyName);
844     QFETCH(bool, create);
845     newEngine();
846     QJSValue obj = m_engine->newObject();
847     if (create)
848         obj.setProperty(propertyName, 123, QJSValue::SkipInEnumeration | QJSValue::ReadOnly);
849     QBENCHMARK {
850         (void)obj.propertyFlags(propertyName);
851     }
852 }
853
854 void tst_QJSValue::propertyFlagsById_data()
855 {
856     propertyFlags_data();
857 }
858
859 void tst_QJSValue::propertyFlagsById()
860 {
861     QFETCH(QString, propertyName);
862     QFETCH(bool, create);
863     newEngine();
864     QJSValue obj = m_engine->newObject();
865     QJSString id = m_engine->toStringHandle(propertyName);
866     if (create)
867         obj.setProperty(id, 123, QJSValue::SkipInEnumeration | QJSValue::ReadOnly);
868     QBENCHMARK {
869         obj.propertyFlags(id);
870     }
871 }
872 #endif
873
874 void tst_QJSValue::prototype_data()
875 {
876     defineStandardTestValues();
877 }
878
879 void tst_QJSValue::prototype()
880 {
881     QFETCH(QJSValue, val);
882     QBENCHMARK {
883         val.prototype();
884     }
885 }
886
887 void tst_QJSValue::setPrototype()
888 {
889     newEngine();
890     QJSValue obj = m_engine->newObject();
891     QJSValue proto = m_engine->newObject();
892     QBENCHMARK {
893         obj.setPrototype(proto);
894     }
895 }
896
897 #if 0
898 void tst_QJSValue::scriptClass_data()
899 {
900     defineStandardTestValues();
901 }
902
903 void tst_QJSValue::scriptClass()
904 {
905     QFETCH(QJSValue, val);
906     QBENCHMARK {
907         val.scriptClass();
908     }
909 }
910
911 void tst_QJSValue::setScriptClass()
912 {
913     newEngine();
914     QJSValue obj = m_engine->newObject();
915     QJSClass cls(m_engine);
916     QBENCHMARK {
917         obj.setScriptClass(&cls);
918     }
919 }
920
921 void tst_QJSValue::readMetaProperty()
922 {
923     newEngine();
924     QJSValue object = m_engine->newQObject(QCoreApplication::instance());
925     QJSString propertyName = m_engine->toStringHandle("objectName");
926     QBENCHMARK {
927         for (int i = 0; i < 10000; ++i)
928             object.property(propertyName);
929     }
930 }
931
932 void tst_QJSValue::writeMetaProperty()
933 {
934     newEngine();
935     QJSValue object = m_engine->newQObject(QCoreApplication::instance());
936     QJSString propertyName = m_engine->toStringHandle("objectName");
937     QJSValue value(m_engine, "foo");
938     QBENCHMARK {
939         for (int i = 0; i < 10000; ++i)
940             object.setProperty(propertyName, value);
941     }
942 }
943 #endif
944
945 void tst_QJSValue::defineStandardTestValues()
946 {
947     newEngine();
948     QTest::addColumn<QJSValue>("val");
949     QTest::newRow("bool") << m_engine->evaluate("true");
950     QTest::newRow("number") << m_engine->evaluate("123");
951     QTest::newRow("string") << m_engine->evaluate("'ciao'");
952     QTest::newRow("null") << m_engine->evaluate("null");
953     QTest::newRow("undefined") << m_engine->evaluate("undefined");
954     QTest::newRow("object") << m_engine->evaluate("({foo:123})");
955     QTest::newRow("array") << m_engine->evaluate("[10,20,30]");
956     QTest::newRow("function") << m_engine->evaluate("(function foo(a, b, c) { return a + b + c; })");
957     QTest::newRow("date") << m_engine->evaluate("new Date");
958     QTest::newRow("regexp") << m_engine->evaluate("new RegExp('foo')");
959     QTest::newRow("error") << m_engine->evaluate("new Error");
960
961     QTest::newRow("qobject") << m_engine->newQObject(this);
962 #if 0 // no qmetaobject
963     QTest::newRow("qmetaobject") << m_engine->newQMetaObject(&QJSEngine::staticMetaObject);
964 #endif
965     QTest::newRow("variant") << m_engine->toScriptValue(QPoint(10, 20));
966 #if 0 // no classess
967     QTest::newRow("qscriptclassobject") << m_engine->newObject(new QJSClass(m_engine));
968 #endif
969
970     QTest::newRow("invalid") << QJSValue();
971     QTest::newRow("bool-no-engine") << QJSValue(true);
972     QTest::newRow("number-no-engine") << QJSValue(123.0);
973     QTest::newRow("string-no-engine") << QJSValue(QString::fromLatin1("hello"));
974     QTest::newRow("null-no-engine") << QJSValue(QJSValue::NullValue);
975     QTest::newRow("undefined-no-engine") << QJSValue(QJSValue::UndefinedValue);
976 }
977
978 QTEST_MAIN(tst_QJSValue)
979 #include "tst_qjsvalue.moc"