| 1 | /**************************************************************************** |
|---|---|
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the test suite of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
| 21 | ** included in the packaging of this file. Please review the following |
| 22 | ** information to ensure the GNU General Public License requirements will |
| 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
| 24 | ** |
| 25 | ** $QT_END_LICENSE$ |
| 26 | ** |
| 27 | ****************************************************************************/ |
| 28 | |
| 29 | #ifndef TST_QJSVALUE_H |
| 30 | #define TST_QJSVALUE_H |
| 31 | |
| 32 | #include <QtCore/qobject.h> |
| 33 | #include <QtCore/qnumeric.h> |
| 34 | #include <qjsengine.h> |
| 35 | #include <qjsvalue.h> |
| 36 | #include <QtTest/QtTest> |
| 37 | |
| 38 | class tst_QJSValue : public QObject |
| 39 | { |
| 40 | Q_OBJECT |
| 41 | |
| 42 | public: |
| 43 | tst_QJSValue(); |
| 44 | virtual ~tst_QJSValue(); |
| 45 | |
| 46 | private slots: |
| 47 | void ctor_invalid(); |
| 48 | void ctor_undefinedWithEngine(); |
| 49 | void ctor_undefined(); |
| 50 | void ctor_nullWithEngine(); |
| 51 | void ctor_null(); |
| 52 | void ctor_boolWithEngine(); |
| 53 | void ctor_bool(); |
| 54 | void ctor_intWithEngine(); |
| 55 | void ctor_int(); |
| 56 | void ctor_uintWithEngine(); |
| 57 | void ctor_uint(); |
| 58 | void ctor_floatWithEngine(); |
| 59 | void ctor_float(); |
| 60 | void ctor_stringWithEngine(); |
| 61 | void ctor_string(); |
| 62 | void ctor_copyAndAssignWithEngine(); |
| 63 | void ctor_copyAndAssign(); |
| 64 | |
| 65 | void toString(); |
| 66 | void toNumber(); |
| 67 | void toBoolean(); |
| 68 | void toBool(); |
| 69 | void toInt(); |
| 70 | void toUInt(); |
| 71 | void toVariant(); |
| 72 | void toQObject_nonQObject_data(); |
| 73 | void toQObject_nonQObject(); |
| 74 | void toQObject(); |
| 75 | void toDateTime(); |
| 76 | void toRegExp(); |
| 77 | void toRegularExpression(); |
| 78 | void isArray_data(); |
| 79 | void isArray(); |
| 80 | void isDate(); |
| 81 | void isDate_data(); |
| 82 | void isError_propertiesOfGlobalObject(); |
| 83 | void isError_data(); |
| 84 | void isError(); |
| 85 | void isRegExp_data(); |
| 86 | void isRegExp(); |
| 87 | |
| 88 | void equals(); |
| 89 | void strictlyEquals(); |
| 90 | |
| 91 | void hasProperty_basic(); |
| 92 | void hasProperty_globalObject(); |
| 93 | void hasProperty_changePrototype(); |
| 94 | void hasProperty_QTBUG56830_data(); |
| 95 | void hasProperty_QTBUG56830(); |
| 96 | |
| 97 | void deleteProperty_basic(); |
| 98 | void deleteProperty_globalObject(); |
| 99 | void deleteProperty_inPrototype(); |
| 100 | |
| 101 | void getSetPrototype_cyclicPrototype(); |
| 102 | void getSetPrototype_evalCyclicPrototype(); |
| 103 | void getSetPrototype_eval(); |
| 104 | void getSetPrototype_invalidPrototype(); |
| 105 | void getSetPrototype_twoEngines(); |
| 106 | void getSetPrototype_null(); |
| 107 | void getSetPrototype_notObjectOrNull(); |
| 108 | void getSetPrototype(); |
| 109 | void getSetProperty_HooliganTask162051(); |
| 110 | void getSetProperty_HooliganTask183072(); |
| 111 | void getSetProperty_propertyRemoval(); |
| 112 | void getSetProperty_resolveMode(); |
| 113 | void getSetProperty_twoEngines(); |
| 114 | void getSetProperty_gettersAndSettersThrowErrorJS(); |
| 115 | void getSetProperty_array(); |
| 116 | void getSetProperty(); |
| 117 | |
| 118 | void call_function(); |
| 119 | void call_object(); |
| 120 | void call_newObjects(); |
| 121 | void call_this(); |
| 122 | void call_arguments(); |
| 123 | void call(); |
| 124 | void call_twoEngines(); |
| 125 | void call_nonFunction_data(); |
| 126 | void call_nonFunction(); |
| 127 | void construct_nonFunction_data(); |
| 128 | void construct_nonFunction(); |
| 129 | void construct_simple(); |
| 130 | void construct_newObjectJS(); |
| 131 | void construct_arg(); |
| 132 | void construct_proto(); |
| 133 | void construct_returnInt(); |
| 134 | void construct_throw(); |
| 135 | void construct_twoEngines(); |
| 136 | void construct_constructorThrowsPrimitive(); |
| 137 | void castToPointer(); |
| 138 | void prettyPrinter_data(); |
| 139 | void prettyPrinter(); |
| 140 | void engineDeleted(); |
| 141 | void valueOfWithClosure(); |
| 142 | void nestedObjectToVariant_data(); |
| 143 | void nestedObjectToVariant(); |
| 144 | |
| 145 | void jsvalueArrayToSequenceType(); |
| 146 | |
| 147 | void deleteFromDifferentThread(); |
| 148 | |
| 149 | private: |
| 150 | void newEngine() |
| 151 | { |
| 152 | if (engine) |
| 153 | delete engine; |
| 154 | engine = new QJSEngine(); |
| 155 | } |
| 156 | QJSEngine *engine; |
| 157 | }; |
| 158 | |
| 159 | #endif |
| 160 |
