12563d658842f6807e7f51ceb54d12820f55f782
[profile/ivi/qtdeclarative.git] / tests / auto / declarative / qdeclarativeecmascript / testtypes.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
6 **
7 ** This file is part of the test suite of the Qt Toolkit.
8 **
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.
17 **
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.
21 **
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.
29 **
30 ** Other Usage
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.
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 #ifndef TESTTYPES_H
42 #define TESTTYPES_H
43
44 #include <QtCore/qobject.h>
45 #include <QtDeclarative/qdeclarative.h>
46 #include <QtDeclarative/qdeclarativeexpression.h>
47 #include <QtCore/qpoint.h>
48 #include <QtCore/qsize.h>
49 #include <QtDeclarative/qdeclarativelist.h>
50 #include <QtCore/qrect.h>
51 #include <QtGui/qmatrix.h>
52 #include <QtGui/qcolor.h>
53 #include <QtGui/qvector3d.h>
54 #include <QtGui/QPixmap>
55 #include <QtCore/qdatetime.h>
56 #include <QtDeclarative/qjsvalue.h>
57 #include <QtDeclarative/qdeclarativescriptstring.h>
58 #include <QtDeclarative/qdeclarativecomponent.h>
59
60 #include <private/qv8gccallback_p.h>
61 #include <private/qdeclarativeengine_p.h>
62 #include <private/qv8engine_p.h>
63
64 class MyQmlAttachedObject : public QObject
65 {
66     Q_OBJECT
67     Q_PROPERTY(int value READ value CONSTANT)
68     Q_PROPERTY(int value2 READ value2 WRITE setValue2 NOTIFY value2Changed)
69 public:
70     MyQmlAttachedObject(QObject *parent) : QObject(parent), m_value2(0) {}
71
72     int value() const { return 19; }
73     int value2() const { return m_value2; }
74     void setValue2(int v) { if (m_value2 == v) return; m_value2 = v; emit value2Changed(); }
75
76     void emitMySignal() { emit mySignal(); }
77
78 signals:
79     void value2Changed();
80     void mySignal();
81
82 private:
83     int m_value2;
84 };
85
86 class MyQmlObject : public QObject
87 {
88     Q_OBJECT
89     Q_ENUMS(MyEnum)
90     Q_ENUMS(MyEnum2)
91     Q_PROPERTY(int deleteOnSet READ deleteOnSet WRITE setDeleteOnSet)
92     Q_PROPERTY(bool trueProperty READ trueProperty CONSTANT)
93     Q_PROPERTY(bool falseProperty READ falseProperty CONSTANT)
94     Q_PROPERTY(int value READ value WRITE setValue)
95     Q_PROPERTY(int console READ console CONSTANT)
96     Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty NOTIFY stringChanged)
97     Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty NOTIFY objectChanged)
98     Q_PROPERTY(QDeclarativeListProperty<QObject> objectListProperty READ objectListProperty CONSTANT)
99     Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty)
100     Q_PROPERTY(QRegExp regExp READ regExp WRITE setRegExp)
101     Q_PROPERTY(int nonscriptable READ nonscriptable WRITE setNonscriptable SCRIPTABLE false)
102     Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty NOTIFY intChanged)
103
104 public:
105     MyQmlObject(): myinvokableObject(0), m_methodCalled(false), m_methodIntCalled(false), m_object(0), m_value(0), m_resetProperty(13), m_intProperty(0) {}
106
107     enum MyEnum { EnumValue1 = 0, EnumValue2 = 1 };
108     enum MyEnum2 { EnumValue3 = 2, EnumValue4 = 3 };
109
110     bool trueProperty() const { return true; }
111     bool falseProperty() const { return false; }
112
113     QString stringProperty() const { return m_string; }
114     void setStringProperty(const QString &s)
115     {
116         if (s == m_string)
117             return;
118         m_string = s;
119         emit stringChanged();
120     }
121
122     QObject *objectProperty() const { return m_object; }
123     void setObjectProperty(QObject *obj) { 
124         if (obj == m_object)
125             return;
126         m_object = obj;
127         emit objectChanged();
128     }
129
130     QDeclarativeListProperty<QObject> objectListProperty() { return QDeclarativeListProperty<QObject>(this, m_objectQList); }
131
132     bool methodCalled() const { return m_methodCalled; }
133     bool methodIntCalled() const { return m_methodIntCalled; }
134
135     QString string() const { return m_string; }
136
137     static MyQmlAttachedObject *qmlAttachedProperties(QObject *o) {
138         return new MyQmlAttachedObject(o);
139     }
140
141     int deleteOnSet() const { return 1; }
142     void setDeleteOnSet(int v) { if(v) delete this; }
143
144     int value() const { return m_value; }
145     void setValue(int v) { m_value = v; }
146
147     int resettableProperty() const { return m_resetProperty; }
148     void setResettableProperty(int v) { m_resetProperty = v; }
149     void resetProperty() { m_resetProperty = 13; }
150
151     QRegExp regExp() { return m_regExp; }
152     void setRegExp(const QRegExp &regExp) { m_regExp = regExp; }
153
154     int console() const { return 11; }
155
156     int nonscriptable() const { return 0; }
157     void setNonscriptable(int) {}
158
159     MyQmlObject *myinvokableObject;
160     Q_INVOKABLE MyQmlObject *returnme() { return this; }
161
162     struct MyType {
163         int value;
164     };
165     QVariant variant() const { return m_variant; }
166
167     int intProperty() const { return m_intProperty; }
168     void setIntProperty(int i) { m_intProperty = i; emit intChanged(); }
169     
170 signals:
171     void basicSignal();
172     void argumentSignal(int a, QString b, qreal c, MyEnum2 d, Qt::MouseButtons e);
173     void stringChanged();
174     void objectChanged();
175     void anotherBasicSignal();
176     void thirdBasicSignal();
177     void signalWithUnknownType(const MyQmlObject::MyType &arg);
178     void signalWithVariant(const QVariant &arg);
179     void intChanged();
180
181 public slots:
182     void deleteMe() { delete this; }
183     void methodNoArgs() { m_methodCalled = true; }
184     void method(int a) { if(a == 163) m_methodIntCalled = true; }
185     void setString(const QString &s) { m_string = s; }
186     void myinvokable(MyQmlObject *o) { myinvokableObject = o; }
187     void variantMethod(const QVariant &v) { m_variant = v; }
188     void v8function(QDeclarativeV8Function*);
189
190 private:
191     friend class tst_qdeclarativeecmascript;
192     bool m_methodCalled;
193     bool m_methodIntCalled;
194
195     QObject *m_object;
196     QString m_string;
197     QList<QObject *> m_objectQList;
198     int m_value;
199     int m_resetProperty;
200     QRegExp m_regExp;
201     QVariant m_variant;
202     int m_intProperty;
203 };
204
205 QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES)
206
207 class MyQmlContainer : public QObject
208 {
209     Q_OBJECT
210     Q_PROPERTY(QDeclarativeListProperty<MyQmlObject> children READ children CONSTANT)
211 public:
212     MyQmlContainer() {}
213
214     QDeclarativeListProperty<MyQmlObject> children() { return QDeclarativeListProperty<MyQmlObject>(this, m_children); }
215
216 private:
217     QList<MyQmlObject*> m_children;
218 };
219
220
221 class MyExpression : public QDeclarativeExpression
222 {
223     Q_OBJECT
224 public:
225     MyExpression(QDeclarativeContext *ctxt, const QString &expr)
226         : QDeclarativeExpression(ctxt, 0, expr), changed(false)
227     {
228         QObject::connect(this, SIGNAL(valueChanged()), this, SLOT(expressionValueChanged()));
229         setNotifyOnValueChanged(true);
230     }
231
232     bool changed;
233
234 public slots:
235     void expressionValueChanged() {
236         changed = true;
237     }
238 };
239
240
241 class MyDefaultObject1 : public QObject
242 {
243     Q_OBJECT
244     Q_PROPERTY(int horseLegs READ horseLegs CONSTANT)
245     Q_PROPERTY(int antLegs READ antLegs CONSTANT)
246     Q_PROPERTY(int emuLegs READ emuLegs CONSTANT)
247 public:
248     int horseLegs() const { return 4; }
249     int antLegs() const { return 6; }
250     int emuLegs() const { return 2; }
251 };
252
253 class MyDefaultObject3 : public QObject
254 {
255     Q_OBJECT
256     Q_PROPERTY(int antLegs READ antLegs CONSTANT)
257     Q_PROPERTY(int humanLegs READ humanLegs CONSTANT)
258 public:
259     int antLegs() const { return 7; } // Mutant
260     int humanLegs() const { return 2; }
261     int millipedeLegs() const { return 1000; }
262 };
263
264 class MyDeferredObject : public QObject
265 {
266     Q_OBJECT
267     Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged)
268     Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty)
269     Q_PROPERTY(QObject *objectProperty2 READ objectProperty2 WRITE setObjectProperty2)
270     Q_CLASSINFO("DeferredPropertyNames", "value,objectProperty,objectProperty2")
271
272 public:
273     MyDeferredObject() : m_value(0), m_object(0), m_object2(0) {}
274
275     int value() const { return m_value; }
276     void setValue(int v) { m_value = v; emit valueChanged(); }
277
278     QObject *objectProperty() const { return m_object; }
279     void setObjectProperty(QObject *obj) { m_object = obj; }
280
281     QObject *objectProperty2() const { return m_object2; }
282     void setObjectProperty2(QObject *obj) { m_object2 = obj; }
283
284 signals:
285     void valueChanged();
286
287 private:
288     int m_value;
289     QObject *m_object;
290     QObject *m_object2;
291 };
292
293 class MyBaseExtendedObject : public QObject
294 {
295 Q_OBJECT
296 Q_PROPERTY(int baseProperty READ baseProperty WRITE setBaseProperty)
297 public:
298     MyBaseExtendedObject() : m_value(0) {}
299
300     int baseProperty() const { return m_value; }
301     void setBaseProperty(int v) { m_value = v; }
302
303 private:
304     int m_value;
305 };
306
307 class MyExtendedObject : public MyBaseExtendedObject
308 {
309 Q_OBJECT
310 Q_PROPERTY(int coreProperty READ coreProperty WRITE setCoreProperty)
311 public:
312     MyExtendedObject() : m_value(0) {}
313
314     int coreProperty() const { return m_value; }
315     void setCoreProperty(int v) { m_value = v; }
316
317 private:
318     int m_value;
319 };
320
321 class MyTypeObject : public QObject
322 {
323     Q_OBJECT
324     Q_ENUMS(MyEnum)
325     Q_FLAGS(MyFlags)
326
327     Q_PROPERTY(QString id READ id WRITE setId)
328     Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty)
329     Q_PROPERTY(QDeclarativeComponent *componentProperty READ componentProperty WRITE setComponentProperty)
330     Q_PROPERTY(MyFlags flagProperty READ flagProperty WRITE setFlagProperty)
331     Q_PROPERTY(MyEnum enumProperty READ enumProperty WRITE setEnumProperty)
332     Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty)
333     Q_PROPERTY(uint uintProperty READ uintProperty WRITE setUintProperty)
334     Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty)
335     Q_PROPERTY(qreal realProperty READ realProperty WRITE setRealProperty)
336     Q_PROPERTY(double doubleProperty READ doubleProperty WRITE setDoubleProperty)
337     Q_PROPERTY(float floatProperty READ floatProperty WRITE setFloatProperty)
338     Q_PROPERTY(QColor colorProperty READ colorProperty WRITE setColorProperty)
339     Q_PROPERTY(QDate dateProperty READ dateProperty WRITE setDateProperty)
340     Q_PROPERTY(QTime timeProperty READ timeProperty WRITE setTimeProperty)
341     Q_PROPERTY(QDateTime dateTimeProperty READ dateTimeProperty WRITE setDateTimeProperty)
342     Q_PROPERTY(QPoint pointProperty READ pointProperty WRITE setPointProperty)
343     Q_PROPERTY(QPointF pointFProperty READ pointFProperty WRITE setPointFProperty)
344     Q_PROPERTY(QSize sizeProperty READ sizeProperty WRITE setSizeProperty)
345     Q_PROPERTY(QSizeF sizeFProperty READ sizeFProperty WRITE setSizeFProperty)
346     Q_PROPERTY(QRect rectProperty READ rectProperty WRITE setRectProperty NOTIFY rectPropertyChanged)
347     Q_PROPERTY(QRect rectProperty2 READ rectProperty2 WRITE setRectProperty2)
348     Q_PROPERTY(QRectF rectFProperty READ rectFProperty WRITE setRectFProperty)
349     Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty)
350     Q_PROPERTY(QVariant variantProperty READ variantProperty WRITE setVariantProperty)
351     Q_PROPERTY(QVector3D vectorProperty READ vectorProperty WRITE setVectorProperty)
352     Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty)
353
354     Q_PROPERTY(QDeclarativeScriptString scriptProperty READ scriptProperty WRITE setScriptProperty)
355
356 public:
357     MyTypeObject()
358         : objectPropertyValue(0), componentPropertyValue(0) {}
359
360     QString idValue;
361     QString id() const {
362         return idValue;
363     }
364     void setId(const QString &v) {
365         idValue = v;
366     }
367
368     QObject *objectPropertyValue;
369     QObject *objectProperty() const {
370         return objectPropertyValue;
371     }
372     void setObjectProperty(QObject *v) {
373         objectPropertyValue = v;
374     }
375
376     QDeclarativeComponent *componentPropertyValue;
377     QDeclarativeComponent *componentProperty() const {
378         return componentPropertyValue;
379     }
380     void setComponentProperty(QDeclarativeComponent *v) {
381         componentPropertyValue = v;
382     }
383
384     enum MyFlag { FlagVal1 = 0x01, FlagVal2 = 0x02, FlagVal3 = 0x04 };
385     Q_DECLARE_FLAGS(MyFlags, MyFlag)
386     MyFlags flagPropertyValue;
387     MyFlags flagProperty() const {
388         return flagPropertyValue;
389     }
390     void setFlagProperty(MyFlags v) {
391         flagPropertyValue = v;
392     }
393
394     enum MyEnum { EnumVal1, EnumVal2 };
395     MyEnum enumPropertyValue;
396     MyEnum enumProperty() const {
397         return enumPropertyValue;
398     }
399     void setEnumProperty(MyEnum v) {
400         enumPropertyValue = v;
401     }
402
403     QString stringPropertyValue;
404     QString stringProperty() const {
405        return stringPropertyValue;
406     }
407     void setStringProperty(const QString &v) {
408         stringPropertyValue = v;
409     }
410
411     uint uintPropertyValue;
412     uint uintProperty() const {
413        return uintPropertyValue;
414     }
415     void setUintProperty(const uint &v) {
416         uintPropertyValue = v;
417     }
418
419     int intPropertyValue;
420     int intProperty() const {
421        return intPropertyValue;
422     }
423     void setIntProperty(const int &v) {
424         intPropertyValue = v;
425     }
426
427     qreal realPropertyValue;
428     qreal realProperty() const {
429        return realPropertyValue;
430     }
431     void setRealProperty(const qreal &v) {
432         realPropertyValue = v;
433     }
434
435     double doublePropertyValue;
436     double doubleProperty() const {
437        return doublePropertyValue;
438     }
439     void setDoubleProperty(const double &v) {
440         doublePropertyValue = v;
441     }
442
443     float floatPropertyValue;
444     float floatProperty() const {
445        return floatPropertyValue;
446     }
447     void setFloatProperty(const float &v) {
448         floatPropertyValue = v;
449     }
450
451     QColor colorPropertyValue;
452     QColor colorProperty() const {
453        return colorPropertyValue;
454     }
455     void setColorProperty(const QColor &v) {
456         colorPropertyValue = v;
457     }
458
459     QDate datePropertyValue;
460     QDate dateProperty() const {
461        return datePropertyValue;
462     }
463     void setDateProperty(const QDate &v) {
464         datePropertyValue = v;
465     }
466
467     QTime timePropertyValue;
468     QTime timeProperty() const {
469        return timePropertyValue;
470     }
471     void setTimeProperty(const QTime &v) {
472         timePropertyValue = v;
473     }
474
475     QDateTime dateTimePropertyValue;
476     QDateTime dateTimeProperty() const {
477        return dateTimePropertyValue;
478     }
479     void setDateTimeProperty(const QDateTime &v) {
480         dateTimePropertyValue = v;
481     }
482
483     QPoint pointPropertyValue;
484     QPoint pointProperty() const {
485        return pointPropertyValue;
486     }
487     void setPointProperty(const QPoint &v) {
488         pointPropertyValue = v;
489     }
490
491     QPointF pointFPropertyValue;
492     QPointF pointFProperty() const {
493        return pointFPropertyValue;
494     }
495     void setPointFProperty(const QPointF &v) {
496         pointFPropertyValue = v;
497     }
498
499     QSize sizePropertyValue;
500     QSize sizeProperty() const {
501        return sizePropertyValue;
502     }
503     void setSizeProperty(const QSize &v) {
504         sizePropertyValue = v;
505     }
506
507     QSizeF sizeFPropertyValue;
508     QSizeF sizeFProperty() const {
509        return sizeFPropertyValue;
510     }
511     void setSizeFProperty(const QSizeF &v) {
512         sizeFPropertyValue = v;
513     }
514
515     QRect rectPropertyValue;
516     QRect rectProperty() const {
517        return rectPropertyValue;
518     }
519     void setRectProperty(const QRect &v) {
520         rectPropertyValue = v;
521         emit rectPropertyChanged();
522     }
523
524     QRect rectPropertyValue2;
525     QRect rectProperty2() const {
526        return rectPropertyValue2;
527     }
528     void setRectProperty2(const QRect &v) {
529         rectPropertyValue2 = v;
530     }
531
532     QRectF rectFPropertyValue;
533     QRectF rectFProperty() const {
534        return rectFPropertyValue;
535     }
536     void setRectFProperty(const QRectF &v) {
537         rectFPropertyValue = v;
538     }
539
540     bool boolPropertyValue;
541     bool boolProperty() const {
542        return boolPropertyValue;
543     }
544     void setBoolProperty(const bool &v) {
545         boolPropertyValue = v;
546     }
547
548     QVariant variantPropertyValue;
549     QVariant variantProperty() const {
550        return variantPropertyValue;
551     }
552     void setVariantProperty(const QVariant &v) {
553         variantPropertyValue = v;
554     }
555
556     QVector3D vectorPropertyValue;
557     QVector3D vectorProperty() const {
558         return vectorPropertyValue;
559     }
560     void setVectorProperty(const QVector3D &v) {
561         vectorPropertyValue = v;
562     }
563
564     QUrl urlPropertyValue;
565     QUrl urlProperty() const {
566         return urlPropertyValue;
567     }
568     void setUrlProperty(const QUrl &v) {
569         urlPropertyValue = v;
570     }
571
572     QDeclarativeScriptString scriptPropertyValue;
573     QDeclarativeScriptString scriptProperty() const {
574         return scriptPropertyValue;
575     }
576     void setScriptProperty(const QDeclarativeScriptString &v) {
577         scriptPropertyValue = v;
578     }
579
580     void doAction() { emit action(); }
581 signals:
582     void action();
583     void rectPropertyChanged();
584 };
585 Q_DECLARE_OPERATORS_FOR_FLAGS(MyTypeObject::MyFlags)
586
587 class MyDerivedObject : public MyTypeObject
588 {
589     Q_OBJECT
590 public:
591     Q_INVOKABLE bool intProperty() const {
592         return true;
593     }
594 };
595
596 Q_DECLARE_METATYPE(QJSValue);
597 class MyInvokableBaseObject : public QObject
598 {
599     Q_OBJECT
600 public:
601     inline ~MyInvokableBaseObject() = 0;
602
603     Q_INVOKABLE inline void method_inherited(int a);
604     Q_INVOKABLE inline void method_overload();
605 };
606
607 class MyInvokableObject : public MyInvokableBaseObject
608 {
609     Q_OBJECT
610     Q_ENUMS(TestEnum)
611 public:
612     enum TestEnum { EnumValue1, EnumValue2 };
613     MyInvokableObject() { reset(); }
614
615     int invoked() const { return m_invoked; }
616     bool error() const { return m_invokedError; }
617     const QVariantList &actuals() const { return m_actuals; }
618     void reset() { m_invoked = -1; m_invokedError = false; m_actuals.clear(); }
619
620     Q_INVOKABLE QPointF method_get_QPointF() { return QPointF(99.3, -10.2); }
621     Q_INVOKABLE QPoint method_get_QPoint() { return QPoint(9, 12); }
622
623     Q_INVOKABLE void method_NoArgs() { invoke(0); }
624     Q_INVOKABLE int method_NoArgs_int() { invoke(1); return 6; }
625     Q_INVOKABLE qreal method_NoArgs_real() { invoke(2); return 19.75; }
626     Q_INVOKABLE QPointF method_NoArgs_QPointF() { invoke(3); return QPointF(123, 4.5); }
627     Q_INVOKABLE QObject *method_NoArgs_QObject() { invoke(4); return this; }
628     Q_INVOKABLE MyInvokableObject *method_NoArgs_unknown() { invoke(5); return this; }
629     Q_INVOKABLE QJSValue method_NoArgs_QScriptValue() { invoke(6); return QJSValue("Hello world"); }
630     Q_INVOKABLE QVariant method_NoArgs_QVariant() { invoke(7); return QVariant("QML rocks"); }
631
632     Q_INVOKABLE void method_int(int a) { invoke(8); m_actuals << a; }
633     Q_INVOKABLE void method_intint(int a, int b) { invoke(9); m_actuals << a << b; }
634     Q_INVOKABLE void method_real(qreal a) { invoke(10); m_actuals << a; }
635     Q_INVOKABLE void method_QString(QString a) { invoke(11); m_actuals << a; }
636     Q_INVOKABLE void method_QPointF(QPointF a) { invoke(12); m_actuals << a; }
637     Q_INVOKABLE void method_QObject(QObject *a) { invoke(13); m_actuals << qVariantFromValue(a); }
638     Q_INVOKABLE void method_QScriptValue(QJSValue a) { invoke(14); m_actuals << qVariantFromValue(a); }
639     Q_INVOKABLE void method_intQScriptValue(int a, QJSValue b) { invoke(15); m_actuals << a << qVariantFromValue(b); }
640     
641     Q_INVOKABLE void method_overload(int a) { invoke(16); m_actuals << a; }
642     Q_INVOKABLE void method_overload(int a, int b) { invoke(17); m_actuals << a << b; }
643     Q_INVOKABLE void method_overload(QString a) { invoke(18); m_actuals << a; }
644
645     Q_INVOKABLE void method_with_enum(TestEnum e) { invoke(19); m_actuals << (int)e; }
646
647     Q_INVOKABLE int method_default(int a, int b = 19) { invoke(20); m_actuals << a << b; return b; }
648
649     Q_INVOKABLE void method_QVariant(QVariant a, QVariant b = QVariant()) { invoke(21); m_actuals << a << b; }
650
651 private:
652     friend class MyInvokableBaseObject;
653     void invoke(int idx) { if (m_invoked != -1) m_invokedError = true; m_invoked = idx;}
654     int m_invoked;
655     bool m_invokedError;
656     QVariantList m_actuals;
657 };
658
659 MyInvokableBaseObject::~MyInvokableBaseObject() {}
660
661 void MyInvokableBaseObject::method_inherited(int a)
662 {
663     static_cast<MyInvokableObject *>(this)->invoke(-3);
664     static_cast<MyInvokableObject *>(this)->m_actuals << a;
665 }
666
667 // This is a hidden overload of the MyInvokableObject::method_overload() method
668 void MyInvokableBaseObject::method_overload()
669 {
670     static_cast<MyInvokableObject *>(this)->invoke(-2);
671 }
672
673 class NumberAssignment : public QObject
674 {
675     Q_OBJECT
676 public:
677     Q_PROPERTY(qreal test1 READ test1 WRITE setTest1)
678     qreal _test1;
679     qreal test1() const { return _test1; }
680     void setTest1(qreal v) { _test1 = v; }
681
682     Q_PROPERTY(qreal test2 READ test2 WRITE setTest2)
683     qreal _test2;
684     qreal test2() const { return _test2; }
685     void setTest2(qreal v) { _test2 = v; }
686
687     Q_PROPERTY(qreal test3 READ test3 WRITE setTest3)
688     qreal _test3;
689     qreal test3() const { return _test3; }
690     void setTest3(qreal v) { _test3 = v; }
691
692     Q_PROPERTY(qreal test4 READ test4 WRITE setTest4)
693     qreal _test4;
694     qreal test4() const { return _test4; }
695     void setTest4(qreal v) { _test4 = v; }
696
697     Q_PROPERTY(int test5 READ test5 WRITE setTest5)
698     int _test5;
699     int test5() const { return _test5; }
700     void setTest5(int v) { _test5 = v; }
701
702     Q_PROPERTY(int test6 READ test6 WRITE setTest6)
703     int _test6;
704     int test6() const { return _test6; }
705     void setTest6(int v) { _test6 = v; }
706
707     Q_PROPERTY(int test7 READ test7 WRITE setTest7)
708     int _test7;
709     int test7() const { return _test7; }
710     void setTest7(int v) { _test7 = v; }
711
712     Q_PROPERTY(int test8 READ test8 WRITE setTest8)
713     int _test8;
714     int test8() const { return _test8; }
715     void setTest8(int v) { _test8 = v; }
716
717     Q_PROPERTY(unsigned int test9 READ test9 WRITE setTest9)
718     unsigned int _test9;
719     unsigned int test9() const { return _test9; }
720     void setTest9(unsigned int v) { _test9 = v; }
721
722     Q_PROPERTY(unsigned int test10 READ test10 WRITE setTest10)
723     unsigned int _test10;
724     unsigned int test10() const { return _test10; }
725     void setTest10(unsigned int v) { _test10 = v; }
726
727     Q_PROPERTY(unsigned int test11 READ test11 WRITE setTest11)
728     unsigned int _test11;
729     unsigned int test11() const { return _test11; }
730     void setTest11(unsigned int v) { _test11 = v; }
731
732     Q_PROPERTY(unsigned int test12 READ test12 WRITE setTest12)
733     unsigned int _test12;
734     unsigned int test12() const { return _test12; }
735     void setTest12(unsigned int v) { _test12 = v; }
736 };
737
738 class DefaultPropertyExtendedObject : public QObject
739 {
740     Q_OBJECT
741     Q_PROPERTY(QObject *firstProperty READ firstProperty WRITE setFirstProperty)
742     Q_PROPERTY(QObject *secondProperty READ secondProperty WRITE setSecondProperty)
743 public:
744     DefaultPropertyExtendedObject(QObject *parent = 0) : QObject(parent), m_firstProperty(0), m_secondProperty(0) {}
745
746     QObject *firstProperty() const { return m_firstProperty; }
747     QObject *secondProperty() const { return m_secondProperty; }
748     void setFirstProperty(QObject *property) { m_firstProperty = property; }
749     void setSecondProperty(QObject *property) { m_secondProperty = property; }
750 private:
751     QObject* m_firstProperty;
752     QObject* m_secondProperty;
753 };
754
755 class OverrideDefaultPropertyObject : public DefaultPropertyExtendedObject
756 {
757     Q_OBJECT
758     Q_CLASSINFO("DefaultProperty", "secondProperty")
759 public:
760     OverrideDefaultPropertyObject() {}
761 };
762
763 class MyRevisionedBaseClassRegistered : public QObject
764 {
765 Q_OBJECT
766     Q_PROPERTY(qreal propA READ propA WRITE setPropA NOTIFY propAChanged)
767     Q_PROPERTY(qreal propB READ propB WRITE setPropB NOTIFY propBChanged REVISION 1)
768
769 public:
770     MyRevisionedBaseClassRegistered() : m_pa(1), m_pb(2) {}
771
772     qreal propA() const { return m_pa; }
773     void setPropA(qreal p) {
774         if (p != m_pa) {
775             m_pa = p;
776             emit propAChanged();
777         }
778     }
779     qreal propB() const { return m_pb; }
780     void setPropB(qreal p) {
781         if (p != m_pb) {
782             m_pb = p;
783             emit propBChanged();
784         }
785     }
786
787     Q_INVOKABLE void methodA() { }
788     Q_INVOKABLE Q_REVISION(1) void methodB() { }
789
790 signals:
791     void propAChanged();
792     void propBChanged();
793
794     void signalA();
795     Q_REVISION(1) void signalB();
796
797 protected:
798     qreal m_pa;
799     qreal m_pb;
800 };
801
802 class MyRevisionedBaseClassUnregistered : public MyRevisionedBaseClassRegistered
803 {
804 Q_OBJECT
805     Q_PROPERTY(qreal propC READ propC WRITE setPropC NOTIFY propCChanged)
806     Q_PROPERTY(qreal propD READ propD WRITE setPropD NOTIFY propDChanged REVISION 1)
807
808 public:
809     MyRevisionedBaseClassUnregistered() : m_pc(1), m_pd(2) {}
810
811     qreal propC() const { return m_pc; }
812     void setPropC(qreal p) {
813         if (p != m_pc) {
814             m_pc = p;
815             emit propCChanged();
816         }
817     }
818     qreal propD() const { return m_pd; }
819     void setPropD(qreal p) {
820         if (p != m_pd) {
821             m_pd = p;
822             emit propDChanged();
823         }
824     }
825
826     Q_INVOKABLE void methodC() { }
827     Q_INVOKABLE Q_REVISION(1) void methodD() { }
828
829 signals:
830     void propCChanged();
831     void propDChanged();
832
833     void signalC();
834     Q_REVISION(1) void signalD();
835
836 protected:
837     qreal m_pc;
838     qreal m_pd;
839 };
840
841 class MyRevisionedClass : public MyRevisionedBaseClassUnregistered
842 {
843     Q_OBJECT
844     Q_PROPERTY(qreal prop1 READ prop1 WRITE setProp1 NOTIFY prop1Changed)
845     Q_PROPERTY(qreal prop2 READ prop2 WRITE setProp2 NOTIFY prop2Changed REVISION 1)
846
847 public:
848     MyRevisionedClass() {}
849
850     qreal prop1() const { return m_p1; }
851     void setProp1(qreal p) {
852         if (p != m_p1) {
853             m_p1 = p;
854             emit prop1Changed();
855         }
856     }
857     qreal prop2() const { return m_p2; }
858     void setProp2(qreal p) {
859         if (p != m_p2) {
860             m_p2 = p;
861             emit prop2Changed();
862         }
863     }
864
865     Q_INVOKABLE void method1() { }
866     Q_INVOKABLE Q_REVISION(1) void method2() { }
867
868 signals:
869     void prop1Changed();
870     void prop2Changed();
871
872     void signal1();
873     Q_REVISION(1) void signal2();
874
875 protected:
876     qreal m_p1;
877     qreal m_p2;
878 };
879
880 class MyRevisionedSubclass : public MyRevisionedClass
881 {
882     Q_OBJECT
883     Q_PROPERTY(qreal prop3 READ prop3 WRITE setProp3 NOTIFY prop3Changed)
884     Q_PROPERTY(qreal prop4 READ prop4 WRITE setProp4 NOTIFY prop4Changed REVISION 1)
885
886 public:
887     MyRevisionedSubclass() : m_p3(3), m_p4(4) {}
888
889     qreal prop3() const { return m_p3; }
890     void setProp3(qreal p) {
891         if (p != m_p3) {
892             m_p3 = p;
893             emit prop3Changed();
894         }
895     }
896     qreal prop4() const { return m_p4; }
897     void setProp4(qreal p) {
898         if (p != m_p4) {
899             m_p4 = p;
900             emit prop4Changed();
901         }
902     }
903
904     Q_INVOKABLE void method3() { }
905     Q_INVOKABLE Q_REVISION(1) void method4() { }
906
907 signals:
908     void prop3Changed();
909     void prop4Changed();
910
911     void signal3();
912     Q_REVISION(1) void signal4();
913
914 protected:
915     qreal m_p3;
916     qreal m_p4;
917 };
918
919 QML_DECLARE_TYPE(MyRevisionedBaseClassRegistered)
920 QML_DECLARE_TYPE(MyRevisionedBaseClassUnregistered)
921 QML_DECLARE_TYPE(MyRevisionedClass)
922 QML_DECLARE_TYPE(MyRevisionedSubclass)
923 Q_DECLARE_METATYPE(MyQmlObject::MyType)
924
925
926 class ScarceResourceObject : public QObject
927 {
928     Q_OBJECT
929     Q_PROPERTY(QPixmap scarceResource READ scarceResource WRITE setScarceResource NOTIFY scarceResourceChanged)
930 public:
931     ScarceResourceObject(QObject *parent = 0) : QObject(parent), m_value(100, 100) { m_value.fill(Qt::blue); }
932     ~ScarceResourceObject() {}
933
934     QPixmap scarceResource() const { return m_value; }
935     void setScarceResource(QPixmap v) { m_value = v; emit scarceResourceChanged(); }
936
937     bool scarceResourceIsDetached() const { return m_value.isDetached(); }
938
939     // this particular one returns a new one each time
940     // this means that every Scarce Resource Copy will
941     // consume resources (so that we can track disposal
942     // of v8 handles with circular references).
943     Q_INVOKABLE QPixmap newScarceResource() const
944     {
945         QPixmap retn(800, 600);
946         retn.fill(QColor(100, 110, 120, 45));
947         return retn;
948     }
949
950 signals:
951     void scarceResourceChanged();
952
953 private:
954     QPixmap m_value;
955 };
956 QML_DECLARE_TYPE(ScarceResourceObject)
957
958 class testQObjectApi : public QObject
959 {
960     Q_OBJECT
961     Q_ENUMS(MyEnum)
962     Q_PROPERTY (int qobjectTestProperty READ qobjectTestProperty NOTIFY qobjectTestPropertyChanged)
963     Q_PROPERTY (int qobjectTestWritableProperty READ qobjectTestWritableProperty WRITE setQObjectTestWritableProperty NOTIFY qobjectTestWritablePropertyChanged)
964
965 public:
966     testQObjectApi(QObject* parent = 0)
967         : QObject(parent), m_testProperty(0), m_testWritableProperty(0), m_methodCallCount(0)
968     {
969     }
970
971     ~testQObjectApi() {}
972
973     enum MyEnum { EnumValue1 = 25, EnumValue2 = 42 };
974     Q_INVOKABLE int qobjectEnumTestMethod(MyEnum val) { return (static_cast<int>(val) + 5); }
975     Q_INVOKABLE int qobjectTestMethod(int increment = 1) { m_methodCallCount += increment; return m_methodCallCount; }
976
977     int qobjectTestProperty() const { return m_testProperty; }
978     void setQObjectTestProperty(int tp) { m_testProperty = tp; emit qobjectTestPropertyChanged(tp); }
979
980     int qobjectTestWritableProperty() const { return m_testWritableProperty; }
981     void setQObjectTestWritableProperty(int tp) { m_testWritableProperty = tp; emit qobjectTestWritablePropertyChanged(tp); }
982
983 signals:
984     void qobjectTestPropertyChanged(int testProperty);
985     void qobjectTestWritablePropertyChanged(int testWritableProperty);
986
987 private:
988     int m_testProperty;
989     int m_testWritableProperty;
990     int m_methodCallCount;
991 };
992
993 class CircularReferenceObject : public QObject,
994                                 public QV8GCCallback::Node
995 {
996     Q_OBJECT
997
998 public:
999     CircularReferenceObject(QObject *parent = 0)
1000         : QObject(parent), QV8GCCallback::Node(callback), m_referenced(0), m_dtorCount(0)
1001     {
1002         QV8GCCallback::addGcCallbackNode(this);
1003     }
1004
1005     ~CircularReferenceObject()
1006     {
1007         if (m_dtorCount) *m_dtorCount = *m_dtorCount + 1;
1008     }
1009
1010     Q_INVOKABLE void setDtorCount(int *dtorCount)
1011     {
1012         m_dtorCount = dtorCount;
1013     }
1014
1015     Q_INVOKABLE CircularReferenceObject *generate(QObject *parent = 0)
1016     {
1017         CircularReferenceObject *retn = new CircularReferenceObject(parent);
1018         retn->m_dtorCount = m_dtorCount;
1019         return retn;
1020     }
1021
1022     Q_INVOKABLE void addReference(QObject *other)
1023     {
1024         m_referenced = other;
1025     }
1026
1027     static void callback(QV8GCCallback::Referencer *r, QV8GCCallback::Node *n)
1028     {
1029         CircularReferenceObject *cro = static_cast<CircularReferenceObject*>(n);
1030         if (cro->m_referenced) {
1031             r->addRelationship(cro, cro->m_referenced);
1032         }
1033     }
1034
1035 private:
1036     QObject *m_referenced;
1037     int *m_dtorCount;
1038 };
1039 Q_DECLARE_METATYPE(CircularReferenceObject*)
1040
1041 class CircularReferenceHandle : public QObject,
1042                                 public QV8GCCallback::Node
1043 {
1044     Q_OBJECT
1045
1046 public:
1047     CircularReferenceHandle(QObject *parent = 0)
1048         : QObject(parent), QV8GCCallback::Node(gccallback), m_dtorCount(0)
1049     {
1050         QV8GCCallback::addGcCallbackNode(this);
1051     }
1052
1053     ~CircularReferenceHandle()
1054     {
1055         if (m_dtorCount) *m_dtorCount = *m_dtorCount + 1;
1056     }
1057
1058     Q_INVOKABLE void setDtorCount(int *dtorCount)
1059     {
1060         m_dtorCount = dtorCount;
1061     }
1062
1063     Q_INVOKABLE CircularReferenceHandle *generate(QObject *parent = 0)
1064     {
1065         CircularReferenceHandle *retn = new CircularReferenceHandle(parent);
1066         retn->m_dtorCount = m_dtorCount;
1067         return retn;
1068     }
1069
1070     Q_INVOKABLE void addReference(v8::Persistent<v8::Value> handle)
1071     {
1072         m_referenced = qPersistentNew(handle);
1073         m_referenced.MakeWeak(static_cast<void*>(this), wrcallback);
1074     }
1075
1076     static void wrcallback(v8::Persistent<v8::Value> handle, void *params)
1077     {
1078         CircularReferenceHandle *crh = static_cast<CircularReferenceHandle*>(params);
1079         qPersistentDispose(handle);
1080         crh->m_referenced.Clear();
1081     }
1082
1083     static void gccallback(QV8GCCallback::Referencer *r, QV8GCCallback::Node *n)
1084     {
1085         CircularReferenceHandle *crh = static_cast<CircularReferenceHandle*>(n);
1086         r->addRelationship(crh, crh->m_referenced);
1087     }
1088
1089 private:
1090     v8::Persistent<v8::Value> m_referenced;
1091     int *m_dtorCount;
1092 };
1093 Q_DECLARE_METATYPE(CircularReferenceHandle*)
1094
1095 class MyDynamicCreationDestructionObject : public QObject
1096 {
1097     Q_OBJECT
1098     Q_PROPERTY (int intProperty READ intProperty WRITE setIntProperty NOTIFY intPropertyChanged)
1099
1100 public:
1101     MyDynamicCreationDestructionObject(QObject *parent = 0) : QObject(parent), m_intProperty(0), m_dtorCount(0)
1102     {
1103     }
1104
1105     ~MyDynamicCreationDestructionObject()
1106     {
1107         if (m_dtorCount) {
1108             (*m_dtorCount)++;
1109         }
1110     }
1111
1112     int intProperty() const { return m_intProperty; }
1113     void setIntProperty(int val) { m_intProperty = val; emit intPropertyChanged(); }
1114
1115     Q_INVOKABLE MyDynamicCreationDestructionObject *createNew()
1116     {
1117         // no parent == ownership transfers to JS; same dtor counter.
1118         MyDynamicCreationDestructionObject *retn = new MyDynamicCreationDestructionObject;
1119         retn->setDtorCount(m_dtorCount);
1120         return retn;
1121     }
1122
1123     void setDtorCount(int *dtorCount)
1124     {
1125         m_dtorCount = dtorCount;
1126     }
1127
1128 signals:
1129     void intPropertyChanged();
1130
1131 private:
1132     int m_intProperty;
1133     int *m_dtorCount;
1134 };
1135
1136 class WriteCounter : public QObject
1137 {
1138     Q_OBJECT
1139     Q_PROPERTY(int value READ value WRITE setValue);
1140 public:
1141     WriteCounter() : m_value(0), m_count(0) {}
1142
1143     int value() const { return m_value; }
1144     void setValue(int v) { m_value = v; ++m_count; }
1145
1146     int count() const { return m_count; }
1147
1148 private:
1149     int m_value;
1150     int m_count;
1151 };
1152
1153 class MySequenceConversionObject : public QObject
1154 {
1155     Q_OBJECT
1156
1157     Q_PROPERTY (QList<int> intListProperty READ intListProperty WRITE setIntListProperty NOTIFY intListPropertyChanged)
1158     Q_PROPERTY (QList<int> intListProperty2 READ intListProperty2 WRITE setIntListProperty2 NOTIFY intListProperty2Changed)
1159     Q_PROPERTY (QList<qreal> qrealListProperty READ qrealListProperty WRITE setQrealListProperty NOTIFY qrealListPropertyChanged)
1160     Q_PROPERTY (QList<bool> boolListProperty READ boolListProperty WRITE setBoolListProperty NOTIFY boolListPropertyChanged)
1161     Q_PROPERTY (QList<QString> stringListProperty READ stringListProperty WRITE setStringListProperty NOTIFY stringListPropertyChanged)
1162     Q_PROPERTY (QList<QUrl> urlListProperty READ urlListProperty WRITE setUrlListProperty NOTIFY urlListPropertyChanged)
1163
1164     Q_PROPERTY (QStringList qstringListProperty READ qstringListProperty WRITE setQStringListProperty NOTIFY qstringListPropertyChanged)
1165     Q_PROPERTY (QList<QPoint> pointListProperty READ pointListProperty WRITE setPointListProperty NOTIFY pointListPropertyChanged)
1166
1167 public:
1168     MySequenceConversionObject()
1169     {
1170         m_intList << 1 << 2 << 3 << 4;
1171         m_intList2 << 1 << 2 << 3 << 4;
1172         m_qrealList << 1.1 << 2.2 << 3.3 << 4.4;
1173         m_boolList << true << false << true << false;
1174         m_stringList << QLatin1String("first") << QLatin1String("second") << QLatin1String("third") << QLatin1String("fourth");
1175         m_urlList << QUrl("http://www.example1.com") << QUrl("http://www.example2.com") << QUrl("http://www.example3.com");
1176
1177         m_qstringList << QLatin1String("first") << QLatin1String("second") << QLatin1String("third") << QLatin1String("fourth");
1178         m_pointList << QPoint(1, 2) << QPoint(3, 4) << QPoint(5, 6);
1179     }
1180
1181     ~MySequenceConversionObject() {}
1182
1183     QList<int> intListProperty() const { return m_intList; }
1184     void setIntListProperty(const QList<int> &list) { m_intList = list; emit intListPropertyChanged(); }
1185     QList<int> intListProperty2() const { return m_intList2; }
1186     void setIntListProperty2(const QList<int> &list) { m_intList2 = list; emit intListProperty2Changed(); }
1187     QList<qreal> qrealListProperty() const { return m_qrealList; }
1188     void setQrealListProperty(const QList<qreal> &list) { m_qrealList = list; emit qrealListPropertyChanged(); }
1189     QList<bool> boolListProperty() const { return m_boolList; }
1190     void setBoolListProperty(const QList<bool> &list) { m_boolList = list; emit boolListPropertyChanged(); }
1191     QList<QString> stringListProperty() const { return m_stringList; }
1192     void setStringListProperty(const QList<QString> &list) { m_stringList = list; emit stringListPropertyChanged(); }
1193     QList<QUrl> urlListProperty() const { return m_urlList; }
1194     void setUrlListProperty(const QList<QUrl> &list) { m_urlList = list; emit urlListPropertyChanged(); }
1195     QStringList qstringListProperty() const { return m_qstringList; }
1196     void setQStringListProperty(const QStringList &list) { m_qstringList = list; emit qstringListPropertyChanged(); }
1197     QList<QPoint> pointListProperty() const { return m_pointList; }
1198     void setPointListProperty(const QList<QPoint> &list) { m_pointList = list; emit pointListPropertyChanged(); }
1199
1200     // now for "copy resource" sequences:
1201     Q_INVOKABLE QList<int> generateIntSequence() const { QList<int> retn; retn << 1 << 2 << 3; return retn; }
1202     Q_INVOKABLE QList<qreal> generateQrealSequence() const { QList<qreal> retn; retn << 1.1 << 2.2 << 3.3; return retn; }
1203     Q_INVOKABLE QList<bool> generateBoolSequence() const { QList<bool> retn; retn << true << false << true; return retn; }
1204     Q_INVOKABLE QList<QString> generateStringSequence() const { QList<QString> retn; retn << "one" << "two" << "three"; return retn; }
1205     Q_INVOKABLE QList<QUrl> generateUrlSequence() const { QList<QUrl> retn; retn << QUrl("http://www.example1.com") << QUrl("http://www.example2.com") << QUrl("http://www.example3.com"); return retn; }
1206     Q_INVOKABLE QStringList generateQStringSequence() const { QStringList retn; retn << "one" << "two" << "three"; return retn; }
1207
1208     // "reference resource" underlying qobject deletion test:
1209     Q_INVOKABLE MySequenceConversionObject *generateTestObject() const { return new MySequenceConversionObject; }
1210     Q_INVOKABLE void deleteTestObject(QObject *object) const { delete object; }
1211
1212 signals:
1213     void intListPropertyChanged();
1214     void intListProperty2Changed();
1215     void qrealListPropertyChanged();
1216     void boolListPropertyChanged();
1217     void stringListPropertyChanged();
1218     void urlListPropertyChanged();
1219     void qstringListPropertyChanged();
1220     void pointListPropertyChanged();
1221
1222 private:
1223     QList<int> m_intList;
1224     QList<int> m_intList2;
1225     QList<qreal> m_qrealList;
1226     QList<bool> m_boolList;
1227     QList<QString> m_stringList;
1228     QList<QUrl> m_urlList;
1229
1230     QStringList m_qstringList; // not a supported sequence type, but QStringList support is hardcoded.
1231     QList<QPoint> m_pointList; // not a supported sequence type
1232 };
1233
1234 class MyDeleteObject : public QObject
1235 {
1236     Q_OBJECT
1237     Q_PROPERTY(QObject *nestedObject READ nestedObject NOTIFY nestedObjectChanged);
1238     Q_PROPERTY(int deleteNestedObject READ deleteNestedObject NOTIFY deleteNestedObjectChanged);
1239
1240 public:
1241     MyDeleteObject() : m_nestedObject(new MyQmlObject) {}
1242
1243     QObject *nestedObject() const { return m_nestedObject; }
1244     int deleteNestedObject() { delete m_nestedObject; m_nestedObject = 0; return 1; }
1245
1246 signals:
1247     void nestedObjectChanged();
1248     void deleteNestedObjectChanged();
1249
1250 private:
1251     MyQmlObject *m_nestedObject;
1252 };
1253
1254 void registerTypes();
1255
1256 #endif // TESTTYPES_H
1257