aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-09-06 10:39:42 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-09-06 10:39:51 +0200
commit68607aeeeb6ba84b843a0e3d848a5438a36f55a7 (patch)
treef7ff7ef369e079599d8be73f909498aeb6e75201 /tests
parenta719e348d22b1ce158a7b2be878965ac3a258914 (diff)
parent42f58e557034bb95005db465f078212cfc1b693a (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmllanguage/BLACKLIST2
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/locale_read.qml22
-rw-r--r--tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp38
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/status.500.reply3
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp1
-rw-r--r--tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp12
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_context.qml18
-rw-r--r--tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp3
-rw-r--r--tests/auto/quick/qquickgridview/data/gridview-initCurrent.qml3
-rw-r--r--tests/auto/quick/qquickgridview/tst_qquickgridview.cpp3
-rw-r--r--tests/auto/quick/qquicklistview/data/listview-initCurrent.qml3
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp3
-rw-r--r--tests/auto/quick/qquickview/tst_qquickview.cpp4
-rw-r--r--tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp1
m---------tests/manual/v4/test2620
15 files changed, 108 insertions, 8 deletions
diff --git a/tests/auto/qml/qqmllanguage/BLACKLIST b/tests/auto/qml/qqmllanguage/BLACKLIST
new file mode 100644
index 0000000000..c1c7e56df9
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/BLACKLIST
@@ -0,0 +1,2 @@
+[importsPath]
+windows
diff --git a/tests/auto/qml/qqmlvaluetypes/data/locale_read.qml b/tests/auto/qml/qqmlvaluetypes/data/locale_read.qml
new file mode 100644
index 0000000000..5ae6b41259
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/locale_read.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Item {
+ property string amText: Qt.inputMethod.locale.amText
+ property string decimalPoint: Qt.inputMethod.locale.decimalPoint
+ property string exponential: Qt.inputMethod.locale.exponential
+ property int firstDayOfWeek: Qt.inputMethod.locale.firstDayOfWeek
+ property string groupSeparator: Qt.inputMethod.locale.groupSeparator
+ property int measurementSystem: Qt.inputMethod.locale.measurementSystem
+ property string name: Qt.inputMethod.locale.name
+ property string nativeCountryName: Qt.inputMethod.locale.nativeCountryName
+ property string nativeLanguageName: Qt.inputMethod.locale.nativeLanguageName
+ property string negativeSign: Qt.inputMethod.locale.negativeSign
+ property string percent: Qt.inputMethod.locale.percent
+ property string pmText: Qt.inputMethod.locale.pmText
+ property string positiveSign: Qt.inputMethod.locale.positiveSign
+ property int textDirection: Qt.inputMethod.locale.textDirection
+ property var uiLanguages: Qt.inputMethod.locale.uiLanguages
+ property var weekDays: Qt.inputMethod.locale.weekDays
+ property string zeroDigit: Qt.inputMethod.locale.zeroDigit
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
index 52f744578a..c8107e58bf 100644
--- a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
+++ b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
@@ -36,6 +36,7 @@
#include <QQmlComponent>
#include <QDebug>
#include <private/qquickvaluetypes_p.h>
+#include <private/qqmlglobal_p.h>
#include "../../shared/util.h"
#include "testtypes.h"
@@ -67,6 +68,7 @@ private slots:
void font();
void color();
void variant();
+ void locale();
void bindingAssignment();
void bindingRead();
@@ -316,6 +318,42 @@ void tst_qqmlvaluetypes::variant()
}
}
+void tst_qqmlvaluetypes::locale()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("locale_read.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
+
+ QVERIFY(QQml_guiProvider()->inputMethod());
+ QInputMethod *inputMethod = qobject_cast<QInputMethod*>(QQml_guiProvider()->inputMethod());
+ QLocale locale = inputMethod->locale();
+
+ QCOMPARE(object->property("amText").toString(), locale.amText());
+ QCOMPARE(object->property("decimalPoint").toString().at(0), locale.decimalPoint());
+ QCOMPARE(object->property("exponential").toString().at(0), locale.exponential());
+ // Sunday is 0 in JavaScript.
+ QCOMPARE(object->property("firstDayOfWeek").toInt(), int(locale.firstDayOfWeek() == Qt::Sunday ? 0 : locale.firstDayOfWeek()));
+ QCOMPARE(object->property("groupSeparator").toString().at(0), locale.groupSeparator());
+ QCOMPARE(object->property("measurementSystem").toInt(), int(locale.measurementSystem()));
+ QCOMPARE(object->property("name").toString(), locale.name());
+ QCOMPARE(object->property("nativeCountryName").toString(), locale.nativeCountryName());
+ QCOMPARE(object->property("nativeLanguageName").toString(), locale.nativeLanguageName());
+ QCOMPARE(object->property("negativeSign").toString().at(0), locale.negativeSign());
+ QCOMPARE(object->property("percent").toString().at(0), locale.percent());
+ QCOMPARE(object->property("pmText").toString(), locale.pmText());
+ QCOMPARE(object->property("positiveSign").toString().at(0), locale.positiveSign());
+ QCOMPARE(object->property("textDirection").toInt(), int(locale.textDirection()));
+ QCOMPARE(object->property("uiLanguages").toStringList(), locale.uiLanguages());
+ QList<Qt::DayOfWeek> weekDays;
+ foreach (const QVariant &weekDay, object->property("weekDays").toList()) {
+ weekDays.append(Qt::DayOfWeek(weekDay.toInt()));
+ }
+ QCOMPARE(weekDays, locale.weekdays());
+ QCOMPARE(object->property("zeroDigit").toString().at(0), locale.zeroDigit());
+ }
+}
+
void tst_qqmlvaluetypes::sizereadonly()
{
{
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/status.500.reply b/tests/auto/qml/qqmlxmlhttprequest/data/status.500.reply
new file mode 100644
index 0000000000..cbe2424f34
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/status.500.reply
@@ -0,0 +1,3 @@
+HTTP/1.0 500 Internal Server Error
+Connection: close
+Content-type: text/html; charset=UTF-8
diff --git a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
index ae0350278a..47bf151a37 100644
--- a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
+++ b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
@@ -989,6 +989,7 @@ void tst_qqmlxmlhttprequest::responseText_data()
QTest::newRow("empty body") << testFileUrl("status.200.reply") << QUrl() << "";
QTest::newRow("Not Found") << testFileUrl("status.404.reply") << testFileUrl("testdocument.html") << "QML Rocks!\n";
QTest::newRow("Bad Request") << testFileUrl("status.400.reply") << testFileUrl("testdocument.html") << "QML Rocks!\n";
+ QTest::newRow("Internal server error") << testFileUrl("status.500.reply") << testFileUrl("testdocument.html") << "QML Rocks!\n";
}
void tst_qqmlxmlhttprequest::nonUtf8()
diff --git a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp
index f4765d0e8d..8ad2b6ba2b 100644
--- a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp
+++ b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp
@@ -338,19 +338,17 @@ void tst_QQuickWorkerScript::script_global()
delete worker;
}
+ qquickworkerscript_lastWarning = QString();
+
{
+ QtMessageHandler previousMsgHandler = qInstallMessageHandler(qquickworkerscript_warningsHandler);
+
QQmlComponent component(&m_engine, testFileUrl("worker_global2.qml"));
QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create());
QVERIFY(worker != 0);
- QString value("Hello");
-
- QtMessageHandler previousMsgHandler = qInstallMessageHandler(qquickworkerscript_warningsHandler);
-
- QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value)));
-
QTRY_COMPARE(qquickworkerscript_lastWarning,
- testFileUrl("script_global.js").toString() + QLatin1String(":2: Invalid write to global property \"world\""));
+ testFileUrl("script_global2.js").toString() + QLatin1String(":1: Invalid write to global property \"world\""));
qInstallMessageHandler(previousMsgHandler);
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_context.qml b/tests/auto/quick/qquickcanvasitem/data/tst_context.qml
index f266c16d76..566ad9d3d5 100644
--- a/tests/auto/quick/qquickcanvasitem/data/tst_context.qml
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_context.qml
@@ -182,4 +182,22 @@ Canvas {
}
}
}
+
+ TestCase {
+ name: "Colors"
+ when: canvas.available
+
+ function test_colors() {
+ wait(100);
+ compare(contextSpy.count, 1);
+
+ var ctx = canvas.getContext("2d");
+ // QTBUG-47894
+ ctx.strokeStyle = 'hsl(255, 100%, 50%)';
+ var c1 = ctx.strokeStyle.toString();
+ ctx.strokeStyle = 'hsl(320, 100%, 50%)';
+ var c2 = ctx.strokeStyle.toString();
+ verify(c1 !== c2);
+ }
+ }
}
diff --git a/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp b/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp
index 49535783c1..1104ce1d98 100644
--- a/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp
+++ b/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp
@@ -394,7 +394,8 @@ void tst_qquickdesignersupport::statesPropertyChanges()
//Create new PropertyChanges
QQuickPropertyChanges *newPropertyChange = new QQuickPropertyChanges();
newPropertyChange->setParent(state01);
- QQuickStatePrivate::operations_append(&state01->changes(), newPropertyChange);
+ QQmlListProperty<QQuickStateOperation> changes = state01->changes();
+ QQuickStatePrivate::operations_append(&changes, newPropertyChange);
newPropertyChange->setObject(rootItem);
diff --git a/tests/auto/quick/qquickgridview/data/gridview-initCurrent.qml b/tests/auto/quick/qquickgridview/data/gridview-initCurrent.qml
index af35d2fa1b..0a6184c9de 100644
--- a/tests/auto/quick/qquickgridview/data/gridview-initCurrent.qml
+++ b/tests/auto/quick/qquickgridview/data/gridview-initCurrent.qml
@@ -6,6 +6,7 @@ Rectangle {
property int current: grid.currentIndex
property bool showHeader: false
property bool showFooter: false
+ property int currentItemChangedCount: 0
width: 240
height: 320
@@ -63,5 +64,7 @@ Rectangle {
model: testModel
header: root.showHeader ? headerFooter : null
footer: root.showFooter ? headerFooter : null
+
+ onCurrentItemChanged: { root.currentItemChangedCount++ }
}
}
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
index 87042ca7ba..3699bef56d 100644
--- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
+++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
@@ -1886,9 +1886,12 @@ void tst_QQuickGridView::currentIndex()
QTRY_COMPARE(gridview->highlightItem()->y(), hlPosY);
// insert item before currentIndex
+ window->rootObject()->setProperty("currentItemChangedCount", QVariant(0));
gridview->setCurrentIndex(28);
+ QTRY_COMPARE(window->rootObject()->property("currentItemChangedCount").toInt(), 1);
model.insertItem(0, "Foo", "1111");
QTRY_COMPARE(window->rootObject()->property("current").toInt(), 29);
+ QCOMPARE(window->rootObject()->property("currentItemChangedCount").toInt(), 1);
// check removing highlight by setting currentIndex to -1;
gridview->setCurrentIndex(-1);
diff --git a/tests/auto/quick/qquicklistview/data/listview-initCurrent.qml b/tests/auto/quick/qquicklistview/data/listview-initCurrent.qml
index a02b66b8af..8aff649a67 100644
--- a/tests/auto/quick/qquicklistview/data/listview-initCurrent.qml
+++ b/tests/auto/quick/qquicklistview/data/listview-initCurrent.qml
@@ -6,6 +6,7 @@ Rectangle {
property int current: list.currentIndex
property bool showHeader: false
property bool showFooter: false
+ property int currentItemChangedCount: 0
width: 240
height: 320
@@ -60,5 +61,7 @@ Rectangle {
model: testModel
header: root.showHeader ? headerFooter : null
footer: root.showFooter ? headerFooter : null
+
+ onCurrentItemChanged: { root.currentItemChangedCount++ }
}
}
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 472ffdc4b6..8e7f93849c 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -2718,9 +2718,12 @@ void tst_QQuickListView::currentIndex()
QTRY_COMPARE(listview->highlightItem()->y(), hlPos);
// insert item before currentIndex
+ window->rootObject()->setProperty("currentItemChangedCount", QVariant(0));
listview->setCurrentIndex(28);
+ QTRY_COMPARE(window->rootObject()->property("currentItemChangedCount").toInt(), 1);
model.insertItem(0, "Foo", "1111");
QTRY_COMPARE(window->rootObject()->property("current").toInt(), 29);
+ QCOMPARE(window->rootObject()->property("currentItemChangedCount").toInt(), 1);
// check removing highlight by setting currentIndex to -1;
listview->setCurrentIndex(-1);
diff --git a/tests/auto/quick/qquickview/tst_qquickview.cpp b/tests/auto/quick/qquickview/tst_qquickview.cpp
index 2f054e278a..69e27984c7 100644
--- a/tests/auto/quick/qquickview/tst_qquickview.cpp
+++ b/tests/auto/quick/qquickview/tst_qquickview.cpp
@@ -182,6 +182,10 @@ void tst_QQuickView::errors()
{
{
QQuickView view;
+ QVERIFY(view.errors().isEmpty()); // don't crash
+ }
+ {
+ QQuickView view;
QQmlTestMessageHandler messageHandler;
view.setSource(testFileUrl("error1.qml"));
QCOMPARE(view.status(), QQuickView::Error);
diff --git a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
index 11696e288f..7cc5dfa7c6 100644
--- a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
+++ b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
@@ -223,6 +223,7 @@ void tst_qquickwidget::errors()
{
QQuickWidget *view = new QQuickWidget;
QScopedPointer<QQuickWidget> cleanupView(view);
+ QVERIFY(view->errors().isEmpty()); // don't crash
QQmlTestMessageHandler messageHandler;
view->setSource(testFileUrl("error1.qml"));
diff --git a/tests/manual/v4/test262 b/tests/manual/v4/test262
-Subproject 0b5af3dcec772bb06b4d685a20b2859cda59d18
+Subproject 9741ac4655808ac46c127e3d1d8ba3d27ada618