aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qmltest
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@qt.io>2017-06-26 18:38:27 +0200
committerJan Arve Saether <jan-arve.saether@qt.io>2017-07-11 16:44:33 +0200
commitb6e6e737f1a4a7e48989a6a036e25c238304802f (patch)
tree8d4b5940b92ad1fc94e46c1742acd9355e19e1d4 /tests/auto/qmltest
parentd5b3f5da9cfa90fc43f29f3bdeec01884a47d6ca (diff)
parent4beee1a6dcc1be57aa6fb2a175dadc6ff298545d (diff)
Merge remote-tracking branch 'origin/dev' into wip/pointerhandler
Conflicts: examples/quick/shared/LauncherList.qml src/quick/items/qquickevents.cpp src/quick/items/qquickevents_p_p.h src/quick/items/qquickwindow.cpp tests/auto/quick/touchmouse/tst_touchmouse.cpp Change-Id: Id692d291455093fc72db61f1b854f3fc9190267b
Diffstat (limited to 'tests/auto/qmltest')
-rw-r--r--tests/auto/qmltest/selftests/BLACKLIST5
-rw-r--r--tests/auto/qmltest/selftests/tst_grabImage.qml60
-rw-r--r--tests/auto/qmltest/statemachine/tst_signaltransition.qml29
-rw-r--r--tests/auto/qmltest/statemachine/tst_triggeredArguments1.qml29
-rw-r--r--tests/auto/qmltest/statemachine/tst_triggeredArguments2.qml29
-rw-r--r--tests/auto/qmltest/url/tst_url.qml62
6 files changed, 162 insertions, 52 deletions
diff --git a/tests/auto/qmltest/selftests/BLACKLIST b/tests/auto/qmltest/selftests/BLACKLIST
index 9cb2313810..ffce42e4c0 100644
--- a/tests/auto/qmltest/selftests/BLACKLIST
+++ b/tests/auto/qmltest/selftests/BLACKLIST
@@ -6,3 +6,8 @@
# QTBUG-53793: seems to be failing on Linux a little too often...
[tst_grabImage::test_equals]
linux
+[tst_grabImage::test_sizeProps]
+linux
+[tst_grabImage::test_save]
+linux
+
diff --git a/tests/auto/qmltest/selftests/tst_grabImage.qml b/tests/auto/qmltest/selftests/tst_grabImage.qml
index 954daaba42..7ce7e93a07 100644
--- a/tests/auto/qmltest/selftests/tst_grabImage.qml
+++ b/tests/auto/qmltest/selftests/tst_grabImage.qml
@@ -1,5 +1,6 @@
/****************************************************************************
**
+** Copyright (C) 2017 Crimson AS <info@crimson.no>
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
@@ -45,9 +46,66 @@ TestCase {
oldImage = grabImage(rect);
// Don't change anything...
newImage = grabImage(rect);
- verify(newImage.equals(oldImage));
+ try {
+ compare(newImage.size, oldImage.size);
+ verify(newImage.equals(oldImage));
+ } catch (ex) {
+ oldImage.save("tst_grabImage_test_equals_oldImage.png")
+ newImage.save("tst_grabImage_test_equals_newImage.png")
+ throw ex;
+ }
verify(!newImage.equals(null));
verify(!newImage.equals(undefined));
}
+
+ function test_sizeProps() {
+ var rect = createTemporaryQmlObject("import QtQuick 2.0; Rectangle { color: 'red'; width: 10; height: 20; }", testCase);
+ var image = grabImage(rect);
+
+ try {
+ compare(image.width, 10)
+ compare(image.height, 20)
+ compare(image.size, Qt.size(10, 20))
+ } catch (ex) {
+ image.save("tst_grabImage_test_sizeProps.png")
+ throw ex;
+ }
+ }
+
+ function test_save() {
+ var rect = createTemporaryQmlObject("import QtQuick 2.0; Rectangle { color: 'red'; width: 10; height: 20; }", testCase);
+ var grabbedImage = grabImage(rect);
+ grabbedImage.save("tst_grabImage_test_save.png")
+
+ // Now try to load it
+ var url = Qt.resolvedUrl("tst_grabImage_test_save.png")
+ var image = createTemporaryQmlObject("import QtQuick 2.0; Image { source: \"" + url + "\" }", testCase);
+ tryCompare(image, "status", Image.Ready)
+ var grabbedImage2 = grabImage(image);
+
+ try {
+ verify(grabbedImage2.equals(grabbedImage))
+ } catch (ex) {
+ grabbedImage2.save("tst_grabImage_test_save2.png")
+ throw ex;
+ }
+ }
+
+ function test_saveThrowsWhenFailing() {
+ var rect = createTemporaryQmlObject("import QtQuick 2.0; Rectangle { color: 'red'; width: 10; height: 20; }", testCase);
+ var grabbedImage = grabImage(rect);
+ var didThrow = false;
+
+ try {
+ // Format doesn't exist, so this will throw
+ grabbedImage.save("tst_grabImage_test_saveThrowsWhenFailing.never-gonna-give-you-up");
+ } catch (ex) {
+ didThrow = true;
+ }
+
+ if (!didThrow) {
+ fail("save() should have thrown, but didn't!")
+ }
+ }
}
diff --git a/tests/auto/qmltest/statemachine/tst_signaltransition.qml b/tests/auto/qmltest/statemachine/tst_signaltransition.qml
index 0e35207670..a57826855a 100644
--- a/tests/auto/qmltest/statemachine/tst_signaltransition.qml
+++ b/tests/auto/qmltest/statemachine/tst_signaltransition.qml
@@ -1,32 +1,27 @@
/****************************************************************************
**
-** Copyright (C) 2014 Ford Motor Company
-** Copyright (C) 2016 The Qt Company
+** Copyright (C) 2017 Ford Motor Company
+** Copyright (C) 2017 The Qt Company
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company 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 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/auto/qmltest/statemachine/tst_triggeredArguments1.qml b/tests/auto/qmltest/statemachine/tst_triggeredArguments1.qml
index 5d2e867da4..34c172aded 100644
--- a/tests/auto/qmltest/statemachine/tst_triggeredArguments1.qml
+++ b/tests/auto/qmltest/statemachine/tst_triggeredArguments1.qml
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2016 Ford Motor Company
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 Ford Motor Company
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company 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 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/auto/qmltest/statemachine/tst_triggeredArguments2.qml b/tests/auto/qmltest/statemachine/tst_triggeredArguments2.qml
index f60f2ff78c..73bc653404 100644
--- a/tests/auto/qmltest/statemachine/tst_triggeredArguments2.qml
+++ b/tests/auto/qmltest/statemachine/tst_triggeredArguments2.qml
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2016 Ford Motor Company
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 Ford Motor Company
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company 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 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/auto/qmltest/url/tst_url.qml b/tests/auto/qmltest/url/tst_url.qml
new file mode 100644
index 0000000000..ff41bd5070
--- /dev/null
+++ b/tests/auto/qmltest/url/tst_url.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtTest 1.1
+
+Item {
+ TestCase {
+ name: "URL"
+ property url path1: "path1"
+ property url path2: "path2"
+
+ function test_url_compare() {
+ expectFail("", "compare() should fail here; if it passes we have QTBUG-61297")
+ compare(path1, path2)
+ }
+ function test_url_compare_string() {
+ expectFail("", "compare() should fail here")
+ compare(path1.toString(), path2.toString())
+ }
+ function test_url_verify() {
+ verify(path1 != path2)
+ }
+ }
+}