1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the test suite of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #ifndef TST_QJSVALUE_H
43 #define TST_QJSVALUE_H
45 #include <QtCore/qobject.h>
46 #include <QtCore/qnumeric.h>
47 #include <qjsengine.h>
49 #include <QtTest/QtTest>
51 Q_DECLARE_METATYPE(QVariant)
52 Q_DECLARE_METATYPE(QJSValue)
54 class tst_QJSValue : public QObject
60 virtual ~tst_QJSValue();
66 void ctor_undefinedWithEngine();
67 void ctor_undefined();
68 void ctor_nullWithEngine();
70 void ctor_boolWithEngine();
72 void ctor_intWithEngine();
74 void ctor_uintWithEngine();
76 void ctor_floatWithEngine();
78 void ctor_stringWithEngine();
80 void ctor_copyAndAssignWithEngine();
81 void ctor_copyAndAssign();
82 void ctor_nullEngine();
93 void toQObject_nonQObject_data();
94 void toQObject_nonQObject();
98 void instanceOf_twoEngines();
104 void isError_propertiesOfGlobalObject();
107 void isRegExp_data();
110 #if 0 // FIXME: No QScriptValue::lessThan
114 void strictlyEquals();
116 void hasProperty_basic();
117 void hasProperty_globalObject();
118 void hasProperty_changePrototype();
120 void deleteProperty_basic();
121 void deleteProperty_globalObject();
122 void deleteProperty_inPrototype();
124 void getSetPrototype_cyclicPrototype();
125 void getSetPrototype_evalCyclicPrototype();
126 void getSetPrototype_eval();
127 void getSetPrototype_invalidPrototype();
128 void getSetPrototype_twoEngines();
129 void getSetPrototype_null();
130 void getSetPrototype_notObjectOrNull();
131 void getSetPrototype();
133 void getSetProperty_HooliganTask162051();
134 void getSetProperty_HooliganTask183072();
135 void getSetProperty_propertyRemoval();
136 void getSetProperty_resolveMode();
137 void getSetProperty_twoEngines();
138 void getSetProperty_gettersAndSetters();
139 void getSetProperty_gettersAndSettersThrowErrorNative();
140 void getSetProperty_gettersAndSettersThrowErrorJS();
141 void getSetProperty_gettersAndSettersOnNative();
142 void getSetProperty_gettersAndSettersOnGlobalObject();
143 void getSetProperty_gettersAndSettersChange();
144 void getSetProperty_gettersAndSettersStupid();
145 void getSetProperty_array();
146 void getSetProperty();
147 void arrayElementGetterSetter();
148 void getSetData_objects_data();
149 void getSetData_objects();
150 void getSetData_nonObjects_data();
151 void getSetData_nonObjects();
152 void setData_QTBUG15144();
153 #if 0 // FIXME: no QScriptClass
154 void getSetScriptClass_emptyClass_data();
155 void getSetScriptClass_emptyClass();
156 void getSetScriptClass_JSObjectFromCpp();
157 void getSetScriptClass_JSObjectFromJS();
158 void getSetScriptClass_QVariant();
159 void getSetScriptClass_QObject();
161 void call_function();
163 void call_newObjects();
165 void call_arguments();
167 void call_invalidArguments();
168 void call_invalidReturn();
169 void call_twoEngines();
171 void call_nonFunction_data();
172 void call_nonFunction();
173 void construct_nonFunction_data();
174 void construct_nonFunction();
175 void construct_simple();
176 void construct_newObjectJS();
177 #if 0 // FIXME: no c-style callbacks
178 void construct_undefined();
179 void construct_newObjectCpp();
181 void construct_arg();
182 void construct_proto();
183 void construct_returnInt();
184 void construct_throw();
185 #if 0 // FIXME: The feature of interpreting an array as argument list has been removed from the API
188 void construct_twoEngines();
189 void construct_constructorThrowsPrimitive();
190 void castToPointer();
191 void prettyPrinter_data();
192 void prettyPrinter();
193 void engineDeleted();
194 void valueOfWithClosure();
195 #if 0 // FIXME: no objectId()
198 void nestedObjectToVariant_data();
199 void nestedObjectToVariant();
200 void propertyFlags_data();
201 void propertyFlags();
208 engine = new QJSEngine();