aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2011-06-22 16:13:23 +1000
committerAaron Kennedy <aaron.kennedy@nokia.com>2011-06-22 16:13:23 +1000
commit430ec8741e6c42a9f618b7d5246838bd50edd292 (patch)
treee2e16199bb116d936a86da40b3466b406f8027f0 /tests
parentf60a61157cb361e19c50eb53391f18b82990a026 (diff)
parent6938289ce3e1e29cc81f0e007390e0b5f6ef1a43 (diff)
Merge branch 'qtquick2' of scm.dev.nokia.troll.no:qt/qtdeclarative-staging into v8
Conflicts: src/declarative/items/qsgcontext2d.cpp src/declarative/qml/qdeclarativexmlhttprequest.cpp tests/auto/declarative/declarative.pro tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativechangeset/qdeclarativechangeset.pro17
-rw-r--r--tests/auto/declarative/qdeclarativechangeset/tst_qdeclarativechangeset.cpp614
-rw-r--r--tests/auto/declarative/qdeclarativetranslation/data/idtranslation.qml7
-rw-r--r--tests/auto/declarative/qdeclarativetranslation/data/qml_fr.qmbin0 -> 374 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetranslation/data/qml_fr.ts43
-rw-r--r--tests/auto/declarative/qdeclarativetranslation/data/qmlid_fr.qmbin0 -> 119 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetranslation/data/qmlid_fr.ts13
-rw-r--r--tests/auto/declarative/qdeclarativetranslation/data/translation.qml17
-rw-r--r--tests/auto/declarative/qdeclarativetranslation/qdeclarativetranslation.pro17
-rw-r--r--tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp113
-rw-r--r--tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml2
-rw-r--r--tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_DELETE.expect7
-rw-r--r--tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_HEAD.expect (renamed from tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_PUT.expect)0
-rw-r--r--tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp23
-rw-r--r--tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp6
-rw-r--r--tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp22
16 files changed, 885 insertions, 16 deletions
diff --git a/tests/auto/declarative/qdeclarativechangeset/qdeclarativechangeset.pro b/tests/auto/declarative/qdeclarativechangeset/qdeclarativechangeset.pro
new file mode 100644
index 0000000000..1c9a3c00f9
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativechangeset/qdeclarativechangeset.pro
@@ -0,0 +1,17 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative gui
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qdeclarativechangeset.cpp
+
+symbian: {
+ importFiles.files = data
+ importFiles.path = .
+ DEPLOYMENT += importFiles
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD\\\"
+}
+
+CONFIG += parallel_test
+
+QT += core-private gui-private declarative-private
diff --git a/tests/auto/declarative/qdeclarativechangeset/tst_qdeclarativechangeset.cpp b/tests/auto/declarative/qdeclarativechangeset/tst_qdeclarativechangeset.cpp
new file mode 100644
index 0000000000..018711ac64
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativechangeset/tst_qdeclarativechangeset.cpp
@@ -0,0 +1,614 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <private/qdeclarativechangeset_p.h>
+
+#define VERIFY_EXPECTED_OUTPUT
+
+
+
+class tst_qdeclarativemodelchange : public QObject
+{
+ Q_OBJECT
+public:
+ struct Signal
+ {
+ int start;
+ int end;
+ int to;
+
+ bool isInsert() const { return to == -1; }
+ bool isRemove() const { return to == -2; }
+ bool isMove() const { return to >= 0; }
+ bool isChange() const { return to == -3; }
+ };
+
+ static Signal Insert(int start, int end) { Signal signal = { start, end, -1 }; return signal; }
+ static Signal Remove(int start, int end) { Signal signal = { start, end, -2 }; return signal; }
+ static Signal Move(int start, int end, int to) { Signal signal = { start, end, to }; return signal; }
+ static Signal Change(int start, int end) { Signal signal = { start, end, -3 }; return signal; }
+
+ typedef QVector<Signal> SignalList;
+
+
+#ifdef VERIFY_EXPECTED_OUTPUT
+
+ template<typename T>
+ void move(int from, int to, int n, T *items)
+ {
+ if (from > to) {
+ // Only move forwards - flip if backwards moving
+ int tfrom = from;
+ int tto = to;
+ from = tto;
+ to = tto+n;
+ n = tfrom-tto;
+ }
+
+ T replaced;
+ int i=0;
+ typename T::ConstIterator it=items->begin(); it += from+n;
+ for (; i<to-from; ++i,++it)
+ replaced.append(*it);
+ i=0;
+ it=items->begin(); it += from;
+ for (; i<n; ++i,++it)
+ replaced.append(*it);
+ typename T::ConstIterator f=replaced.begin();
+ typename T::Iterator t=items->begin(); t += from;
+ for (; f != replaced.end(); ++f, ++t)
+ *t = *f;
+ }
+
+ QVector<int> applyChanges(const QVector<int> &list, const QVector<Signal> &changes)
+ {
+ QVector<int> alteredList = list;
+ foreach (const Signal &signal, changes) {
+ if (signal.isInsert()) {
+ alteredList.insert(signal.start, signal.end - signal.start, 100);
+ } else if (signal.isRemove()) {
+ alteredList.erase(alteredList.begin() + signal.start, alteredList.begin() + signal.end);
+ } else if (signal.isMove()) {
+ move(signal.start, signal.to, signal.end - signal.start, &alteredList);
+ } else if (signal.isChange()) {
+ for (int i = signal.start; i < signal.end; ++i) {
+ if (alteredList[i] < 100)
+ alteredList[i] = 100;
+ }
+ }
+ }
+ return alteredList;
+ }
+
+#endif
+
+private slots:
+ void sequence_data();
+ void sequence();
+};
+
+bool operator ==(const tst_qdeclarativemodelchange::Signal &left, const tst_qdeclarativemodelchange::Signal &right) {
+ return left.start == right.start && left.end == right.end && left.to == right.to; }
+
+
+QDebug operator <<(QDebug debug, const tst_qdeclarativemodelchange::Signal &signal)
+{
+ if (signal.isInsert())
+ debug.nospace() << "Insert(" << signal.start << "," << signal.end << ")";
+ else if (signal.isRemove())
+ debug.nospace() << "Remove(" << signal.start << "," << signal.end << ")";
+ else if (signal.isMove())
+ debug.nospace() << "Move(" << signal.start << "," << signal.end << "," << signal.to << ")";
+ else if (signal.isChange())
+ debug.nospace() << "Change(" << signal.start << "," << signal.end << ")";
+ return debug;
+}
+
+Q_DECLARE_METATYPE(tst_qdeclarativemodelchange::SignalList)
+
+void tst_qdeclarativemodelchange::sequence_data()
+{
+ QTest::addColumn<SignalList>("input");
+ QTest::addColumn<SignalList>("output");
+
+ // Insert
+ QTest::newRow("i(12-17)")
+ << (SignalList() << Insert(12, 17))
+ << (SignalList() << Insert(12, 17));
+ QTest::newRow("i(2-5),i(12-17)")
+ << (SignalList() << Insert(2, 5) << Insert(12, 17))
+ << (SignalList() << Insert(2, 5) << Insert(12, 17));
+ QTest::newRow("i(12-17),i(2-5)")
+ << (SignalList() << Insert(12, 17) << Insert(2, 5))
+ << (SignalList() << Insert(2, 5) << Insert(15, 20));
+ QTest::newRow("i(12-17),i(12-15)")
+ << (SignalList() << Insert(12, 17) << Insert(12, 15))
+ << (SignalList() << Insert(12, 20));
+ QTest::newRow("i(12-17),i(17-20)")
+ << (SignalList() << Insert(12, 17) << Insert(17, 20))
+ << (SignalList() << Insert(12, 20));
+ QTest::newRow("i(12-17),i(15-18)")
+ << (SignalList() << Insert(12, 17) << Insert(15, 18))
+ << (SignalList() << Insert(12, 20));
+
+ // Remove
+ QTest::newRow("r(3-12)")
+ << (SignalList() << Remove(3, 12))
+ << (SignalList() << Remove(3, 12));
+ QTest::newRow("r(3-7),r(3-5)")
+ << (SignalList() << Remove(3, 7) << Remove(3, 5))
+ << (SignalList() << Remove(3, 9));
+ QTest::newRow("r(4-3),r(14-19)")
+ << (SignalList() << Remove(4, 7) << Remove(14, 19))
+ << (SignalList() << Remove(4, 7) << Remove(14, 19));
+ QTest::newRow("r(14-19),r(4-7)")
+ << (SignalList() << Remove(14, 19) << Remove(4, 7))
+ << (SignalList() << Remove(4, 7) << Remove(11, 16));
+ QTest::newRow("r(4-7),r(2-11)")
+ << (SignalList() << Remove(4, 7) << Remove(2, 11))
+ << (SignalList() << Remove(2, 14));
+
+ // Move
+ QTest::newRow("m(8-10,10)")
+ << (SignalList() << Move(8, 10, 10))
+ << (SignalList() << Move(8, 10, 10));
+ // No merging of moves yet.
+// QTest::newRow("m(5-7,13),m(5-8,12)")
+// << (SignalList() << Move(5, 7, 13) << Move(5, 8, 12))
+// << (SignalList() << Move(5, 10, 10));
+
+ // Change
+ QTest::newRow("c(4-9)")
+ << (SignalList() << Change(4, 9))
+ << (SignalList() << Change(4, 9));
+ QTest::newRow("c(4-9),c(12-14)")
+ << (SignalList() << Change(4, 9) << Change(12, 14))
+ << (SignalList() << Change(4, 9) << Change(12, 14));
+ QTest::newRow("c(12-14),c(4-9)")
+ << (SignalList() << Change(12, 14) << Change(4, 9))
+ << (SignalList() << Change(4, 9) << Change(12, 14));
+ QTest::newRow("c(4-9),c(2-4)")
+ << (SignalList() << Change(4, 9) << Change(2, 4))
+ << (SignalList() << Change(2, 9));
+ QTest::newRow("c(4-9),c(9-11)")
+ << (SignalList() << Change(4, 9) << Change(9, 11))
+ << (SignalList() << Change(4, 11));
+ QTest::newRow("c(4-9),c(3-5)")
+ << (SignalList() << Change(4, 9) << Change(3, 5))
+ << (SignalList() << Change(3, 9));
+ QTest::newRow("c(4-9),c(8-10)")
+ << (SignalList() << Change(4, 9) << Change(8, 10))
+ << (SignalList() << Change(4, 10));
+ QTest::newRow("c(4-9),c(3-5)")
+ << (SignalList() << Change(4, 9) << Change(3, 5))
+ << (SignalList() << Change(3, 9));
+ QTest::newRow("c(4-9),c(2,11)")
+ << (SignalList() << Change(4, 9) << Change(2, 11))
+ << (SignalList() << Change(2, 11));
+ QTest::newRow("c(4-9),c(12-15),c(8-14)")
+ << (SignalList() << Change(4, 9) << Change(12, 15) << Change(8, 14))
+ << (SignalList() << Change(4, 15));
+
+ // Insert, then remove.
+ QTest::newRow("i(12-18),r(12-18)")
+ << (SignalList() << Insert(12, 18) << Remove(12, 18))
+ << (SignalList());
+ QTest::newRow("i(12-18),r(10-14)")
+ << (SignalList() << Insert(12, 18) << Remove(10, 14))
+ << (SignalList() << Remove(10, 12) << Insert(10, 14));
+ QTest::newRow("i(12-18),r(16-20)")
+ << (SignalList() << Insert(12, 18) << Remove(16, 20))
+ << (SignalList() << Remove(12, 14) << Insert(12, 16));
+ QTest::newRow("i(12-18),r(13-17)")
+ << (SignalList() << Insert(12, 18) << Remove(13, 17))
+ << (SignalList() << Insert(12, 14));
+ QTest::newRow("i(12-18),r(14,18)")
+ << (SignalList() << Insert(12, 18) << Remove(14, 18))
+ << (SignalList() << Insert(12, 14));
+ QTest::newRow("i(12-18),r(12-16)")
+ << (SignalList() << Insert(12, 18) << Remove(12, 16))
+ << (SignalList() << Insert(12, 14));
+ QTest::newRow("i(12-18),r(11-19)")
+ << (SignalList() << Insert(12, 18) << Remove(11, 19))
+ << (SignalList() << Remove(11, 13));
+ QTest::newRow("i(12-18),r(8-12)")
+ << (SignalList() << Insert(12, 18) << Remove(8, 12))
+ << (SignalList() << Remove(8, 12) << Insert(8, 14));
+ QTest::newRow("i(12-18),r(2-6)")
+ << (SignalList() << Insert(12, 18) << Remove(2, 6))
+ << (SignalList() << Remove(2, 6) << Insert(8, 14));
+ QTest::newRow("i(12-18),r(18-22)")
+ << (SignalList() << Insert(12, 18) << Remove(18, 22))
+ << (SignalList() << Remove(12, 16) << Insert(12, 18));
+ QTest::newRow("i(12-18),r(20-24)")
+ << (SignalList() << Insert(12, 18) << Remove(20, 24))
+ << (SignalList() << Remove(14, 18) << Insert(12, 18));
+
+ // Insert, then move
+ QTest::newRow("i(12-18),m(12-18,5)")
+ << (SignalList() << Insert(12, 18) << Move(12, 18, 5))
+ << (SignalList() << Insert(5, 11));
+ QTest::newRow("i(12-18),m(10-14,5)")
+ << (SignalList() << Insert(12, 18) << Move(10, 14, 5))
+ << (SignalList() << Insert(5, 7) << Insert(14, 18) << Move(12, 14, 5));
+ QTest::newRow("i(12-18),m(16-20,5)")
+ << (SignalList() << Insert(12, 18) << Move(16, 20, 5))
+ << (SignalList() << Insert(5, 7) << Insert(14, 18) << Move(18, 20, 7));
+ QTest::newRow("i(12-18),m(13-17,5)")
+ << (SignalList() << Insert(12, 18) << Move(13, 17, 5))
+ << (SignalList() << Insert(5, 9) << Insert(16, 18));
+ QTest::newRow("i(12-18),m(14-18,5)")
+ << (SignalList() << Insert(12, 18) << Move(14, 18, 5))
+ << (SignalList() << Insert(5, 9) << Insert(16, 18));
+ QTest::newRow("i(12-18),m(12-16,5)")
+ << (SignalList() << Insert(12, 18) << Move(12, 16, 5))
+ << (SignalList() << Insert(5, 9) << Insert(16, 18));
+ QTest::newRow("i(12-18),m(11-19,5)")
+ << (SignalList() << Insert(12, 18) << Move(11, 19, 5))
+ << (SignalList() << Insert(5, 11) << Move(17, 18, 5) << Move(18, 19, 12));
+ QTest::newRow("i(12-18),m(8-12,5)")
+ << (SignalList() << Insert(12, 18) << Move(8, 12, 5))
+ << (SignalList() << Insert(12, 18) << Move(8, 12, 5));
+ QTest::newRow("i(12-18),m(2-6,5)")
+ << (SignalList() << Insert(12, 18) << Move(2, 6, 5))
+ << (SignalList() << Insert(12, 18) << Move(2, 6, 5));
+ QTest::newRow("i(12-18),m(18-22,5)")
+ << (SignalList() << Insert(12, 18) << Move(18, 22, 5))
+ << (SignalList() << Insert(12, 18) << Move(18, 22, 5));
+ QTest::newRow("i(12-18),m(20-24,5)")
+ << (SignalList() << Insert(12, 18) << Move(20, 24, 5))
+ << (SignalList() << Insert(12, 18) << Move(20, 24, 5));
+
+ QTest::newRow("i(12-18),m(5-13,11)")
+ << (SignalList() << Insert(12, 18) << Move(5, 13, 11))
+ << (SignalList() << Insert(12, 17) << Insert(18, 19) << Move(5, 12, 11));
+
+ QTest::newRow("i(12-18),m(12-18,23)")
+ << (SignalList() << Insert(12, 18) << Move(12, 18, 23))
+ << (SignalList() << Insert(23, 29));
+ QTest::newRow("i(12-18),m(10-14,23)")
+ << (SignalList() << Insert(12, 18) << Move(10, 14, 23))
+ << (SignalList() << Insert(12, 16) << Insert(25, 27) << Move(10, 12, 23));
+ QTest::newRow("i(12-18),m(16-20,23)")
+ << (SignalList() << Insert(12, 18) << Move(16, 20, 23))
+ << (SignalList() << Insert(12, 16) << Insert(25, 27) << Move(16, 18, 25));
+ QTest::newRow("i(12-18),m(13-17,23)")
+ << (SignalList() << Insert(12, 18) << Move(13, 17, 23))
+ << (SignalList() << Insert(12, 14) << Insert(23, 27));
+ QTest::newRow("i(12-18),m(14-18,23)")
+ << (SignalList() << Insert(12, 18) << Move(14, 18, 23))
+ << (SignalList() << Insert(12, 14) << Insert(23, 27));
+ QTest::newRow("i(12-18),m(12-16,23)")
+ << (SignalList() << Insert(12, 18) << Move(12, 16, 23))
+ << (SignalList() << Insert(12, 14) << Insert(23, 27));
+ QTest::newRow("i(12-18),m(11-19,23)")
+ << (SignalList() << Insert(12, 18) << Move(11, 19, 23))
+ << (SignalList() << Insert(25, 31) << Move(11, 12, 24) << Move(11, 12, 30));
+ QTest::newRow("i(12-18),m(8-12,23)")
+ << (SignalList() << Insert(12, 18) << Move(8, 12, 23))
+ << (SignalList() << Insert(12, 18) << Move(8, 12, 23));
+ QTest::newRow("i(12-18),m(2-6,23)")
+ << (SignalList() << Insert(12, 18) << Move(2, 6, 23))
+ << (SignalList() << Insert(12, 18) << Move(2, 6, 23));
+ QTest::newRow("i(12-18),m(18-22,23)")
+ << (SignalList() << Insert(12, 18) << Move(18, 22, 23))
+ << (SignalList() << Insert(12, 18) << Move(18, 22, 23));
+ QTest::newRow("i(12-18),m(20-24,23)")
+ << (SignalList() << Insert(12, 18) << Move(20, 24, 23))
+ << (SignalList() << Insert(12, 18) << Move(20, 24, 23));
+
+ QTest::newRow("i(12-18),m(11-21,23)")
+ << (SignalList() << Insert(12, 18) << Move(11, 21, 23))
+ << (SignalList() << Insert(27, 33) << Move(11, 12, 26) << Move(11, 14, 30));
+
+ // Insert, then change
+ QTest::newRow("i(12-18),c(12-16)")
+ << (SignalList() << Insert(12, 18) << Change(12, 6))
+ << (SignalList() << Insert(12, 18));
+ QTest::newRow("i(12-18),c(10-14)")
+ << (SignalList() << Insert(12, 18) << Change(10, 16))
+ << (SignalList() << Insert(12, 18) << Change(10, 12));
+ QTest::newRow("i(12-18),c(16-20)")
+ << (SignalList() << Insert(12, 18) << Change(16, 20))
+ << (SignalList() << Insert(12, 18) << Change(18, 20));
+ QTest::newRow("i(12-18),c(13-17)")
+ << (SignalList() << Insert(12, 18) << Change(13, 17))
+ << (SignalList() << Insert(12, 18));
+ QTest::newRow("i(12-18),c(14-18)")
+ << (SignalList() << Insert(12, 18) << Change(14, 18))
+ << (SignalList() << Insert(12, 18));
+ QTest::newRow("i(12-18),c(12-16)")
+ << (SignalList() << Insert(12, 18) << Change(12, 16))
+ << (SignalList() << Insert(12, 18));
+ QTest::newRow("i(12-18),c(11-19)")
+ << (SignalList() << Insert(12, 18) << Change(11, 19))
+ << (SignalList() << Insert(12, 18) << Change(11, 12) << Change(18, 19));
+ QTest::newRow("i(12-18),c(8-12)")
+ << (SignalList() << Insert(12, 18) << Change(8, 12))
+ << (SignalList() << Insert(12, 18) << Change(8, 12));
+ QTest::newRow("i(12-18),c(2-6)")
+ << (SignalList() << Insert(12, 18) << Change(2, 6))
+ << (SignalList() << Insert(12, 18) << Change(2, 6));
+ QTest::newRow("i(12-18),c(18-22)")
+ << (SignalList() << Insert(12, 18) << Change(18, 22))
+ << (SignalList() << Insert(12, 18) << Change(18, 22));
+ QTest::newRow("i(12-18),c(20-24)")
+ << (SignalList() << Insert(12, 18) << Change(20, 24))
+ << (SignalList() << Insert(12, 18) << Change(20, 24));
+
+ // Remove, then insert
+ QTest::newRow("r(12-18),i(12-18)")
+ << (SignalList() << Remove(12, 18) << Insert(12, 18))
+ << (SignalList() << Remove(12, 18) << Insert(12, 18));
+ QTest::newRow("r(12-18),i(10-14)")
+ << (SignalList() << Remove(12, 18) << Insert(10, 14))
+ << (SignalList() << Remove(12, 18) << Insert(10, 14));
+ QTest::newRow("r(12-18),i(16-20)")
+ << (SignalList() << Remove(12, 18) << Insert(16, 20))
+ << (SignalList() << Remove(12, 18) << Insert(16, 20));
+ QTest::newRow("r(12-18),i(13-17)")
+ << (SignalList() << Remove(12, 18) << Insert(13, 17))
+ << (SignalList() << Remove(12, 18) << Insert(13, 17));
+ QTest::newRow("r(12-18),i(14-18)")
+ << (SignalList() << Remove(12, 18) << Insert(14, 18))
+ << (SignalList() << Remove(12, 18) << Insert(14, 18));
+ QTest::newRow("r(12-18),i(12-16)")
+ << (SignalList() << Remove(12, 18) << Insert(12, 16))
+ << (SignalList() << Remove(12, 18) << Insert(12, 16));
+ QTest::newRow("r(12-18),i(11-19)")
+ << (SignalList() << Remove(12, 18) << Insert(11, 19))
+ << (SignalList() << Remove(12, 18) << Insert(11, 19));
+ QTest::newRow("i(12-18),r(8-12)")
+ << (SignalList() << Remove(12, 18) << Insert(8, 12))
+ << (SignalList() << Remove(12, 18) << Insert(8, 12));
+ QTest::newRow("i(12-18),r(2-6)")
+ << (SignalList() << Remove(12, 18) << Insert(2, 6))
+ << (SignalList() << Remove(12, 18) << Insert(2, 6));
+ QTest::newRow("i(12-18),r(18-22)")
+ << (SignalList() << Remove(12, 18) << Insert(18, 22))
+ << (SignalList() << Remove(12, 18) << Insert(18, 22));
+ QTest::newRow("i(12-18),r(20-24)")
+ << (SignalList() << Remove(12, 18) << Insert(20, 24))
+ << (SignalList() << Remove(12, 18) << Insert(20, 24));
+
+ // Move, then insert
+ QTest::newRow("m(12-18,5),i(12-18)")
+ << (SignalList() << Move(12, 18, 5) << Insert(12, 18))
+ << (SignalList() << Insert(6, 12) << Move(18, 24, 5));
+ QTest::newRow("m(12-18,5),i(10-14)")
+ << (SignalList() << Move(12, 18, 5) << Insert(10, 14))
+ << (SignalList() << Insert(5, 9) << Move(16, 21, 5) << Move(21, 22, 14));
+ QTest::newRow("m(12-18,5),i(16-20)")
+ << (SignalList() << Move(12, 18, 5) << Insert(16, 20))
+ << (SignalList() << Insert(10, 14) << Move(16, 22, 5));
+ QTest::newRow("m(12-18,5),i(13-17)")
+ << (SignalList() << Move(12, 18, 5) << Insert(13, 17))
+ << (SignalList() << Insert(7, 11) << Move(16, 22, 5));
+ QTest::newRow("m(12-18,5),i(14-18)")
+ << (SignalList() << Move(12, 18, 5) << Insert(14, 18))
+ << (SignalList() << Insert(8, 12) << Move(16, 22, 5));
+ QTest::newRow("m(12-18,5),i(12-16)")
+ << (SignalList() << Move(12, 18, 5) << Insert(12, 16))
+ << (SignalList() << Insert(6, 10) << Move(16, 22, 5));
+ QTest::newRow("m(12-18,5),i(11-19)")
+ << (SignalList() << Move(12, 18, 5) << Insert(11, 19))
+ << (SignalList() << Insert(5, 13) << Move(20, 26, 5));
+ QTest::newRow("m(12-18,5),i(8-12)")
+ << (SignalList() << Move(12, 18, 5) << Insert(8, 12))
+ << (SignalList() << Insert(5, 9) << Move(16, 19, 5) << Move(19, 22, 12));
+ QTest::newRow("m(12-18,5),i(2-6)")
+ << (SignalList() << Move(12, 18, 5) << Insert(2, 6))
+ << (SignalList() << Insert(2, 6) << Move(16, 22, 9));
+ QTest::newRow("m(12-18,5),i(18-22)")
+ << (SignalList() << Move(12, 18, 5) << Insert(18, 22))
+ << (SignalList() << Insert(18, 22) << Move(12, 18, 5));
+ QTest::newRow("m(12-18,5),i(20-24)")
+ << (SignalList() << Move(12, 18, 5) << Insert(20, 24))
+ << (SignalList() << Insert(20, 24) << Move(12, 18, 5));
+
+ QTest::newRow("m(12-18,23),i(12-18)")
+ << (SignalList() << Move(12, 18, 23) << Insert(12, 18))
+ << (SignalList() << Insert(12, 18) << Move(18, 24, 29));
+ QTest::newRow("m(12-18,23),i(10-14)")
+ << (SignalList() << Move(12, 18, 23) << Insert(10, 14))
+ << (SignalList() << Insert(10, 14) << Move(16, 22, 27));
+ QTest::newRow("m(12-18,23),i(16-20)")
+ << (SignalList() << Move(12, 18, 23) << Insert(16, 20))
+ << (SignalList() << Insert(22, 26) << Move(12, 18, 27));
+ QTest::newRow("m(12-18,23),i(13-17)")
+ << (SignalList() << Move(12, 18, 23) << Insert(13, 17))
+ << (SignalList() << Insert(19, 23) << Move(12, 18, 27));
+ QTest::newRow("m(12-18,23),i(14-18)")
+ << (SignalList() << Move(12, 18, 23) << Insert(14, 18))
+ << (SignalList() << Insert(20, 24) << Move(12, 18, 27));
+ QTest::newRow("m(12-18,23),i(12-16)")
+ << (SignalList() << Move(12, 18, 23) << Insert(12, 16))
+ << (SignalList() << Insert(12, 16) << Move(16, 22, 27));
+ QTest::newRow("m(12-18,23),i(11-19)")
+ << (SignalList() << Move(12, 18, 23) << Insert(11, 19))
+ << (SignalList() << Insert(11, 19) << Move(20, 26, 31));
+ QTest::newRow("m(12-18,23),i(8-12)")
+ << (SignalList() << Move(12, 18, 23) << Insert(8, 12))
+ << (SignalList() << Insert(8, 12) << Move(16, 22, 27));
+ QTest::newRow("m(12-18,23),i(2-6)")
+ << (SignalList() << Move(12, 18, 23) << Insert(2, 6))
+ << (SignalList() << Insert(2, 6) << Move(16, 22, 27));
+ QTest::newRow("m(12-18,23),i(18-22)")
+ << (SignalList() << Move(12, 18, 23) << Insert(18, 22))
+ << (SignalList() << Insert(24, 28) << Move(12, 18, 27));
+ QTest::newRow("m(12-18,23),i(20-24)")
+ << (SignalList() << Move(12, 18, 23) << Insert(20, 24))
+ << (SignalList() << Insert(26, 30) << Move(12, 18, 27));
+
+ // Move, then remove
+ QTest::newRow("m(12-18,5),r(12-18)")
+ << (SignalList() << Move(12, 18, 5) << Remove(12, 18))
+ << (SignalList() << Remove(6, 12) << Move(6, 12, 5));
+ QTest::newRow("m(12-18,5),r(10-14)")
+ << (SignalList() << Move(12, 18, 5) << Remove(10, 14))
+ << (SignalList() << Remove(5, 8) << Remove(14, 15) << Move(9, 14, 5));
+ QTest::newRow("m(12-18,5),r(16-20)")
+ << (SignalList() << Move(12, 18, 5) << Remove(16, 20))
+ << (SignalList() << Remove(10, 12) << Remove(16, 18) << Move(10, 16, 5));
+ QTest::newRow("m(12-18,5),r(13-17)")
+ << (SignalList() << Move(12, 18, 5) << Remove(13, 17))
+ << (SignalList() << Remove(7, 11) << Move(8, 14, 5));
+ QTest::newRow("m(12-18,5),r(14-18)")
+ << (SignalList() << Move(12, 18, 5) << Remove(14, 18))
+ << (SignalList() << Remove(8, 12) << Move(8, 14, 5));
+ QTest::newRow("m(12-18,5),r(12-16)")
+ << (SignalList() << Move(12, 18, 5) << Remove(12, 16))
+ << (SignalList() << Remove(6, 10) << Move(8, 14, 5));
+ QTest::newRow("m(12-18,5),r(11-19)")
+ << (SignalList() << Move(12, 18, 5) << Remove(11, 19))
+ << (SignalList() << Remove(5, 12) << Remove(11, 12));
+ QTest::newRow("m(12-18,5),r(8-12)")
+ << (SignalList() << Move(12, 18, 5) << Remove(8, 12))
+ << (SignalList() << Remove(5, 6) << Remove(14, 17) << Move(11, 14, 5));
+ QTest::newRow("m(12-18,5),r(2-6)")
+ << (SignalList() << Move(12, 18, 5) << Remove(2, 6))
+ << (SignalList() << Remove(2, 5) << Remove(9, 10) << Move(9, 14, 2));
+ QTest::newRow("m(12-18,5),r(6-10)")
+ << (SignalList() << Move(12, 18, 5) << Remove(6, 10))
+ << (SignalList() << Remove(13, 17) << Move(12, 14, 5));
+ QTest::newRow("m(12-18,5),r(18-22)")
+ << (SignalList() << Move(12, 18, 5) << Remove(18, 22))
+ << (SignalList() << Remove(18, 22) << Move(12, 18, 5));
+ QTest::newRow("m(12-18,5),r(20-24)")
+ << (SignalList() << Move(12, 18, 5) << Remove(20, 24))
+ << (SignalList() << Remove(20, 24) << Move(12, 18, 5));
+
+ QTest::newRow("m(12-18,23),r(12-18)")
+ << (SignalList() << Move(12, 18, 23) << Remove(12, 18))
+ << (SignalList() << Remove(18, 24) << Move(12, 18, 17));
+ QTest::newRow("m(12-18,23),r(10-14)")
+ << (SignalList() << Move(12, 18, 23) << Remove(10, 14))
+ << (SignalList() << Remove(10, 12) << Remove(16, 18) << Move(10, 16, 19));
+ QTest::newRow("m(12-18,23),r(16-20)")
+ << (SignalList() << Move(12, 18, 23) << Remove(16, 20))
+ << (SignalList() << Remove(22, 26) << Move(12, 18, 19));
+ QTest::newRow("m(12-18,23),r(13-17)")
+ << (SignalList() << Move(12, 18, 23) << Remove(13, 17))
+ << (SignalList() << Remove(19, 23) << Move(12, 18, 19));
+ QTest::newRow("m(12-18,23),r(14-18)")
+ << (SignalList() << Move(12, 18, 23) << Remove(14, 18))
+ << (SignalList() << Remove(20, 24) << Move(12, 18, 19));
+ QTest::newRow("m(12-18,23),r(12-16)")
+ << (SignalList() << Move(12, 18, 23) << Remove(12, 16))
+ << (SignalList() << Remove(18, 22) << Move(12, 18, 19));
+ QTest::newRow("m(12-18,23),r(11-19)")
+ << (SignalList() << Move(12, 18, 23) << Remove(11, 19))
+ << (SignalList() << Remove(11, 12) << Remove(17, 24) << Move(11, 17, 15));
+ QTest::newRow("m(12-18,23),r(8-12)")
+ << (SignalList() << Move(12, 18, 23) << Remove(8, 12))
+ << (SignalList() << Remove(8, 12) << Move(8, 14, 19));
+ QTest::newRow("m(12-18,23),r(2-6)")
+ << (SignalList() << Move(12, 18, 23) << Remove(2, 6))
+ << (SignalList() << Remove(2, 6) << Move(8, 14, 19));
+ QTest::newRow("m(12-18,23),r(18-22)")
+ << (SignalList() << Move(12, 18, 23) << Remove(18, 22))
+ << (SignalList() << Remove(24, 28) << Move(12, 18, 19));
+ QTest::newRow("m(12-18,23),r(20-24)")
+ << (SignalList() << Move(12, 18, 23) << Remove(20, 24))
+ << (SignalList() << Remove(12, 13) << Remove(25, 28) << Move(12, 17, 20));
+}
+
+void tst_qdeclarativemodelchange::sequence()
+{
+ QFETCH(SignalList, input);
+ QFETCH(SignalList, output);
+
+ QDeclarativeChangeSet set;
+
+ foreach (const Signal &signal, input) {
+ if (signal.isRemove())
+ set.insertRemove(signal.start, signal.end);
+ else if (signal.isInsert())
+ set.insertInsert(signal.start, signal.end);
+ else if (signal.isMove())
+ set.insertMove(signal.start, signal.end, signal.to);
+ else if (signal.isChange())
+ set.insertChange(signal.start, signal.end);
+ }
+
+ SignalList changes;
+ foreach (const QDeclarativeChangeSet::Remove &remove, set.removes())
+ changes << Remove(remove.start, remove.end);
+ foreach (const QDeclarativeChangeSet::Insert &insert, set.inserts())
+ changes << Insert(insert.start, insert.end);
+ foreach (const QDeclarativeChangeSet::Move &move, set.moves())
+ changes << Move(move.start, move.end, move.to);
+ foreach (const QDeclarativeChangeSet::Change &change, set.changes())
+ changes << Change(change.start, change.end);
+
+#ifdef VERIFY_EXPECTED_OUTPUT
+ QVector<int> list;
+ for (int i = 0; i < 40; ++i)
+ list.append(i);
+ QVector<int> inputList = applyChanges(list, input);
+ QVector<int> outputList = applyChanges(list, output);
+ if (outputList != inputList /* || changes != output*/) {
+ qDebug() << input;
+ qDebug() << output;
+ qDebug() << changes;
+ qDebug() << inputList;
+ qDebug() << outputList;
+ } else if (changes != output) {
+ qDebug() << output;
+ qDebug() << changes;
+ }
+ QCOMPARE(outputList, inputList);
+#else
+
+ if (changes != output) {
+ qDebug() << output;
+ qDebug() << changes;
+ }
+
+#endif
+
+ QCOMPARE(changes, output);
+}
+
+
+QTEST_MAIN(tst_qdeclarativemodelchange)
+
+#include "tst_qdeclarativechangeset.moc"
diff --git a/tests/auto/declarative/qdeclarativetranslation/data/idtranslation.qml b/tests/auto/declarative/qdeclarativetranslation/data/idtranslation.qml
new file mode 100644
index 0000000000..4a5498281a
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetranslation/data/idtranslation.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+QtObject {
+ property string _idTranslation2: QT_TRID_NOOP("qtn_hello_world")
+ property string idTranslation: qsTrId("qtn_hello_world")
+ property string idTranslation2: qsTrId(_idTranslation2)
+}
diff --git a/tests/auto/declarative/qdeclarativetranslation/data/qml_fr.qm b/tests/auto/declarative/qdeclarativetranslation/data/qml_fr.qm
new file mode 100644
index 0000000000..252022515a
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetranslation/data/qml_fr.qm
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetranslation/data/qml_fr.ts b/tests/auto/declarative/qdeclarativetranslation/data/qml_fr.ts
new file mode 100644
index 0000000000..b003e239bc
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetranslation/data/qml_fr.ts
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr" sourcelanguage="en">
+<context>
+ <name>CustomContext</name>
+ <message>
+ <location filename="translation.qml" line="5"/>
+ <location filename="translation.qml" line="11"/>
+ <source>goodbye</source>
+ <translation>au revoir</translation>
+ </message>
+ <message>
+ <location filename="translation.qml" line="8"/>
+ <source>see ya</source>
+ <comment>informal &apos;goodbye&apos;</comment>
+ <translation>à plus tard</translation>
+ </message>
+</context>
+<context>
+ <name>translation</name>
+ <message>
+ <location filename="translation.qml" line="4"/>
+ <location filename="translation.qml" line="10"/>
+ <source>hello</source>
+ <translation>bonjour</translation>
+ </message>
+ <message>
+ <location filename="translation.qml" line="7"/>
+ <source>hi</source>
+ <comment>informal &apos;hello&apos;</comment>
+ <translation>salut</translation>
+ </message>
+ <message numerus="yes">
+ <location filename="translation.qml" line="15"/>
+ <location filename="translation.qml" line="16"/>
+ <source>%n duck(s)</source>
+ <translation>
+ <numerusform>%n canard</numerusform>
+ <numerusform>%n canards</numerusform>
+ </translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/declarative/qdeclarativetranslation/data/qmlid_fr.qm b/tests/auto/declarative/qdeclarativetranslation/data/qmlid_fr.qm
new file mode 100644
index 0000000000..265164916f
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetranslation/data/qmlid_fr.qm
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetranslation/data/qmlid_fr.ts b/tests/auto/declarative/qdeclarativetranslation/data/qmlid_fr.ts
new file mode 100644
index 0000000000..bff39b80b6
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetranslation/data/qmlid_fr.ts
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr">
+<context>
+ <name></name>
+ <message id="qtn_hello_world">
+ <location filename="idtranslation.qml" line="4"/>
+ <location filename="idtranslation.qml" line="5"/>
+ <source></source>
+ <translation>bonjour tout le monde</translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/declarative/qdeclarativetranslation/data/translation.qml b/tests/auto/declarative/qdeclarativetranslation/data/translation.qml
new file mode 100644
index 0000000000..89db1d2262
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetranslation/data/translation.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+QtObject {
+ property string basic: qsTr("hello")
+ property string basic2: qsTranslate("CustomContext", "goodbye")
+
+ property string disambiguation: qsTr("hi", "informal 'hello'")
+ property string disambiguation2: qsTranslate("CustomContext", "see ya", "informal 'goodbye'")
+
+ property string _noop: QT_TR_NOOP("hello")
+ property string _noop2: QT_TRANSLATE_NOOP("CustomContext", "goodbye")
+ property string noop: qsTr(_noop)
+ property string noop2: qsTranslate("CustomContext", _noop2)
+
+ property string singular: qsTr("%n duck(s)", "", 1)
+ property string plural: qsTr("%n duck(s)", "", 2)
+}
diff --git a/tests/auto/declarative/qdeclarativetranslation/qdeclarativetranslation.pro b/tests/auto/declarative/qdeclarativetranslation/qdeclarativetranslation.pro
new file mode 100644
index 0000000000..c970a0c70e
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetranslation/qdeclarativetranslation.pro
@@ -0,0 +1,17 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qdeclarativetranslation.cpp
+
+symbian: {
+ importFiles.files = data
+ importFiles.path = .
+ DEPLOYMENT += importFiles
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD\\\"
+}
+
+CONFIG += parallel_test
+
+QT += core-private gui-private declarative-private
diff --git a/tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp b/tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp
new file mode 100644
index 0000000000..5b88b548c9
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QDeclarativeEngine>
+#include <QDeclarativeComponent>
+#include <QTranslator>
+#include <QDebug>
+
+#ifdef Q_OS_SYMBIAN
+// In Symbian OS test data is located in applications private dir
+#define SRCDIR "."
+#endif
+
+class tst_qdeclarativetranslation : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qdeclarativetranslation() {}
+
+private slots:
+ void translation();
+ void idTranslation();
+};
+
+inline QUrl TEST_FILE(const QString &filename)
+{
+ return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename);
+}
+
+void tst_qdeclarativetranslation::translation()
+{
+ QTranslator translator;
+ translator.load(QLatin1String("qml_fr"), QLatin1String(SRCDIR) + QLatin1String("/data"));
+ QApplication::installTranslator(&translator);
+
+ QDeclarativeEngine engine;
+ QDeclarativeComponent component(&engine, TEST_FILE("translation.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("basic").toString(), QLatin1String("bonjour"));
+ QCOMPARE(object->property("basic2").toString(), QLatin1String("au revoir"));
+ QCOMPARE(object->property("disambiguation").toString(), QLatin1String("salut"));
+ QCOMPARE(object->property("disambiguation2").toString(), QString::fromUtf8("\xc3\xa0 plus tard"));
+ QCOMPARE(object->property("noop").toString(), QLatin1String("bonjour"));
+ QCOMPARE(object->property("noop2").toString(), QLatin1String("au revoir"));
+ QCOMPARE(object->property("singular").toString(), QLatin1String("1 canard"));
+ QCOMPARE(object->property("plural").toString(), QLatin1String("2 canards"));
+
+ QApplication::removeTranslator(&translator);
+ delete object;
+}
+
+void tst_qdeclarativetranslation::idTranslation()
+{
+ QTranslator translator;
+ translator.load(QLatin1String("qmlid_fr"), QLatin1String(SRCDIR) + QLatin1String("/data"));
+ QApplication::installTranslator(&translator);
+
+ QDeclarativeEngine engine;
+ QDeclarativeComponent component(&engine, TEST_FILE("idtranslation.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("idTranslation").toString(), QLatin1String("bonjour tout le monde"));
+ QCOMPARE(object->property("idTranslation2").toString(), QLatin1String("bonjour tout le monde"));
+
+ QApplication::removeTranslator(&translator);
+ delete object;
+}
+
+QTEST_MAIN(tst_qdeclarativetranslation)
+
+#include "tst_qdeclarativetranslation.moc"
diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml
index c98555cd2f..442932be26 100644
--- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml
+++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml
@@ -14,7 +14,7 @@ QtObject {
// Test to the end
x.onreadystatechange = function() {
if (x.readyState == XMLHttpRequest.DONE) {
- if (reqType == "HEAD")
+ if (reqType == "HEAD" || reqType == "DELETE")
dataOK = (x.responseText == "");
else
dataOK = (x.responseText == "QML Rocks!\n");
diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_DELETE.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_DELETE.expect
new file mode 100644
index 0000000000..b2d177aa20
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_DELETE.expect
@@ -0,0 +1,7 @@
+DELETE /testdocument.html HTTP/1.1
+ACCEPT-LANGUAGE: en-US
+Connection: Keep-Alive
+Accept-Encoding: gzip
+User-Agent: Mozilla/5.0
+Host: 127.0.0.1:14445
+
diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_PUT.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_HEAD.expect
index 74a979817d..74a979817d 100644
--- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_PUT.expect
+++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_HEAD.expect
diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp
index e243f60872..d2b7d5b50e 100644
--- a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp
+++ b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp
@@ -497,7 +497,7 @@ void tst_qdeclarativexmlhttprequest::send_alreadySent()
delete object;
}
-// Test that send for a GET or HEAD ignores data
+// Test that sends for GET, HEAD and DELETE ignore data
void tst_qdeclarativexmlhttprequest::send_ignoreData()
{
{
@@ -522,7 +522,7 @@ void tst_qdeclarativexmlhttprequest::send_ignoreData()
{
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
- QVERIFY(server.wait(TEST_FILE("send_ignoreData_PUT.expect"),
+ QVERIFY(server.wait(TEST_FILE("send_ignoreData_HEAD.expect"),
TEST_FILE("send_ignoreData.reply"),
QUrl()));
@@ -537,6 +537,25 @@ void tst_qdeclarativexmlhttprequest::send_ignoreData()
delete object;
}
+
+ {
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ QVERIFY(server.wait(TEST_FILE("send_ignoreData_DELETE.expect"),
+ TEST_FILE("send_ignoreData.reply"),
+ QUrl()));
+
+ QDeclarativeComponent component(&engine, TEST_FILE("send_ignoreData.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("reqType", "DELETE");
+ object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ component.completeCreate();
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ delete object;
+ }
}
// Test that send()'ing data works
diff --git a/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp b/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp
index 7d74c0add8..ea9260772e 100644
--- a/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp
+++ b/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp
@@ -408,10 +408,7 @@ void tst_qsgtextedit::alignments()
ob->setProperty("horizontalAlignment",hAlign);
ob->setProperty("verticalAlignment",vAlign);
QTRY_COMPARE(ob->property("running").toBool(),false);
- QImage actual(canvas.width(), canvas.height(), QImage::Format_RGB32);
- actual.fill(qRgb(255,255,255));
- QPainter p(&actual);
- canvas.render(&p);
+ QImage actual = canvas.grabFrameBuffer();
expectfile = createExpectedFileIfNotFound(expectfile, actual);
@@ -458,6 +455,7 @@ void tst_qsgtextedit::hAlign()
void tst_qsgtextedit::hAlign_RightToLeft()
{
+ QSKIP("QTBUG-20017", SkipAll);
QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/horizontalAlignment_RightToLeft.qml"));
QSGTextEdit *textEdit = canvas.rootObject()->findChild<QSGTextEdit*>("text");
QVERIFY(textEdit != 0);
diff --git a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp
index cbe14a5563..77427253a6 100644
--- a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp
+++ b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp
@@ -1037,12 +1037,7 @@ void tst_qsgtextinput::horizontalAlignment()
QObject *ob = canvas.rootObject();
QVERIFY(ob != 0);
ob->setProperty("horizontalAlignment",hAlign);
- QImage actual(canvas.width(), canvas.height(), QImage::Format_RGB32);
- actual.fill(qRgb(255,255,255));
- {
- QPainter p(&actual);
- canvas.render(&p);
- }
+ QImage actual = canvas.grabFrameBuffer();
expectfile = createExpectedFileIfNotFound(expectfile, actual);
@@ -1053,6 +1048,7 @@ void tst_qsgtextinput::horizontalAlignment()
void tst_qsgtextinput::horizontalAlignment_RightToLeft()
{
+ QSKIP("QTBUG-20017", SkipAll);
QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/horizontalAlignment_RightToLeft.qml"));
QSGTextInput *textInput = canvas.rootObject()->findChild<QSGTextInput*>("text");
QVERIFY(textInput != 0);
@@ -1446,6 +1442,7 @@ void tst_qsgtextinput::navigation()
void tst_qsgtextinput::navigation_RTL()
{
+ QSKIP("QTBUG-20017", SkipAll);
QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/navigation.qml"));
canvas.show();
canvas.setFocus();
@@ -1734,7 +1731,7 @@ void tst_qsgtextinput::cursorRectangle()
// Check the cursor rectangle remains within the input bounding rect when auto scrolling.
QVERIFY(r.left() < input.boundingRect().width());
- QVERIFY(r.right() >= input.width());
+ QVERIFY(r.right() >= input.width() - error);
for (int i = 6; i < text.length(); ++i) {
input.setCursorPosition(i);
@@ -2219,18 +2216,25 @@ void tst_qsgtextinput::preeditAutoScroll()
QCOMPARE(input->positionAt(0), 0);
QCOMPARE(input->positionAt(input->width()), 5);
+ // some tolerance for different fonts.
+#ifdef Q_OS_LINUX
+ const int error = 2;
+#else
+ const int error = 5;
+#endif
+
// test if the preedit is larger than the text input that the
// character preceding the cursor is still visible.
qreal x = input->positionToRectangle(0).x();
for (int i = 0; i < 3; ++i) {
ic.sendPreeditText(preeditText, i + 1);
- QVERIFY(input->cursorRectangle().right() >= fm.width(preeditText.at(i)));
+ QVERIFY(input->cursorRectangle().right() >= fm.width(preeditText.at(i)) - error);
QVERIFY(input->positionToRectangle(0).x() < x);
x = input->positionToRectangle(0).x();
}
for (int i = 1; i >= 0; --i) {
ic.sendPreeditText(preeditText, i + 1);
- QVERIFY(input->cursorRectangle().right() >= fm.width(preeditText.at(i)));
+ QVERIFY(input->cursorRectangle().right() >= fm.width(preeditText.at(i)) - error);
QVERIFY(input->positionToRectangle(0).x() > x);
x = input->positionToRectangle(0).x();
}