~ubuntu-branches/ubuntu/saucy/qtdeclarative-opensource-src/saucy

« back to all changes in this revision

Viewing changes to tests/auto/qml/qqmlvaluetypes/data/color_compare.qml

  • Committer: Package Import Robot
  • Author(s): Timo Jyrinki
  • Date: 2013-02-05 14:17:19 UTC
  • Revision ID: package-import@ubuntu.com-20130205141719-qqeyml8wslpyez52
Tags: upstream-5.0.1
ImportĀ upstreamĀ versionĀ 5.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import Test 1.0
 
2
 
 
3
MyTypeObject {
 
4
    property real v_r: color.r
 
5
    property real v_g: color.g
 
6
    property real v_b: color.b
 
7
    property real v_a: color.a
 
8
    property variant copy: color
 
9
    property string colorToString: color.toString()
 
10
 
 
11
    // compare different colors
 
12
    property bool colorEqualsIdenticalRgba: (color == Qt.rgba(0.2, 0.88, 0.6, 0.34))  // true
 
13
    property bool colorEqualsDifferentAlpha: (color == Qt.rgba(0.2, 0.88, 0.6, 0.44)) // false
 
14
    property bool colorEqualsDifferentRgba: (color == Qt.rgba(0.3, 0.98, 0.7, 0.44))  // false
 
15
 
 
16
    // compare different color.toString()s
 
17
    property bool colorToStringEqualsColorString: (color.toString() == colorToString)                                     // true
 
18
    property bool colorToStringEqualsDifferentAlphaString: (color.toString() == Qt.rgba(0.2, 0.88, 0.6, 0.44).toString()) // true
 
19
    property bool colorToStringEqualsDifferentRgbaString: (color.toString() == Qt.rgba(0.3, 0.98, 0.7, 0.44).toString())  // false
 
20
 
 
21
    // compare colors to strings
 
22
    property bool colorEqualsColorString: (color == colorToString)                                     // false
 
23
    property bool colorEqualsDifferentAlphaString: (color == Qt.rgba(0.2, 0.88, 0.6, 0.44).toString()) // false
 
24
    property bool colorEqualsDifferentRgbaString: (color == Qt.rgba(0.3, 0.98, 0.7, 0.44).toString())  // false
 
25
 
 
26
    // compare colors to various value types
 
27
    property bool equalsColor: (color == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // true
 
28
    property bool equalsVector3d: (color == Qt.vector3d(1, 2, 3))       // false
 
29
    property bool equalsSize: (color == Qt.size(1912, 1913))            // false
 
30
    property bool equalsPoint: (color == Qt.point(10, 4))               // false
 
31
    property bool equalsRect: (color == Qt.rect(2, 3, 109, 102))        // false
 
32
 
 
33
    // ensure comparison directionality doesn't matter
 
34
    property bool equalsColorRHS: (Qt.rgba(0.2, 0.88, 0.6, 0.34) == color) // true
 
35
    property bool colorEqualsCopy: (color == copy) // true
 
36
    property bool copyEqualsColor: (copy == color) // true
 
37
}