diff options
author | Aaron McCarthy <aaron.mccarthy@jollamobile.com> | 2014-02-10 11:22:26 +1000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-11 10:32:44 +0100 |
commit | 2ba9fd5550eb7766c20b3a61679e88ec4a6c8a54 (patch) | |
tree | 6eb0991074302f8d023944c4b4bffb05e9a72591 /tests/auto/declarative_core/tst_geoshape.qml | |
parent | 63c8b3bca03586994c2b59c262e9cb3a9b12b363 (diff) |
Add QML test for comparing QtPositioning base types.old/5.2
Tests added for comparing Coordinate, Shape, Rectangle and Circle.
Task-number: QTBUG-33561
Change-Id: Ie826f670e75b26ac43ad7cea7c9b108b01008f3d
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'tests/auto/declarative_core/tst_geoshape.qml')
-rw-r--r-- | tests/auto/declarative_core/tst_geoshape.qml | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/declarative_core/tst_geoshape.qml b/tests/auto/declarative_core/tst_geoshape.qml index 72dd788b..fcc2b07c 100644 --- a/tests/auto/declarative_core/tst_geoshape.qml +++ b/tests/auto/declarative_core/tst_geoshape.qml @@ -108,4 +108,31 @@ Item { compare (box.contains(outside), true) } } + + TestCase { + name: "Shape" + + function test_shape_comparison_data() { + return [ + { tag: "invalid shape", shape1: QtPositioning.shape(), shape2: QtPositioning.shape(), result: true }, + { tag: "box equal", shape1: box, shape2: QtPositioning.rectangle(tl, br), result: true }, + { tag: "box not equal", shape1: box, shape2: QtPositioning.rectangle([inside, outside]), result: false }, + { tag: "box invalid shape", rect1: box, shape2: QtPositioning.shape(), result: false }, + { tag: "invalid rectangle", shape1: QtPositioning.rectangle(), shape2: QtPositioning.rectangle(), result: true }, + { tag: "invalid rectangle2", shape1: QtPositioning.rectangle(), shape2: QtPositioning.shape(), result: false }, + { tag: "circle1 equal", shape1: circle1, shape2: QtPositioning.circle(coordinate1, 200000), result: true }, + { tag: "circle1 not equal", shape1: circle1, shape2: QtPositioning.circle(coordinate2, 2000), result: false }, + { tag: "circle1 invalid shape", shape1: circle1, shape2: QtPositioning.shape(), result: false }, + { tag: "invalid circle", shape1: QtPositioning.circle(), shape2: QtPositioning.circle(), result: true }, + { tag: "invalid circle2", shape1: QtPositioning.circle(), shape2: QtPositioning.shape(), result: false } + ] + } + + function test_shape_comparison(data) { + compare(data.shape1 === data.shape2, data.result) + compare(data.shape1 !== data.shape2, !data.result) + compare(data.shape1 == data.shape2, data.result) + compare(data.shape1 != data.shape2, !data.result) + } + } } |