From 6067b74bb7baadbd28bfdfa8e2d63b775c972b0f Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 24 Aug 2015 15:29:03 +0200 Subject: Fix hue clamping in Context2D It goes from 0..359, not 0..255. Task-number: QTBUG-47894 Change-Id: I0612a9d5e4999afae7703b5c49741b94fb0da07f Reviewed-by: Mitch Curtis --- tests/auto/quick/qquickcanvasitem/data/tst_context.qml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests') 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); + } + } } -- cgit v1.2.3 From d1b20513798ed441afddb87fd4e7facce78349e1 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 25 Aug 2015 15:43:56 +0200 Subject: Don't consider QLocale a value type. This fixes a regression where all of the properties of Qt.inputMethod.locale were undefined. Change-Id: Id33890a78296709baad6aeda96d74ca8cb39c61d Task-number: QTBUG-47916 Reviewed-by: Mitch Curtis Reviewed-by: Simon Hausmann --- tests/auto/qml/qqmlvaluetypes/data/locale_read.qml | 22 +++++++++++++ .../auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp | 38 ++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 tests/auto/qml/qqmlvaluetypes/data/locale_read.qml (limited to 'tests') 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 578004b0a1..f93190cab6 100644 --- a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp +++ b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #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 object(component.create()); + QVERIFY(!object.isNull()); + + QVERIFY(QQml_guiProvider()->inputMethod()); + QInputMethod *inputMethod = qobject_cast(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 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() { { -- cgit v1.2.3