diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2011-11-08 17:03:33 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-10 06:46:48 +0100 |
commit | 65a550ecfb9c3ed8adf452c923b2b43d71501aca (patch) | |
tree | c765f9163a9de2ff9d6d99780203a66ceff6e72d /tests/auto/qmlinterface | |
parent | 18e0a28cb0bd9bfc407d9203b72fea0612135109 (diff) | |
download | qtlocation-65a550ecfb9c3ed8adf452c923b2b43d71501aca.tar.gz |
Add support for getting/setting QML location elements from C++.
Change-Id: Ia5b353e7f97f2bc93c988cbfbd8d57784d3e3bbd
Reviewed-by: Alex <alex.blasche@nokia.com>
Diffstat (limited to 'tests/auto/qmlinterface')
-rw-r--r-- | tests/auto/qmlinterface/data/TestAddress.qml | 51 | ||||
-rw-r--r-- | tests/auto/qmlinterface/data/TestBoundingBox.qml | 48 | ||||
-rw-r--r-- | tests/auto/qmlinterface/data/TestBoundingCircle.qml | 47 | ||||
-rw-r--r-- | tests/auto/qmlinterface/data/TestCategory.qml | 47 | ||||
-rw-r--r-- | tests/auto/qmlinterface/data/TestContactDetail.qml | 47 | ||||
-rw-r--r-- | tests/auto/qmlinterface/data/TestCoordinate.qml | 48 | ||||
-rw-r--r-- | tests/auto/qmlinterface/data/TestIcon.qml | 46 | ||||
-rw-r--r-- | tests/auto/qmlinterface/data/TestLocation.qml | 48 | ||||
-rw-r--r-- | tests/auto/qmlinterface/data/TestPlace.qml | 63 | ||||
-rw-r--r-- | tests/auto/qmlinterface/data/TestPlaceAttribute.qml | 47 | ||||
-rw-r--r-- | tests/auto/qmlinterface/data/TestRating.qml | 48 | ||||
-rw-r--r-- | tests/auto/qmlinterface/data/TestSupplier.qml | 49 | ||||
-rw-r--r-- | tests/auto/qmlinterface/data/TestUser.qml | 47 | ||||
-rw-r--r-- | tests/auto/qmlinterface/qmlinterface.pro | 35 | ||||
-rw-r--r-- | tests/auto/qmlinterface/tst_qmlinterface.cpp | 322 |
15 files changed, 993 insertions, 0 deletions
diff --git a/tests/auto/qmlinterface/data/TestAddress.qml b/tests/auto/qmlinterface/data/TestAddress.qml new file mode 100644 index 00000000..518e09b5 --- /dev/null +++ b/tests/auto/qmlinterface/data/TestAddress.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtLocation 5.0 + +Address { + city: "Brisbane" + country: "Australia" + countryCode: "AU" + postcode: "4000" + state: "Queensland" + street: "123 Fake Street" +} diff --git a/tests/auto/qmlinterface/data/TestBoundingBox.qml b/tests/auto/qmlinterface/data/TestBoundingBox.qml new file mode 100644 index 00000000..28aeae3c --- /dev/null +++ b/tests/auto/qmlinterface/data/TestBoundingBox.qml @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtLocation 5.0 + +BoundingBox { + center: TestCoordinate { } + height: 30.0 + width: 40.0 +} diff --git a/tests/auto/qmlinterface/data/TestBoundingCircle.qml b/tests/auto/qmlinterface/data/TestBoundingCircle.qml new file mode 100644 index 00000000..17e89c94 --- /dev/null +++ b/tests/auto/qmlinterface/data/TestBoundingCircle.qml @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtLocation 5.0 + +BoundingCircle { + center: TestCoordinate { } + radius: 30.0 +} diff --git a/tests/auto/qmlinterface/data/TestCategory.qml b/tests/auto/qmlinterface/data/TestCategory.qml new file mode 100644 index 00000000..a89e0020 --- /dev/null +++ b/tests/auto/qmlinterface/data/TestCategory.qml @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtLocation 5.0 + +Category { + name: "Test category" + categoryId: "test-category-id" +} diff --git a/tests/auto/qmlinterface/data/TestContactDetail.qml b/tests/auto/qmlinterface/data/TestContactDetail.qml new file mode 100644 index 00000000..e83cda83 --- /dev/null +++ b/tests/auto/qmlinterface/data/TestContactDetail.qml @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtLocation 5.0 + +ContactDetail { + label: "Test Contact Detail" + value: "Test contact detail value" +} diff --git a/tests/auto/qmlinterface/data/TestCoordinate.qml b/tests/auto/qmlinterface/data/TestCoordinate.qml new file mode 100644 index 00000000..1dfb423e --- /dev/null +++ b/tests/auto/qmlinterface/data/TestCoordinate.qml @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtLocation 5.0 + +Coordinate { + longitude: 10.0 + latitude: 20.0 + altitude: 30.0 +} diff --git a/tests/auto/qmlinterface/data/TestIcon.qml b/tests/auto/qmlinterface/data/TestIcon.qml new file mode 100644 index 00000000..7f11fcd4 --- /dev/null +++ b/tests/auto/qmlinterface/data/TestIcon.qml @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtLocation 5.0 + +Icon { + fullUrl: "http://www.example.com/test-icon.png" +} diff --git a/tests/auto/qmlinterface/data/TestLocation.qml b/tests/auto/qmlinterface/data/TestLocation.qml new file mode 100644 index 00000000..af367cd4 --- /dev/null +++ b/tests/auto/qmlinterface/data/TestLocation.qml @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtLocation 5.0 + +Location { + address: TestAddress { } + boundingBox: TestBoundingBox { } + coordinate: TestCoordinate { } +} diff --git a/tests/auto/qmlinterface/data/TestPlace.qml b/tests/auto/qmlinterface/data/TestPlace.qml new file mode 100644 index 00000000..45ffd129 --- /dev/null +++ b/tests/auto/qmlinterface/data/TestPlace.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtLocation 5.0 + +Place { + name: "Test Place" + placeId: "test-place-id" + attribution: "Place data by Foo" + categories: [ + Category { + name: "Test category 1" + categoryId: "test-category-id-1" + }, + Category { + name: "Test category 2" + categoryId: "test-category-id-2" + } + ] + location: TestLocation { } + rating: TestRating { } + icon: TestIcon { } + supplier: TestSupplier { } + visibility: Place.PrivateVisibility +} diff --git a/tests/auto/qmlinterface/data/TestPlaceAttribute.qml b/tests/auto/qmlinterface/data/TestPlaceAttribute.qml new file mode 100644 index 00000000..f38e4a6c --- /dev/null +++ b/tests/auto/qmlinterface/data/TestPlaceAttribute.qml @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtLocation 5.0 + +PlaceAttribute { + label: "Test Attribute" + text: "Test attribute text" +} diff --git a/tests/auto/qmlinterface/data/TestRating.qml b/tests/auto/qmlinterface/data/TestRating.qml new file mode 100644 index 00000000..5eec05f3 --- /dev/null +++ b/tests/auto/qmlinterface/data/TestRating.qml @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtLocation 5.0 + +Rating { + value: 3.5 + maximum: 5.0 + count: 10 +} diff --git a/tests/auto/qmlinterface/data/TestSupplier.qml b/tests/auto/qmlinterface/data/TestSupplier.qml new file mode 100644 index 00000000..fc5ad78d --- /dev/null +++ b/tests/auto/qmlinterface/data/TestSupplier.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtLocation 5.0 + +Supplier { + name: "Test supplier" + supplierId: "test-supplier-id" + url: "http://www.example.com/test-supplier" + icon: TestIcon { } +} diff --git a/tests/auto/qmlinterface/data/TestUser.qml b/tests/auto/qmlinterface/data/TestUser.qml new file mode 100644 index 00000000..3add0d02 --- /dev/null +++ b/tests/auto/qmlinterface/data/TestUser.qml @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtLocation 5.0 + +User { + name: "Test User" + userId: "test-user-id" +} diff --git a/tests/auto/qmlinterface/qmlinterface.pro b/tests/auto/qmlinterface/qmlinterface.pro new file mode 100644 index 00000000..d462d698 --- /dev/null +++ b/tests/auto/qmlinterface/qmlinterface.pro @@ -0,0 +1,35 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2011-11-09T15:45:51 +# +#------------------------------------------------- + +QT += location declarative testlib + +#QT -= gui + +TARGET = tst_qmlinterface +CONFIG += console +CONFIG -= app_bundle + +TEMPLATE = app + + +SOURCES += tst_qmlinterface.cpp +DEFINES += SRCDIR=\\\"$$PWD/\\\" + +OTHER_FILES += \ + data/TestCategory.qml \ + data/TestCoordinate.qml \ + data/TestAddress.qml \ + data/TestBoundingBox.qml \ + data/TestBoundingCircle.qml \ + data/TestLocation.qml \ + data/TestPlace.qml \ + data/TestIcon.qml \ + data/TestRating.qml \ + data/TestSupplier.qml \ + data/TestUser.qml \ + data/TestPlaceAttribute.qml \ + data/TestContactDetail.qml + diff --git a/tests/auto/qmlinterface/tst_qmlinterface.cpp b/tests/auto/qmlinterface/tst_qmlinterface.cpp new file mode 100644 index 00000000..d2637e3b --- /dev/null +++ b/tests/auto/qmlinterface/tst_qmlinterface.cpp @@ -0,0 +1,322 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtTest/QtTest> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtLocation/QGeoCoordinate> +#include <QtLocation/QGeoAddress> +#include <QtLocation/QGeoBoundingBox> +#include <QtLocation/QGeoBoundingCircle> +#include <QtLocation/QGeoLocation> +#include <QtLocation/QPlaceCategory> +#include <QtLocation/QPlace> +#include <QtLocation/QPlaceIcon> +#include <QtLocation/QPlaceRating> +#include <QtLocation/QPlaceSupplier> +#include <QtLocation/QPlaceUser> +#include <QtLocation/QPlaceAttribute> +#include <QtLocation/QPlaceContactDetail> + +class tst_qmlinterface : public QObject +{ + Q_OBJECT + +public: + tst_qmlinterface(); + +private Q_SLOTS: + void testCoordinate(); + void testAddress(); + void testBoundingBox(); + void testBoundingCircle(); + void testLocation(); + void testCategory(); + void testIcon(); + void testRating(); + void testSupplier(); + void testUser(); + void testPlaceAttribute(); + void testContactDetail(); + void testPlace(); + +private: + QGeoCoordinate m_coordinate; + QGeoAddress m_address; + QGeoBoundingBox m_boundingBox; + QGeoBoundingCircle m_boundingCircle; + QGeoLocation m_location; + QPlaceCategory m_category; + QPlaceIcon m_icon; + QPlaceRating m_rating; + QPlaceSupplier m_supplier; + QPlaceUser m_user; + QPlaceAttribute m_placeAttribute; + QPlaceContactDetail m_contactDetail; + QList<QPlaceCategory> m_categories; + QPlace m_place; +}; + +tst_qmlinterface::tst_qmlinterface() +{ + m_coordinate.setLongitude(10.0); + m_coordinate.setLatitude(20.0); + m_coordinate.setAltitude(30.0); + + m_address.setCity(QLatin1String("Brisbane")); + m_address.setCountry(QLatin1String("Australia")); + m_address.setCountryCode(QLatin1String("AU")); + m_address.setPostcode(QLatin1String("4000")); + m_address.setState(QLatin1String("Queensland")); + m_address.setStreet(QLatin1String("123 Fake Street")); + + m_boundingBox.setCenter(m_coordinate); + m_boundingBox.setHeight(30.0); + m_boundingBox.setWidth(40.0); + + m_boundingCircle.setCenter(m_coordinate); + m_boundingCircle.setRadius(30.0); + + m_location.setAddress(m_address); + m_location.setBoundingBox(m_boundingBox); + m_location.setCoordinate(m_coordinate); + + m_category.setName(QLatin1String("Test category")); + m_category.setCategoryId(QLatin1String("test-category-id")); + + m_icon.setFullUrl(QUrl(QLatin1String("http://www.example.com/test-icon.png"))); + + m_rating.setValue(3.5); + m_rating.setMaximum(5.0); + m_rating.setCount(10); + + m_supplier.setName(QLatin1String("Test supplier")); + m_supplier.setUrl(QUrl(QLatin1String("http://www.example.com/test-supplier"))); + m_supplier.setSupplierId(QLatin1String("test-supplier-id")); + m_supplier.setIcon(m_icon); + + m_user.setName(QLatin1String("Test User")); + m_user.setUserId(QLatin1String("test-user-id")); + + m_placeAttribute.setLabel(QLatin1String("Test Attribute")); + m_placeAttribute.setText(QLatin1String("Test attribute text")); + + m_contactDetail.setLabel(QLatin1String("Test Contact Detail")); + m_contactDetail.setValue(QLatin1String("Test contact detail value")); + + QPlaceCategory category; + category.setName(QLatin1String("Test category 1")); + category.setCategoryId(QLatin1String("test-category-id-1")); + m_categories.append(category); + category.setName(QLatin1String("Test category 2")); + category.setCategoryId(QLatin1String("test-category-id-2")); + m_categories.append(category); + + m_place.setName(QLatin1String("Test Place")); + m_place.setPlaceId(QLatin1String("test-place-id")); + m_place.setAttribution(QLatin1String("Place data by Foo")); + m_place.setCategories(m_categories); + m_place.setLocation(m_location); + m_place.setRating(m_rating); + m_place.setIcon(m_icon); + m_place.setSupplier(m_supplier); + m_place.setVisibility(QtLocation::PrivateVisibility); +} + +void tst_qmlinterface::testCoordinate() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, SRCDIR "data/TestCoordinate.qml"); + QVERIFY(component.isReady()); + QObject *qmlObject = component.create(); + + QGeoCoordinate coordinate = qmlObject->property("coordinate").value<QGeoCoordinate>(); + + QCOMPARE(coordinate, m_coordinate); +} + +void tst_qmlinterface::testAddress() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, SRCDIR "data/TestAddress.qml"); + QVERIFY(component.isReady()); + QObject *qmlObject = component.create(); + + QGeoAddress address = qmlObject->property("address").value<QGeoAddress>(); + + QCOMPARE(address, m_address); +} + +void tst_qmlinterface::testBoundingBox() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, SRCDIR "data/TestBoundingBox.qml"); + QVERIFY(component.isReady()); + QObject *qmlObject = component.create(); + + QGeoBoundingBox boundingBox = qmlObject->property("box").value<QGeoBoundingBox>(); + + QCOMPARE(boundingBox, m_boundingBox); +} + +void tst_qmlinterface::testBoundingCircle() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, SRCDIR "data/TestBoundingCircle.qml"); + QVERIFY(component.isReady()); + QObject *qmlObject = component.create(); + + QGeoBoundingCircle boundingCircle = qmlObject->property("circle").value<QGeoBoundingCircle>(); + + QCOMPARE(boundingCircle, m_boundingCircle); +} + +void tst_qmlinterface::testLocation() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, SRCDIR "data/TestLocation.qml"); + QVERIFY(component.isReady()); + QObject *qmlObject = component.create(); + + QGeoLocation location = qmlObject->property("location").value<QGeoLocation>(); + + QCOMPARE(location, m_location); +} + +void tst_qmlinterface::testCategory() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, SRCDIR "data/TestCategory.qml"); + QVERIFY(component.isReady()); + QObject *qmlObject = component.create(); + + QPlaceCategory category = qmlObject->property("category").value<QPlaceCategory>(); + + QCOMPARE(category, m_category); +} + +void tst_qmlinterface::testIcon() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, SRCDIR "data/TestIcon.qml"); + QVERIFY(component.isReady()); + QObject *qmlObject = component.create(); + + QPlaceIcon icon = qmlObject->property("icon").value<QPlaceIcon>(); + + QCOMPARE(icon, m_icon); +} + +void tst_qmlinterface::testRating() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, SRCDIR "data/TestRating.qml"); + QVERIFY(component.isReady()); + QObject *qmlObject = component.create(); + + QPlaceRating rating = qmlObject->property("rating").value<QPlaceRating>(); + + QCOMPARE(rating, m_rating); +} + +void tst_qmlinterface::testSupplier() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, SRCDIR "data/TestSupplier.qml"); + QVERIFY(component.isReady()); + QObject *qmlObject = component.create(); + + QPlaceSupplier supplier = qmlObject->property("supplier").value<QPlaceSupplier>(); + + QCOMPARE(supplier, m_supplier); +} + +void tst_qmlinterface::testUser() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, SRCDIR "data/TestUser.qml"); + QVERIFY(component.isReady()); + QObject *qmlObject = component.create(); + + QPlaceUser user = qmlObject->property("user").value<QPlaceUser>(); + + QCOMPARE(user, m_user); +} + +void tst_qmlinterface::testPlaceAttribute() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, SRCDIR "data/TestPlaceAttribute.qml"); + QVERIFY(component.isReady()); + QObject *qmlObject = component.create(); + + QPlaceAttribute placeAttribute = qmlObject->property("attribute").value<QPlaceAttribute>(); + + QCOMPARE(placeAttribute, m_placeAttribute); +} + +void tst_qmlinterface::testContactDetail() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, SRCDIR "data/TestContactDetail.qml"); + QVERIFY(component.isReady()); + QObject *qmlObject = component.create(); + + QPlaceContactDetail contactDetail = qmlObject->property("contactDetail").value<QPlaceContactDetail>(); + + QCOMPARE(contactDetail, m_contactDetail); +} + +void tst_qmlinterface::testPlace() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, SRCDIR "data/TestPlace.qml"); + QVERIFY(component.isReady()); + QObject *qmlObject = component.create(); + + QPlace place = qmlObject->property("place").value<QPlace>(); + + QCOMPARE(place, m_place); +} + +QTEST_MAIN(tst_qmlinterface) + +#include "tst_qmlinterface.moc" |