aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
diff options
context:
space:
mode:
authorChris Adams <christopher.adams@nokia.com>2012-02-08 15:45:18 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-15 07:26:36 +0100
commit3c3b9956c6ba18c424027ec77dfcddbe7bac60b9 (patch)
tree50ede7228f1b93abea0ef1467b5b74a1cffd5d21 /tests/auto/declarative/qdeclarativeecmascript/testtypes.h
parent03883c22264df65586db0a603569c9d196e06034 (diff)
Fix warnings in sequence wrapper code
Previously, the sequence wrapper had unsigned int / signed int comparisons (due to Qt container classes only allowing signed int indexes (where negative indexes are invalid). This commit ensures that unsigned indexes are bounds checked appropriately, and also fixes a warning due to QString construction from QByteArray. Finally, it updates the documentation for sequences to clarify the indexing semantics. Change-Id: I4c6e133bef6e980a9ccb62ff15a70a5d41537ee3 Reviewed-by: Martin Jones <martin.jones@nokia.com> Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qdeclarativeecmascript/testtypes.h')
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/testtypes.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
index d413209062..a463d3f64a 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
+++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
@@ -1194,6 +1194,10 @@ class MySequenceConversionObject : public QObject
Q_PROPERTY (QList<QPoint> pointListProperty READ pointListProperty WRITE setPointListProperty NOTIFY pointListPropertyChanged)
Q_PROPERTY (QList<QVariant> variantListProperty READ variantListProperty WRITE setVariantListProperty NOTIFY variantListPropertyChanged)
+ Q_PROPERTY (qint32 maxIndex READ maxIndex CONSTANT)
+ Q_PROPERTY (quint32 tooBigIndex READ tooBigIndex CONSTANT)
+ Q_PROPERTY (qint32 negativeIndex READ negativeIndex CONSTANT)
+
public:
MySequenceConversionObject()
{
@@ -1211,6 +1215,21 @@ public:
~MySequenceConversionObject() {}
+ qint32 maxIndex() const
+ {
+ return INT_MAX;
+ }
+ quint32 tooBigIndex() const
+ {
+ quint32 retn = 7;
+ retn += INT_MAX;
+ return retn;
+ }
+ qint32 negativeIndex() const
+ {
+ return -5;
+ }
+
QList<int> intListProperty() const { return m_intList; }
void setIntListProperty(const QList<int> &list) { m_intList = list; emit intListPropertyChanged(); }
QList<int> intListProperty2() const { return m_intList2; }