Rename QDeclarative symbols to QQuick and QQml
[profile/ivi/qtdeclarative.git] / tests / auto / qml / qjsvalue / tst_qjsvalue.h
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 #ifndef TST_QJSVALUE_H
43 #define TST_QJSVALUE_H
44
45 #include <QtCore/qobject.h>
46 #include <QtCore/qnumeric.h>
47 #include <qjsengine.h>
48 #include <qjsvalue.h>
49 #include <QtTest/QtTest>
50
51 Q_DECLARE_METATYPE(QVariant)
52 Q_DECLARE_METATYPE(QJSValue)
53
54 class tst_QJSValue : public QObject
55 {
56     Q_OBJECT
57
58 public:
59     tst_QJSValue();
60     virtual ~tst_QJSValue();
61
62 private slots:
63     void ctor_invalid();
64     void ctor_undefinedWithEngine();
65     void ctor_undefined();
66     void ctor_nullWithEngine();
67     void ctor_null();
68     void ctor_boolWithEngine();
69     void ctor_bool();
70     void ctor_intWithEngine();
71     void ctor_int();
72     void ctor_uintWithEngine();
73     void ctor_uint();
74     void ctor_floatWithEngine();
75     void ctor_float();
76     void ctor_stringWithEngine();
77     void ctor_string();
78     void ctor_copyAndAssignWithEngine();
79     void ctor_copyAndAssign();
80
81     void toString();
82     void toNumber();
83     void toBoolean();
84     void toBool();
85     void toInt();
86     void toUInt();
87     void toVariant();
88     void toQObject_nonQObject_data();
89     void toQObject_nonQObject();
90     void toQObject();
91     void toDateTime();
92     void toRegExp();
93     void isArray_data();
94     void isArray();
95     void isDate();
96     void isDate_data();
97     void isError_propertiesOfGlobalObject();
98     void isError_data();
99     void isError();
100     void isRegExp_data();
101     void isRegExp();
102
103 #if 0 // FIXME: No QScriptValue::lessThan
104     void lessThan();
105 #endif
106     void equals();
107     void strictlyEquals();
108
109     void hasProperty_basic();
110     void hasProperty_globalObject();
111     void hasProperty_changePrototype();
112
113     void deleteProperty_basic();
114     void deleteProperty_globalObject();
115     void deleteProperty_inPrototype();
116
117     void getSetPrototype_cyclicPrototype();
118     void getSetPrototype_evalCyclicPrototype();
119     void getSetPrototype_eval();
120     void getSetPrototype_invalidPrototype();
121     void getSetPrototype_twoEngines();
122     void getSetPrototype_null();
123     void getSetPrototype_notObjectOrNull();
124     void getSetPrototype();
125     void getSetScope();
126     void getSetProperty_HooliganTask162051();
127     void getSetProperty_HooliganTask183072();
128     void getSetProperty_propertyRemoval();
129     void getSetProperty_resolveMode();
130     void getSetProperty_twoEngines();
131     void getSetProperty_gettersAndSetters();
132     void getSetProperty_gettersAndSettersThrowErrorNative();
133     void getSetProperty_gettersAndSettersThrowErrorJS();
134     void getSetProperty_gettersAndSettersOnNative();
135     void getSetProperty_gettersAndSettersOnGlobalObject();
136     void getSetProperty_gettersAndSettersChange();
137     void getSetProperty_gettersAndSettersStupid();
138     void getSetProperty_array();
139     void getSetProperty();
140     void arrayElementGetterSetter();
141     void getSetData_objects_data();
142     void getSetData_objects();
143     void getSetData_nonObjects_data();
144     void getSetData_nonObjects();
145     void setData_QTBUG15144();
146 #if 0 // FIXME: no QScriptClass
147     void getSetScriptClass_emptyClass_data();
148     void getSetScriptClass_emptyClass();
149     void getSetScriptClass_JSObjectFromCpp();
150     void getSetScriptClass_JSObjectFromJS();
151     void getSetScriptClass_QVariant();
152     void getSetScriptClass_QObject();
153 #endif
154     void call_function();
155     void call_object();
156     void call_newObjects();
157     void call_this();
158     void call_arguments();
159     void call();
160     void call_invalidArguments();
161     void call_invalidReturn();
162     void call_twoEngines();
163     void call_array();
164     void call_nonFunction_data();
165     void call_nonFunction();
166     void construct_nonFunction_data();
167     void construct_nonFunction();
168     void construct_simple();
169     void construct_newObjectJS();
170 #if 0 // FIXME: no c-style callbacks
171     void construct_undefined();
172     void construct_newObjectCpp();
173 #endif
174     void construct_arg();
175     void construct_proto();
176     void construct_returnInt();
177     void construct_throw();
178 #if 0 // FIXME: The feature of interpreting an array as argument list has been removed from the API
179     void construct();
180 #endif
181     void construct_twoEngines();
182     void construct_constructorThrowsPrimitive();
183     void castToPointer();
184     void prettyPrinter_data();
185     void prettyPrinter();
186     void engineDeleted();
187     void valueOfWithClosure();
188 #if 0 // FIXME: no objectId()
189     void objectId();
190 #endif
191     void nestedObjectToVariant_data();
192     void nestedObjectToVariant();
193
194 private:
195     void newEngine()
196     {
197         if (engine)
198             delete engine;
199         engine = new QJSEngine();
200     }
201     QJSEngine *engine;
202 };
203
204 #endif