Reenable value type binding auto removal tests.
[profile/ivi/qtdeclarative.git] / tests / auto / declarative / qdeclarativevaluetypes / tst_qdeclarativevaluetypes.cpp
index 5869310..15001f7 100644 (file)
@@ -1,8 +1,7 @@
 /****************************************************************************
 **
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
 **
 ** This file is part of the test suite of the Qt Toolkit.
 **
@@ -35,6 +34,7 @@
 **
 **
 **
+**
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
 #include <QDeclarativeComponent>
 #include <QDebug>
 #include <private/qdeclarativevaluetype_p.h>
+#include "../../shared/util.h"
 #include "testtypes.h"
 
-#ifdef Q_OS_SYMBIAN
-// In Symbian OS test data is located in applications private dir
-#define SRCDIR "."
-#endif
-
 QT_BEGIN_NAMESPACE
 extern int qt_defaultDpi();
 QT_END_NAMESPACE
 
-class tst_qdeclarativevaluetypes : public QObject
+class tst_qdeclarativevaluetypes : public QDeclarativeDataTest
 {
     Q_OBJECT
 public:
@@ -77,6 +73,7 @@ private slots:
     void quaternion();
     void matrix4x4();
     void font();
+    void color();
     void variant();
 
     void bindingAssignment();
@@ -96,6 +93,7 @@ private slots:
     void returnValues();
     void varAssignment();
     void bindingsSpliceCorrectly();
+    void nonValueTypeComparison();
 
 private:
     QDeclarativeEngine engine;
@@ -103,18 +101,14 @@ private:
 
 void tst_qdeclarativevaluetypes::initTestCase()
 {
+    QDeclarativeDataTest::initTestCase();
     registerTypes();
 }
 
-inline QUrl TEST_FILE(const QString &filename)
-{
-    return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename);
-}
-
 void tst_qdeclarativevaluetypes::point()
 {
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("point_read.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("point_read.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -126,7 +120,7 @@ void tst_qdeclarativevaluetypes::point()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("point_write.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("point_write.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -136,7 +130,7 @@ void tst_qdeclarativevaluetypes::point()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("point_compare.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("point_compare.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -159,7 +153,7 @@ void tst_qdeclarativevaluetypes::point()
 void tst_qdeclarativevaluetypes::pointf()
 {
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("pointf_read.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("pointf_read.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -171,7 +165,7 @@ void tst_qdeclarativevaluetypes::pointf()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("pointf_write.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("pointf_write.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -181,7 +175,7 @@ void tst_qdeclarativevaluetypes::pointf()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("pointf_compare.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("pointf_compare.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -204,7 +198,7 @@ void tst_qdeclarativevaluetypes::pointf()
 void tst_qdeclarativevaluetypes::size()
 {
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("size_read.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("size_read.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -216,7 +210,7 @@ void tst_qdeclarativevaluetypes::size()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("size_write.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("size_write.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -226,7 +220,7 @@ void tst_qdeclarativevaluetypes::size()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("size_compare.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("size_compare.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -249,7 +243,7 @@ void tst_qdeclarativevaluetypes::size()
 void tst_qdeclarativevaluetypes::sizef()
 {
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("sizef_read.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("sizef_read.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -261,7 +255,7 @@ void tst_qdeclarativevaluetypes::sizef()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("sizef_write.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("sizef_write.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -271,7 +265,7 @@ void tst_qdeclarativevaluetypes::sizef()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("sizef_compare.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("sizef_compare.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -293,7 +287,7 @@ void tst_qdeclarativevaluetypes::sizef()
 
 void tst_qdeclarativevaluetypes::variant()
 {
-    QDeclarativeComponent component(&engine, TEST_FILE("variant_read.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("variant_read.qml"));
     MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
     QVERIFY(object != 0);
 
@@ -307,7 +301,7 @@ void tst_qdeclarativevaluetypes::variant()
 void tst_qdeclarativevaluetypes::sizereadonly()
 {
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("sizereadonly_read.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("sizereadonly_read.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -319,25 +313,25 @@ void tst_qdeclarativevaluetypes::sizereadonly()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("sizereadonly_writeerror.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("sizereadonly_writeerror.qml"));
         QVERIFY(component.isError());
         QCOMPARE(component.errors().at(0).description(), QLatin1String("Invalid property assignment: \"sizereadonly\" is a read-only property"));
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("sizereadonly_writeerror2.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("sizereadonly_writeerror2.qml"));
         QVERIFY(component.isError());
         QCOMPARE(component.errors().at(0).description(), QLatin1String("Invalid property assignment: \"sizereadonly\" is a read-only property"));
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("sizereadonly_writeerror3.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("sizereadonly_writeerror3.qml"));
         QVERIFY(component.isError());
         QCOMPARE(component.errors().at(0).description(), QLatin1String("Invalid property assignment: \"sizereadonly\" is a read-only property"));
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("sizereadonly_writeerror4.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("sizereadonly_writeerror4.qml"));
 
         QObject *object = component.create();
         QVERIFY(object);
@@ -351,7 +345,7 @@ void tst_qdeclarativevaluetypes::sizereadonly()
 void tst_qdeclarativevaluetypes::rect()
 {
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("rect_read.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("rect_read.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -365,7 +359,7 @@ void tst_qdeclarativevaluetypes::rect()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("rect_write.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("rect_write.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -375,7 +369,7 @@ void tst_qdeclarativevaluetypes::rect()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("rect_compare.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("rect_compare.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -398,7 +392,7 @@ void tst_qdeclarativevaluetypes::rect()
 void tst_qdeclarativevaluetypes::rectf()
 {
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("rectf_read.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("rectf_read.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -412,7 +406,7 @@ void tst_qdeclarativevaluetypes::rectf()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("rectf_write.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("rectf_write.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -422,7 +416,7 @@ void tst_qdeclarativevaluetypes::rectf()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("rectf_compare.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("rectf_compare.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -445,7 +439,7 @@ void tst_qdeclarativevaluetypes::rectf()
 void tst_qdeclarativevaluetypes::vector2d()
 {
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("vector2d_read.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("vector2d_read.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -457,7 +451,7 @@ void tst_qdeclarativevaluetypes::vector2d()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("vector2d_write.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("vector2d_write.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -467,7 +461,7 @@ void tst_qdeclarativevaluetypes::vector2d()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("vector2d_compare.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("vector2d_compare.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -488,7 +482,7 @@ void tst_qdeclarativevaluetypes::vector2d()
 void tst_qdeclarativevaluetypes::vector3d()
 {
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("vector3d_read.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("vector3d_read.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -501,7 +495,7 @@ void tst_qdeclarativevaluetypes::vector3d()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("vector3d_write.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("vector3d_write.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -511,7 +505,7 @@ void tst_qdeclarativevaluetypes::vector3d()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("vector3d_compare.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("vector3d_compare.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -533,7 +527,7 @@ void tst_qdeclarativevaluetypes::vector3d()
 void tst_qdeclarativevaluetypes::vector4d()
 {
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("vector4d_read.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("vector4d_read.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -547,7 +541,7 @@ void tst_qdeclarativevaluetypes::vector4d()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("vector4d_write.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("vector4d_write.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -557,7 +551,7 @@ void tst_qdeclarativevaluetypes::vector4d()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("vector4d_compare.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("vector4d_compare.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -578,7 +572,7 @@ void tst_qdeclarativevaluetypes::vector4d()
 void tst_qdeclarativevaluetypes::quaternion()
 {
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("quaternion_read.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("quaternion_read.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -592,7 +586,7 @@ void tst_qdeclarativevaluetypes::quaternion()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("quaternion_write.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("quaternion_write.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -602,7 +596,7 @@ void tst_qdeclarativevaluetypes::quaternion()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("quaternion_compare.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("quaternion_compare.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -623,7 +617,7 @@ void tst_qdeclarativevaluetypes::quaternion()
 void tst_qdeclarativevaluetypes::matrix4x4()
 {
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("matrix4x4_read.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("matrix4x4_read.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -653,7 +647,7 @@ void tst_qdeclarativevaluetypes::matrix4x4()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("matrix4x4_write.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("matrix4x4_write.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -666,7 +660,7 @@ void tst_qdeclarativevaluetypes::matrix4x4()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("matrix4x4_compare.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("matrix4x4_compare.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -687,7 +681,7 @@ void tst_qdeclarativevaluetypes::matrix4x4()
 void tst_qdeclarativevaluetypes::font()
 {
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("font_read.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("font_read.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -710,7 +704,7 @@ void tst_qdeclarativevaluetypes::font()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("font_write.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("font_write.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -743,7 +737,7 @@ void tst_qdeclarativevaluetypes::font()
 
     // Test pixelSize
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("font_write.2.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("font_write.2.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -754,7 +748,7 @@ void tst_qdeclarativevaluetypes::font()
 
     // Test pixelSize and pointSize
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("font_write.3.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("font_write.3.qml"));
         QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size. ");
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
@@ -764,7 +758,7 @@ void tst_qdeclarativevaluetypes::font()
         delete object;
     }
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("font_write.4.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("font_write.4.qml"));
         QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size. ");
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
@@ -774,7 +768,7 @@ void tst_qdeclarativevaluetypes::font()
         delete object;
     }
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("font_write.5.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("font_write.5.qml"));
         QObject *object = qobject_cast<QObject *>(component.create());
         QVERIFY(object != 0);
         MyTypeObject *object1 = object->findChild<MyTypeObject *>("object1");
@@ -789,11 +783,11 @@ void tst_qdeclarativevaluetypes::font()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("font_compare.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("font_compare.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
-        QString tostring = QLatin1String("QFont(Arial,29,-1,0,63,1,1,1,0,0)");
+        QString tostring = QLatin1String("QFont(") + object->font().toString() + QLatin1Char(')');
         QCOMPARE(object->property("tostring").toString(), tostring);
         QCOMPARE(object->property("equalsString").toBool(), true);
         QCOMPARE(object->property("equalsColor").toBool(), false);
@@ -807,10 +801,77 @@ void tst_qdeclarativevaluetypes::font()
     }
 }
 
+void tst_qdeclarativevaluetypes::color()
+{
+    {
+        QDeclarativeComponent component(&engine, testFileUrl("color_read.qml"));
+        MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+        QVERIFY(object != 0);
+
+        QCOMPARE((float)object->property("v_r").toDouble(), (float)0.2);
+        QCOMPARE((float)object->property("v_g").toDouble(), (float)0.88);
+        QCOMPARE((float)object->property("v_b").toDouble(), (float)0.6);
+        QCOMPARE((float)object->property("v_a").toDouble(), (float)0.34);
+        QColor comparison;
+        comparison.setRedF(0.2);
+        comparison.setGreenF(0.88);
+        comparison.setBlueF(0.6);
+        comparison.setAlphaF(0.34);
+        QCOMPARE(object->property("copy"), QVariant(comparison));
+
+        delete object;
+    }
+
+    {
+        QDeclarativeComponent component(&engine, testFileUrl("color_write.qml"));
+        MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+        QVERIFY(object != 0);
+
+        QColor newColor;
+        newColor.setRedF(0.5);
+        newColor.setGreenF(0.38);
+        newColor.setBlueF(0.3);
+        newColor.setAlphaF(0.7);
+        QCOMPARE(object->color(), newColor);
+
+        delete object;
+    }
+
+    {
+        QDeclarativeComponent component(&engine, testFileUrl("color_compare.qml"));
+        MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+        QVERIFY(object != 0);
+        QString colorString("#33e199");
+        QCOMPARE(object->property("colorToString").toString(), colorString);
+        QCOMPARE(object->property("colorEqualsIdenticalRgba").toBool(), true);
+        QCOMPARE(object->property("colorEqualsDifferentAlpha").toBool(), false);
+        QCOMPARE(object->property("colorEqualsDifferentRgba").toBool(), false);
+        QCOMPARE(object->property("colorToStringEqualsColorString").toBool(), true);
+        QCOMPARE(object->property("colorToStringEqualsDifferentAlphaString").toBool(), true);
+        QCOMPARE(object->property("colorToStringEqualsDifferentRgbaString").toBool(), false);
+        QCOMPARE(object->property("colorEqualsColorString").toBool(), true);          // maintaining behaviour with QtQuick 1.0
+        QCOMPARE(object->property("colorEqualsDifferentAlphaString").toBool(), true); // maintaining behaviour with QtQuick 1.0
+        QCOMPARE(object->property("colorEqualsDifferentRgbaString").toBool(), false);
+
+        QCOMPARE(object->property("equalsColor").toBool(), true);
+        QCOMPARE(object->property("equalsVector3d").toBool(), false);
+        QCOMPARE(object->property("equalsSize").toBool(), false);
+        QCOMPARE(object->property("equalsPoint").toBool(), false);
+        QCOMPARE(object->property("equalsRect").toBool(), false);
+
+        // Color == Property and Property == Color should return the same result.
+        QCOMPARE(object->property("equalsColorRHS").toBool(), object->property("equalsColor").toBool());
+        QCOMPARE(object->property("colorEqualsCopy").toBool(), true);
+        QCOMPARE(object->property("copyEqualsColor").toBool(), object->property("colorEqualsCopy").toBool());
+
+        delete object;
+    }
+}
+
 // Test bindings can write to value types
 void tst_qdeclarativevaluetypes::bindingAssignment()
 {
-    QDeclarativeComponent component(&engine, TEST_FILE("bindingAssignment.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("bindingAssignment.qml"));
     MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
     QVERIFY(object != 0);
 
@@ -826,7 +887,7 @@ void tst_qdeclarativevaluetypes::bindingAssignment()
 // Test bindings can read from value types
 void tst_qdeclarativevaluetypes::bindingRead()
 {
-    QDeclarativeComponent component(&engine, TEST_FILE("bindingRead.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("bindingRead.qml"));
     MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
     QVERIFY(object != 0);
 
@@ -842,7 +903,7 @@ void tst_qdeclarativevaluetypes::bindingRead()
 // Test static values can assign to value types
 void tst_qdeclarativevaluetypes::staticAssignment()
 {
-    QDeclarativeComponent component(&engine, TEST_FILE("staticAssignment.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("staticAssignment.qml"));
     MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
     QVERIFY(object != 0);
 
@@ -854,7 +915,7 @@ void tst_qdeclarativevaluetypes::staticAssignment()
 // Test scripts can read/write value types
 void tst_qdeclarativevaluetypes::scriptAccess()
 {
-    QDeclarativeComponent component(&engine, TEST_FILE("scriptAccess.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("scriptAccess.qml"));
     MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
     QVERIFY(object != 0);
 
@@ -869,7 +930,7 @@ void tst_qdeclarativevaluetypes::scriptAccess()
 void tst_qdeclarativevaluetypes::autoBindingRemoval()
 {
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("autoBindingRemoval.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("autoBindingRemoval.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -890,9 +951,8 @@ void tst_qdeclarativevaluetypes::autoBindingRemoval()
         delete object;
     }
 
-    /*
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("autoBindingRemoval.2.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("autoBindingRemoval.2.qml"));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -914,7 +974,9 @@ void tst_qdeclarativevaluetypes::autoBindingRemoval()
     }
 
     {
-        QDeclarativeComponent component(&engine, TEST_FILE("autoBindingRemoval.3.qml"));
+        QDeclarativeComponent component(&engine, testFileUrl("autoBindingRemoval.3.qml"));
+        QString warning = component.url().toString() + ":6: Unable to assign [undefined] to QRect";
+        QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
@@ -932,13 +994,12 @@ void tst_qdeclarativevaluetypes::autoBindingRemoval()
 
         delete object;
     }
-*/
 }
 
 // Test that property value sources assign to value types
 void tst_qdeclarativevaluetypes::valueSources()
 {
-    QDeclarativeComponent component(&engine, TEST_FILE("valueSources.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("valueSources.qml"));
     MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
     QVERIFY(object != 0);
 
@@ -961,7 +1022,7 @@ static void checkNoErrors(QDeclarativeComponent& component)
 // Test that property value interceptors can be applied to value types
 void tst_qdeclarativevaluetypes::valueInterceptors()
 {
-    QDeclarativeComponent component(&engine, TEST_FILE("valueInterceptors.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("valueInterceptors.qml"));
     MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
     checkNoErrors(component);
     QVERIFY(object != 0);
@@ -978,7 +1039,7 @@ void tst_qdeclarativevaluetypes::valueInterceptors()
 // Test that you can't assign a binding to the "root" value type, and a sub-property
 void tst_qdeclarativevaluetypes::bindingConflict()
 {
-    QDeclarativeComponent component(&engine, TEST_FILE("bindingConflict.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("bindingConflict.qml"));
     QCOMPARE(component.isError(), true);
 }
 
@@ -995,7 +1056,7 @@ void tst_qdeclarativevaluetypes::bindingConflict()
 // doesn't crash
 void tst_qdeclarativevaluetypes::deletedObject()
 {
-    QDeclarativeComponent component(&engine, TEST_FILE("deletedObject.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("deletedObject.qml"));
     QTest::ignoreMessage(QtDebugMsg, "Test: 2");
     MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
     QVERIFY(object != 0);
@@ -1013,7 +1074,7 @@ void tst_qdeclarativevaluetypes::deletedObject()
 // Test that value types can be assigned to another value type property in a binding
 void tst_qdeclarativevaluetypes::bindingVariantCopy()
 {
-    QDeclarativeComponent component(&engine, TEST_FILE("bindingVariantCopy.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("bindingVariantCopy.qml"));
     MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
     QVERIFY(object != 0);
 
@@ -1025,7 +1086,7 @@ void tst_qdeclarativevaluetypes::bindingVariantCopy()
 // Test that value types can be assigned to another value type property in script
 void tst_qdeclarativevaluetypes::scriptVariantCopy()
 {
-    QDeclarativeComponent component(&engine, TEST_FILE("scriptVariantCopy.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("scriptVariantCopy.qml"));
     MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
     QVERIFY(object != 0);
 
@@ -1061,7 +1122,7 @@ void tst_qdeclarativevaluetypes::cppClasses()
 void tst_qdeclarativevaluetypes::enums()
 {
     {
-    QDeclarativeComponent component(&engine, TEST_FILE("enums.1.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("enums.1.qml"));
     MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
     QVERIFY(object != 0);
     QVERIFY(object->font().capitalization() == QFont::AllUppercase);
@@ -1069,7 +1130,7 @@ void tst_qdeclarativevaluetypes::enums()
     }
 
     {
-    QDeclarativeComponent component(&engine, TEST_FILE("enums.2.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("enums.2.qml"));
     MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
     QVERIFY(object != 0);
     QVERIFY(object->font().capitalization() == QFont::AllUppercase);
@@ -1077,7 +1138,7 @@ void tst_qdeclarativevaluetypes::enums()
     }
 
     {
-    QDeclarativeComponent component(&engine, TEST_FILE("enums.3.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("enums.3.qml"));
     MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
     QVERIFY(object != 0);
     QVERIFY(object->font().capitalization() == QFont::AllUppercase);
@@ -1085,7 +1146,7 @@ void tst_qdeclarativevaluetypes::enums()
     }
 
     {
-    QDeclarativeComponent component(&engine, TEST_FILE("enums.4.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("enums.4.qml"));
     MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
     QVERIFY(object != 0);
     QVERIFY(object->font().capitalization() == QFont::AllUppercase);
@@ -1093,7 +1154,7 @@ void tst_qdeclarativevaluetypes::enums()
     }
 
     {
-    QDeclarativeComponent component(&engine, TEST_FILE("enums.5.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("enums.5.qml"));
     MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
     QVERIFY(object != 0);
     QVERIFY(object->font().capitalization() == QFont::AllUppercase);
@@ -1106,7 +1167,7 @@ void tst_qdeclarativevaluetypes::enums()
 void tst_qdeclarativevaluetypes::conflictingBindings()
 {
     {
-    QDeclarativeComponent component(&engine, TEST_FILE("conflicting.1.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("conflicting.1.qml"));
     QObject *object = component.create();
     QVERIFY(object != 0);
 
@@ -1124,7 +1185,7 @@ void tst_qdeclarativevaluetypes::conflictingBindings()
     }
 
     {
-    QDeclarativeComponent component(&engine, TEST_FILE("conflicting.2.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("conflicting.2.qml"));
     QObject *object = component.create();
     QVERIFY(object != 0);
 
@@ -1142,7 +1203,7 @@ void tst_qdeclarativevaluetypes::conflictingBindings()
     }
 
     {
-    QDeclarativeComponent component(&engine, TEST_FILE("conflicting.3.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("conflicting.3.qml"));
     QObject *object = component.create();
     QVERIFY(object != 0);
 
@@ -1162,7 +1223,7 @@ void tst_qdeclarativevaluetypes::conflictingBindings()
 
 void tst_qdeclarativevaluetypes::returnValues()
 {
-    QDeclarativeComponent component(&engine, TEST_FILE("returnValues.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("returnValues.qml"));
     QObject *object = component.create();
     QVERIFY(object != 0);
 
@@ -1175,7 +1236,7 @@ void tst_qdeclarativevaluetypes::returnValues()
 
 void tst_qdeclarativevaluetypes::varAssignment()
 {
-    QDeclarativeComponent component(&engine, TEST_FILE("varAssignment.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("varAssignment.qml"));
     QObject *object = component.create();
     QVERIFY(object != 0);
 
@@ -1190,7 +1251,7 @@ void tst_qdeclarativevaluetypes::varAssignment()
 void tst_qdeclarativevaluetypes::bindingsSpliceCorrectly()
 {
     {
-    QDeclarativeComponent component(&engine, TEST_FILE("bindingsSpliceCorrectly.1.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.1.qml"));
     QObject *object = component.create();
     QVERIFY(object != 0);
 
@@ -1200,7 +1261,7 @@ void tst_qdeclarativevaluetypes::bindingsSpliceCorrectly()
     }
 
     {
-    QDeclarativeComponent component(&engine, TEST_FILE("bindingsSpliceCorrectly.2.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.2.qml"));
     QObject *object = component.create();
     QVERIFY(object != 0);
 
@@ -1211,7 +1272,7 @@ void tst_qdeclarativevaluetypes::bindingsSpliceCorrectly()
 
 
     {
-    QDeclarativeComponent component(&engine, TEST_FILE("bindingsSpliceCorrectly.3.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.3.qml"));
     QObject *object = component.create();
     QVERIFY(object != 0);
 
@@ -1221,7 +1282,7 @@ void tst_qdeclarativevaluetypes::bindingsSpliceCorrectly()
     }
 
     {
-    QDeclarativeComponent component(&engine, TEST_FILE("bindingsSpliceCorrectly.4.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.4.qml"));
     QObject *object = component.create();
     QVERIFY(object != 0);
 
@@ -1231,7 +1292,7 @@ void tst_qdeclarativevaluetypes::bindingsSpliceCorrectly()
     }
 
     {
-    QDeclarativeComponent component(&engine, TEST_FILE("bindingsSpliceCorrectly.5.qml"));
+    QDeclarativeComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.5.qml"));
     QObject *object = component.create();
     QVERIFY(object != 0);
 
@@ -1241,6 +1302,18 @@ void tst_qdeclarativevaluetypes::bindingsSpliceCorrectly()
     }
 }
 
+void tst_qdeclarativevaluetypes::nonValueTypeComparison()
+{
+    QDeclarativeComponent component(&engine, testFileUrl("nonValueTypeComparison.qml"));
+    QObject *object = component.create();
+    QVERIFY(object != 0);
+
+    QCOMPARE(object->property("test1").toBool(), true);
+    QCOMPARE(object->property("test2").toBool(), true);
+
+    delete object;
+}
+
 QTEST_MAIN(tst_qdeclarativevaluetypes)
 
 #include "tst_qdeclarativevaluetypes.moc"