diff options
author | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-05-21 13:30:28 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-05-26 13:29:42 +0000 |
commit | 046eec04fb47dee9a1802503004446d1fe777874 (patch) | |
tree | 9031a5a971fb89e527b68910aa5737ae612e51e8 /tests/auto/declarative_geoshape | |
parent | 9c61ad227761c9f83ea441c6a8db2d570a4009a3 (diff) | |
download | qtlocation-046eec04fb47dee9a1802503004446d1fe777874.tar.gz |
Provide means to convert GeoShape to appropriate subclass in QML
Change-Id: I1f0d1540b07af8f385ef670990a8669ec8c973d8
Reviewed-by: Michal Klocek <michal.klocek@theqtcompany.com>
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'tests/auto/declarative_geoshape')
-rw-r--r-- | tests/auto/declarative_geoshape/tst_locationsingleton.qml | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/auto/declarative_geoshape/tst_locationsingleton.qml b/tests/auto/declarative_geoshape/tst_locationsingleton.qml index 5c080171..f01ee5e2 100644 --- a/tests/auto/declarative_geoshape/tst_locationsingleton.qml +++ b/tests/auto/declarative_geoshape/tst_locationsingleton.qml @@ -153,4 +153,42 @@ Item { compare(data.shape1 != data.shape2, !data.result) } } + + TestCase { + name: "Conversions" + + function test_shape_circle_conversions() { + var circle = QtPositioning.shapeToCircle(QtPositioning.shape()) + verify(!circle.isValid) + circle = QtPositioning.shapeToCircle(QtPositioning.circle()) + verify(!circle.isValid) + circle = QtPositioning.shapeToCircle(QtPositioning.circle(tl, 10000)) + verify(circle.isValid) + compare(circle.center, tl) + compare(circle.radius, 10000) + circle = QtPositioning.shapeToCircle(QtPositioning.rectangle()) + verify(!circle.isValid) + circle = QtPositioning.shapeToCircle(QtPositioning.rectangle(tl, br)) + verify(!circle.isValid) + circle = QtPositioning.shapeToCircle(listBox) + verify(!circle.isValid) + } + + function test_shape_rectangle_conversions() { + var rectangle = QtPositioning.shapeToRectangle(QtPositioning.shape()) + verify(!rectangle.isValid) + rectangle = QtPositioning.shapeToRectangle(QtPositioning.circle()) + verify(!rectangle.isValid) + rectangle = QtPositioning.shapeToRectangle(QtPositioning.circle(tl, 10000)) + verify(!rectangle.isValid) + rectangle = QtPositioning.shapeToRectangle(QtPositioning.rectangle()) + verify(!rectangle.isValid) + rectangle = QtPositioning.shapeToRectangle(QtPositioning.rectangle(tl, br)) + verify(rectangle.isValid) + compare(rectangle.topLeft, tl) + compare(rectangle.bottomRight, br) + rectangle = QtPositioning.shapeToRectangle(listBox) + verify(rectangle.isValid) + } + } } |