summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/src/declarative/globalobject.qdoc31
-rw-r--r--src/declarative/qml/qmlengine.cpp33
-rw-r--r--tests/auto/declarative/qmlqt/data/darker.qml8
-rw-r--r--tests/auto/declarative/qmlqt/data/enums.qml9
-rw-r--r--tests/auto/declarative/qmlqt/data/hsla.qml11
-rw-r--r--tests/auto/declarative/qmlqt/data/lighter.qml7
-rw-r--r--tests/auto/declarative/qmlqt/data/point.qml9
-rw-r--r--tests/auto/declarative/qmlqt/data/rect.qml9
-rw-r--r--tests/auto/declarative/qmlqt/data/rgba.qml10
-rw-r--r--tests/auto/declarative/qmlqt/data/size.qml11
-rw-r--r--tests/auto/declarative/qmlqt/data/tint.qml9
-rw-r--r--tests/auto/declarative/qmlqt/data/vector.qml8
-rw-r--r--tests/auto/declarative/qmlqt/qmlqt.pro9
-rw-r--r--tests/auto/declarative/qmlqt/tst_qmlqt.cpp264
14 files changed, 390 insertions, 38 deletions
diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc
index e327047..f1d440f 100644
--- a/doc/src/declarative/globalobject.qdoc
+++ b/doc/src/declarative/globalobject.qdoc
@@ -92,34 +92,9 @@ This function returns a Rect with the top-left corner at \c x,\c y and the speci
\section3 Qt.point(int x, int y)
This function returns a Point with the specified \c x and \c y coordinates.
\section3 Qt.size(int width, int height)
-returns as Size with the specified width and height.
-\section3 Qt.vector(real x, real y, real z)
- This function is intended for use inside QML only. In C++ just create a
- QVector3D as usual.
-
- This function takes three numeric components and combines them into a
- QVector3D value that can be used with any property that takes a
- QVector3D argument. The following QML code:
-
- \code
- transform: Rotation {
- id: rotation
- origin.x: Container.width / 2;
- axis: vector(0, 1, 1)
- }
- \endcode
-
- is equivalent to:
-
- \code
- transform: Rotation {
- id: rotation
- origin.x: Container.width / 2;
- axis.x: 0; axis.y: 1; axis.z: 0
- }
- \endcode
-
-
+This function returns as Size with the specified width and height.
+\section3 Qt.vector3d(real x, real y, real z)
+This function returns a Vector3D with the specified x, y and z.
\section2 Functions
The Qt object also contains the following miscellaneous functions which expose Qt functionality for use in QML.
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index 07296d9..7242a1d 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -666,7 +666,7 @@ QScriptValue QmlEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngi
QScriptValue QmlEnginePrivate::vector(QScriptContext *ctxt, QScriptEngine *engine)
{
- if(ctxt->argumentCount() < 3)
+ if(ctxt->argumentCount() != 3)
return engine->nullValue();
qsreal x = ctxt->argument(0).toNumber();
qsreal y = ctxt->argument(1).toNumber();
@@ -677,41 +677,54 @@ QScriptValue QmlEnginePrivate::vector(QScriptContext *ctxt, QScriptEngine *engin
QScriptValue QmlEnginePrivate::rgba(QScriptContext *ctxt, QScriptEngine *engine)
{
int argCount = ctxt->argumentCount();
- if(argCount < 3)
+ if(argCount < 3 || argCount > 4)
return engine->nullValue();
qsreal r = ctxt->argument(0).toNumber();
qsreal g = ctxt->argument(1).toNumber();
qsreal b = ctxt->argument(2).toNumber();
qsreal a = (argCount == 4) ? ctxt->argument(3).toNumber() : 1;
+
+ if (r < 0 || r > 1 || g < 0 || g > 1 || b < 0 || b > 1 || a < 0 || a > 1)
+ return engine->nullValue();
+
return qScriptValueFromValue(engine, qVariantFromValue(QColor::fromRgbF(r, g, b, a)));
}
QScriptValue QmlEnginePrivate::hsla(QScriptContext *ctxt, QScriptEngine *engine)
{
int argCount = ctxt->argumentCount();
- if(argCount < 3)
+ if(argCount < 3 || argCount > 4)
return engine->nullValue();
qsreal h = ctxt->argument(0).toNumber();
qsreal s = ctxt->argument(1).toNumber();
qsreal l = ctxt->argument(2).toNumber();
qsreal a = (argCount == 4) ? ctxt->argument(3).toNumber() : 1;
+
+ if (h < 0 || h > 1 || s < 0 || s > 1 || l < 0 || l > 1 || a < 0 || a > 1)
+ return engine->nullValue();
+
return qScriptValueFromValue(engine, qVariantFromValue(QColor::fromHslF(h, s, l, a)));
}
QScriptValue QmlEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine *engine)
{
- if(ctxt->argumentCount() < 4)
+ if(ctxt->argumentCount() != 4)
return engine->nullValue();
+
qsreal x = ctxt->argument(0).toNumber();
qsreal y = ctxt->argument(1).toNumber();
qsreal w = ctxt->argument(2).toNumber();
qsreal h = ctxt->argument(3).toNumber();
+
+ if (w < 0 || h < 0)
+ return engine->nullValue();
+
return qScriptValueFromValue(engine, qVariantFromValue(QRectF(x, y, w, h)));
}
QScriptValue QmlEnginePrivate::point(QScriptContext *ctxt, QScriptEngine *engine)
{
- if(ctxt->argumentCount() < 2)
+ if(ctxt->argumentCount() != 2)
return engine->nullValue();
qsreal x = ctxt->argument(0).toNumber();
qsreal y = ctxt->argument(1).toNumber();
@@ -720,7 +733,7 @@ QScriptValue QmlEnginePrivate::point(QScriptContext *ctxt, QScriptEngine *engine
QScriptValue QmlEnginePrivate::size(QScriptContext *ctxt, QScriptEngine *engine)
{
- if(ctxt->argumentCount() < 2)
+ if(ctxt->argumentCount() != 2)
return engine->nullValue();
qsreal w = ctxt->argument(0).toNumber();
qsreal h = ctxt->argument(1).toNumber();
@@ -729,7 +742,7 @@ QScriptValue QmlEnginePrivate::size(QScriptContext *ctxt, QScriptEngine *engine)
QScriptValue QmlEnginePrivate::lighter(QScriptContext *ctxt, QScriptEngine *engine)
{
- if(ctxt->argumentCount() < 1)
+ if(ctxt->argumentCount() != 1)
return engine->nullValue();
QVariant v = ctxt->argument(0).toVariant();
QColor color;
@@ -748,7 +761,7 @@ QScriptValue QmlEnginePrivate::lighter(QScriptContext *ctxt, QScriptEngine *engi
QScriptValue QmlEnginePrivate::darker(QScriptContext *ctxt, QScriptEngine *engine)
{
- if(ctxt->argumentCount() < 1)
+ if(ctxt->argumentCount() != 1)
return engine->nullValue();
QVariant v = ctxt->argument(0).toVariant();
QColor color;
@@ -767,7 +780,7 @@ QScriptValue QmlEnginePrivate::darker(QScriptContext *ctxt, QScriptEngine *engin
QScriptValue QmlEnginePrivate::playSound(QScriptContext *ctxt, QScriptEngine *engine)
{
- if (ctxt->argumentCount() < 1)
+ if (ctxt->argumentCount() != 1)
return engine->undefinedValue();
QUrl url(ctxt->argument(0).toString());
@@ -799,7 +812,7 @@ QScriptValue QmlEnginePrivate::desktopOpenUrl(QScriptContext *ctxt, QScriptEngin
QScriptValue QmlEnginePrivate::tint(QScriptContext *ctxt, QScriptEngine *engine)
{
- if(ctxt->argumentCount() < 2)
+ if(ctxt->argumentCount() != 2)
return engine->nullValue();
//get color
QVariant v = ctxt->argument(0).toVariant();
diff --git a/tests/auto/declarative/qmlqt/data/darker.qml b/tests/auto/declarative/qmlqt/data/darker.qml
new file mode 100644
index 0000000..6369e8f
--- /dev/null
+++ b/tests/auto/declarative/qmlqt/data/darker.qml
@@ -0,0 +1,8 @@
+import Qt 4.6
+
+Object {
+ property var test1: Qt.darker(Qt.rgba(1, 0.8, 0.3))
+ property var test2: Qt.darker()
+ property var test3: Qt.darker(Qt.rgba(1, 0.8, 0.3), 10)
+}
+
diff --git a/tests/auto/declarative/qmlqt/data/enums.qml b/tests/auto/declarative/qmlqt/data/enums.qml
new file mode 100644
index 0000000..f87886e
--- /dev/null
+++ b/tests/auto/declarative/qmlqt/data/enums.qml
@@ -0,0 +1,9 @@
+import Qt 4.6
+
+Object {
+ property int test1: Qt.Key_Escape
+ property int test2: Qt.DescendingOrder
+ property int test3: Qt.ElideMiddle
+ property int test4: Qt.AlignRight
+}
+
diff --git a/tests/auto/declarative/qmlqt/data/hsla.qml b/tests/auto/declarative/qmlqt/data/hsla.qml
new file mode 100644
index 0000000..fedb56a
--- /dev/null
+++ b/tests/auto/declarative/qmlqt/data/hsla.qml
@@ -0,0 +1,11 @@
+import Qt 4.6
+
+Object {
+ property color test1: Qt.hsla(1, 0, 0, 0.8);
+ property color test2: Qt.hsla(1, 0.5, 0.3);
+ property color test3: Qt.hsla(1, 1);
+ property color test4: Qt.hsla(1, 1, 1, 1, 1);
+ property color test5: Qt.hsla(1.2, 1, 1);
+ property color test6: Qt.hsla(-0.1, 1, 1);
+}
+
diff --git a/tests/auto/declarative/qmlqt/data/lighter.qml b/tests/auto/declarative/qmlqt/data/lighter.qml
new file mode 100644
index 0000000..6c888e7
--- /dev/null
+++ b/tests/auto/declarative/qmlqt/data/lighter.qml
@@ -0,0 +1,7 @@
+import Qt 4.6
+
+Object {
+ property var test1: Qt.lighter(Qt.rgba(1, 0.8, 0.3))
+ property var test2: Qt.lighter()
+ property var test3: Qt.lighter(Qt.rgba(1, 0.8, 0.3), 10)
+}
diff --git a/tests/auto/declarative/qmlqt/data/point.qml b/tests/auto/declarative/qmlqt/data/point.qml
new file mode 100644
index 0000000..582cb00
--- /dev/null
+++ b/tests/auto/declarative/qmlqt/data/point.qml
@@ -0,0 +1,9 @@
+import Qt 4.6
+
+Object {
+ property var test1: Qt.point(19, 34);
+ property var test2: Qt.point(-3, 109.2);
+ property var test3: Qt.point(-3);
+ property var test4: Qt.point(-3, 109.2, 1);
+}
+
diff --git a/tests/auto/declarative/qmlqt/data/rect.qml b/tests/auto/declarative/qmlqt/data/rect.qml
new file mode 100644
index 0000000..53d8c38
--- /dev/null
+++ b/tests/auto/declarative/qmlqt/data/rect.qml
@@ -0,0 +1,9 @@
+import Qt 4.6
+
+Object {
+ property var test1: Qt.rect(10, 13, 100, 109)
+ property var test2: Qt.rect(-10, 13, 100, 109.6)
+ property var test3: Qt.rect(10, 13);
+ property var test4: Qt.rect(10, 13, 100, 109, 10)
+ property var test5: Qt.rect(10, 13, 100, -109)
+}
diff --git a/tests/auto/declarative/qmlqt/data/rgba.qml b/tests/auto/declarative/qmlqt/data/rgba.qml
new file mode 100644
index 0000000..3fdfe2c
--- /dev/null
+++ b/tests/auto/declarative/qmlqt/data/rgba.qml
@@ -0,0 +1,10 @@
+import Qt 4.6
+
+Object {
+ property color test1: Qt.rgba(1, 0, 0, 0.8);
+ property color test2: Qt.rgba(1, 0.5, 0.3);
+ property color test3: Qt.rgba(1, 1);
+ property color test4: Qt.rgba(1, 1, 1, 1, 1);
+ property color test5: Qt.rgba(1.2, 1, 1);
+ property color test6: Qt.rgba(-0.1, 1, 1);
+}
diff --git a/tests/auto/declarative/qmlqt/data/size.qml b/tests/auto/declarative/qmlqt/data/size.qml
new file mode 100644
index 0000000..f0d2e81
--- /dev/null
+++ b/tests/auto/declarative/qmlqt/data/size.qml
@@ -0,0 +1,11 @@
+import Qt 4.6
+
+Object {
+ property var test1: Qt.size(19, 34);
+ property var test2: Qt.size(3, 109.2);
+ property var test3: Qt.size(-3, 10);
+ property var test4: Qt.size(3);
+ property var test5: Qt.size(3, 109.2, 1);
+}
+
+
diff --git a/tests/auto/declarative/qmlqt/data/tint.qml b/tests/auto/declarative/qmlqt/data/tint.qml
new file mode 100644
index 0000000..31e67ba
--- /dev/null
+++ b/tests/auto/declarative/qmlqt/data/tint.qml
@@ -0,0 +1,9 @@
+import Qt 4.6
+
+Object {
+ property color test1: Qt.tint("red", "blue");
+ property color test2: Qt.tint(Qt.rgba(1, 0, 0), Qt.rgba(0, 0, 0, 0));
+ property color test3: Qt.tint("red", Qt.rgba(0, 0, 1, 0.5)); // XXX - what should this be?
+ property color test4: Qt.tint("red", Qt.rgba(0, 0, 1, 0.5), 10);
+ property color test5: Qt.tint("red")
+}
diff --git a/tests/auto/declarative/qmlqt/data/vector.qml b/tests/auto/declarative/qmlqt/data/vector.qml
new file mode 100644
index 0000000..b879bd6
--- /dev/null
+++ b/tests/auto/declarative/qmlqt/data/vector.qml
@@ -0,0 +1,8 @@
+import Qt 4.6
+
+Object {
+ property var test1: Qt.vector3d(1, 0, 0.9);
+ property var test2: Qt.vector3d(102, -10, -982.1);
+ property var test3: Qt.vector3d(102, -10);
+ property var test4: Qt.vector3d(102, -10, -982.1, 10);
+}
diff --git a/tests/auto/declarative/qmlqt/qmlqt.pro b/tests/auto/declarative/qmlqt/qmlqt.pro
new file mode 100644
index 0000000..5e79ea6
--- /dev/null
+++ b/tests/auto/declarative/qmlqt/qmlqt.pro
@@ -0,0 +1,9 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qmlqt.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
+# LIBS += -lgcov
diff --git a/tests/auto/declarative/qmlqt/tst_qmlqt.cpp b/tests/auto/declarative/qmlqt/tst_qmlqt.cpp
new file mode 100644
index 0000000..10402ae
--- /dev/null
+++ b/tests/auto/declarative/qmlqt/tst_qmlqt.cpp
@@ -0,0 +1,264 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 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$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QDebug>
+#include <QmlEngine>
+#include <QFileInfo>
+#include <QmlComponent>
+#include <QDir>
+#include <QVector3D>
+
+class tst_qmlqt : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qmlqt() {}
+
+private slots:
+ void enums();
+ void rgba();
+ void hsla();
+ void rect();
+ void point();
+ void size();
+ void vector();
+ void lighter();
+ void darker();
+ void tint();
+ void playSound();
+ void openUrlExternally();
+
+private:
+ QmlEngine engine;
+};
+
+inline QUrl TEST_FILE(const QString &filename)
+{
+ return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename);
+}
+
+void tst_qmlqt::enums()
+{
+ QmlComponent component(&engine, TEST_FILE("enums.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toInt(), (int)Qt::Key_Escape);
+ QCOMPARE(object->property("test2").toInt(), (int)Qt::DescendingOrder);
+ QCOMPARE(object->property("test3").toInt(), (int)Qt::ElideMiddle);
+ QCOMPARE(object->property("test4").toInt(), (int)Qt::AlignRight);
+
+ delete object;
+}
+
+void tst_qmlqt::rgba()
+{
+ QmlComponent component(&engine, TEST_FILE("rgba.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Unable to assign null to QColor";
+ QString warning2 = component.url().toString() + ":7: Unable to assign null to QColor";
+ QString warning3 = component.url().toString() + ":8: Unable to assign null to QColor";
+ QString warning4 = component.url().toString() + ":9: Unable to assign null to QColor";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning4));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+
+ QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0, 0, 0.8));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromRgbF(1, 0.5, 0.3, 1));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor());
+
+ delete object;
+}
+
+void tst_qmlqt::hsla()
+{
+ QmlComponent component(&engine, TEST_FILE("hsla.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Unable to assign null to QColor";
+ QString warning2 = component.url().toString() + ":7: Unable to assign null to QColor";
+ QString warning3 = component.url().toString() + ":8: Unable to assign null to QColor";
+ QString warning4 = component.url().toString() + ":9: Unable to assign null to QColor";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning4));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromHslF(1, 0, 0, 0.8));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromHslF(1, 0.5, 0.3, 1));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor());
+
+ delete object;
+}
+
+void tst_qmlqt::rect()
+{
+ QmlComponent component(&engine, TEST_FILE("rect.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QRectF>(object->property("test1")), QRectF(10, 13, 100, 109));
+ QCOMPARE(qvariant_cast<QRectF>(object->property("test2")), QRectF(-10, 13, 100, 109.6));
+ QCOMPARE(qvariant_cast<QRectF>(object->property("test3")), QRectF());
+ QCOMPARE(qvariant_cast<QRectF>(object->property("test4")), QRectF());
+ QCOMPARE(qvariant_cast<QRectF>(object->property("test5")), QRectF());
+
+ delete object;
+}
+
+void tst_qmlqt::point()
+{
+ QmlComponent component(&engine, TEST_FILE("point.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QPointF>(object->property("test1")), QPointF(19, 34));
+ QCOMPARE(qvariant_cast<QPointF>(object->property("test2")), QPointF(-3, 109.2));
+ QCOMPARE(qvariant_cast<QPointF>(object->property("test3")), QPointF());
+ QCOMPARE(qvariant_cast<QPointF>(object->property("test4")), QPointF());
+
+ delete object;
+}
+
+void tst_qmlqt::size()
+{
+ QmlComponent component(&engine, TEST_FILE("size.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QSizeF>(object->property("test1")), QSizeF(19, 34));
+ QCOMPARE(qvariant_cast<QSizeF>(object->property("test2")), QSizeF(3, 109.2));
+ QCOMPARE(qvariant_cast<QSizeF>(object->property("test3")), QSizeF(-3, 10));
+ QCOMPARE(qvariant_cast<QSizeF>(object->property("test4")), QSizeF());
+ QCOMPARE(qvariant_cast<QSizeF>(object->property("test5")), QSizeF());
+
+ delete object;
+}
+
+void tst_qmlqt::vector()
+{
+ QmlComponent component(&engine, TEST_FILE("vector.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QVector3D>(object->property("test1")), QVector3D(1, 0, 0.9));
+ QCOMPARE(qvariant_cast<QVector3D>(object->property("test2")), QVector3D(102, -10, -982.1));
+ QCOMPARE(qvariant_cast<QVector3D>(object->property("test3")), QVector3D());
+ QCOMPARE(qvariant_cast<QVector3D>(object->property("test4")), QVector3D());
+
+ delete object;
+}
+
+void tst_qmlqt::lighter()
+{
+ QmlComponent component(&engine, TEST_FILE("lighter.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0.8, 0.3).lighter());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor());
+
+ delete object;
+}
+
+void tst_qmlqt::darker()
+{
+ QmlComponent component(&engine, TEST_FILE("darker.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0.8, 0.3).darker());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor());
+
+ delete object;
+}
+
+void tst_qmlqt::tint()
+{
+ QmlComponent component(&engine, TEST_FILE("tint.qml"));
+
+ QString warning1 = component.url().toString() + ":7: Unable to assign null to QColor";
+ QString warning2 = component.url().toString() + ":8: Unable to assign null to QColor";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(0, 0, 1));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromRgbF(1, 0, 0));
+ // Fails due to QT-2424
+ QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor::fromRgbF(1, 0, 0));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor());
+
+ delete object;
+}
+
+void tst_qmlqt::playSound()
+{
+ QEXPECT_FAIL("", "How do we test this?", Abort);
+}
+
+void tst_qmlqt::openUrlExternally()
+{
+ QEXPECT_FAIL("", "How do we test this?", Abort);
+}
+
+QTEST_MAIN(tst_qmlqt)
+
+#include "tst_qmlqt.moc"