diff options
Diffstat (limited to 'tests/auto/qmltest')
41 files changed, 178 insertions, 68 deletions
diff --git a/tests/auto/qmltest/BLACKLIST b/tests/auto/qmltest/BLACKLIST deleted file mode 100644 index 9b39f87219..0000000000 --- a/tests/auto/qmltest/BLACKLIST +++ /dev/null @@ -1,16 +0,0 @@ -# Blacklist for testing -[SelfTests::test_blacklisted_fail] -* -[SelfTests::test_blacklistWithData:test2] -* -[shadersource-dynamic-sourceobject::test_endresult] -linux -[tst_grabImage::test_equals] -linux -[ListView::test_listInteractiveCurrentIndexEnforce] -linux -osx-10.12 -[TextEdit::test_textentry] -osx-10.12 -[TextEdit::test_textentry_char] -osx-10.12 diff --git a/tests/auto/qmltest/animatedimage/animatedimage.pro b/tests/auto/qmltest/animatedimage/animatedimage.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/animatedimage/animatedimage.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/animations/animations.pro b/tests/auto/qmltest/animations/animations.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/animations/animations.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/borderimage/borderimage.pro b/tests/auto/qmltest/borderimage/borderimage.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/borderimage/borderimage.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/buttonclick/buttonclick.pro b/tests/auto/qmltest/buttonclick/buttonclick.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/buttonclick/buttonclick.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/createbenchmark/createbenchmark.pro b/tests/auto/qmltest/createbenchmark/createbenchmark.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/createbenchmark/createbenchmark.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/events/events.pro b/tests/auto/qmltest/events/events.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/events/events.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/events/tst_touch.qml b/tests/auto/qmltest/events/tst_touch.qml index 5b209a6d0b..b7fa701429 100644 --- a/tests/auto/qmltest/events/tst_touch.qml +++ b/tests/auto/qmltest/events/tst_touch.qml @@ -35,6 +35,16 @@ MultiPointTouchArea { width: 100 height: 100 + // touchUpdatedSpy stores the QQuickTouchPoint, and in some cases + // MultiPointTouchArea can delete it out from under us. + // (test_simpleChain was failing because touchUpdatedSpy.signalArguments[0][0][0] + // ended up as an empty object somehow.) If we declare + // all the touchpoints that this test will use, that won't happen. + touchPoints: [ + TouchPoint { }, + TouchPoint { } + ] + SignalSpy { id: touchUpdatedSpy target: touchArea @@ -173,10 +183,10 @@ MultiPointTouchArea { function test_simpleChain() { var first = 1; - touchEvent(touchArea).press(first).commit().release(first).commit(); - compare(touchUpdatedSpy.count, 2); - var touchPoint = touchUpdatedSpy.signalArguments[0][0][0]; - verify(comparePoint(touchPoint, first, touchArea.width / 2, touchArea.height / 2)); + touchEvent(interior).press(first).commit().release(first).commit(); + compare(interiorSpy.count, 2); + var touchPoint = interiorSpy.signalArguments[0][0][0]; + verify(comparePoint(touchPoint, first, interior.width / 2, interior.height / 2)); } } } diff --git a/tests/auto/qmltest/fontloader/fontloader.pro b/tests/auto/qmltest/fontloader/fontloader.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/fontloader/fontloader.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/gradient/gradient.pro b/tests/auto/qmltest/gradient/gradient.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/gradient/gradient.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/image/image.pro b/tests/auto/qmltest/image/image.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/image/image.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/image/logo.pkm b/tests/auto/qmltest/image/logo.pkm Binary files differnew file mode 100644 index 0000000000..c0987c5c36 --- /dev/null +++ b/tests/auto/qmltest/image/logo.pkm diff --git a/tests/auto/qmltest/image/tst_image.qml b/tests/auto/qmltest/image/tst_image.qml index 1c36e2a7c3..6385db7fbb 100644 --- a/tests/auto/qmltest/image/tst_image.qml +++ b/tests/auto/qmltest/image/tst_image.qml @@ -122,6 +122,11 @@ Item { fillMode: Image.TileHorizontally } + Image { + id: pkmImage + source: "logo.pkm" + } + TestCase { name: "Image" @@ -222,5 +227,9 @@ Item { compare(tileModes3.fillMode, Image.TileHorizontally) } + function test_pkmImage() { + compare(pkmImage.width, 256) + compare(pkmImage.height, 256) + } } } diff --git a/tests/auto/qmltest/itemgrabber/itemgrabber.pro b/tests/auto/qmltest/itemgrabber/itemgrabber.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/itemgrabber/itemgrabber.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/itemgrabber/tst_itemgrabber.qml b/tests/auto/qmltest/itemgrabber/tst_itemgrabber.qml index a80814d6de..53ed3658c2 100644 --- a/tests/auto/qmltest/itemgrabber/tst_itemgrabber.qml +++ b/tests/auto/qmltest/itemgrabber/tst_itemgrabber.qml @@ -135,7 +135,7 @@ Item { property int callCount: 0; property bool ready: false; function handleGrab(result) { - if (!result.saveToFile("itemgrabber/image.png")) + if (!result.saveToFile("image.png")) print("Error: Failed to save image to disk..."); source = "image.png"; ready = true; @@ -149,7 +149,7 @@ Item { y: 0 property bool ready: false; function handleGrab(result) { - if (!result.saveToFile("itemgrabber/image_small.png")) + if (!result.saveToFile("image_small.png")) print("Error: Failed to save image to disk..."); source = "image_small.png"; ready = true; diff --git a/tests/auto/qmltest/layout/layout.pro b/tests/auto/qmltest/layout/layout.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/layout/layout.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/listmodel/listmodel.pro b/tests/auto/qmltest/listmodel/listmodel.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/listmodel/listmodel.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/listview/BLACKLIST b/tests/auto/qmltest/listview/BLACKLIST new file mode 100644 index 0000000000..62bf89128d --- /dev/null +++ b/tests/auto/qmltest/listview/BLACKLIST @@ -0,0 +1,3 @@ +# Blacklist for testing +[ListView::test_listInteractiveCurrentIndexEnforce] +* diff --git a/tests/auto/qmltest/listview/listview.pro b/tests/auto/qmltest/listview/listview.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/listview/listview.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/objectmodel/objectmodel.pro b/tests/auto/qmltest/objectmodel/objectmodel.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/objectmodel/objectmodel.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/pathview/pathview.pro b/tests/auto/qmltest/pathview/pathview.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/pathview/pathview.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/pixel/pixel.pro b/tests/auto/qmltest/pixel/pixel.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/pixel/pixel.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/positioners/positioners.pro b/tests/auto/qmltest/positioners/positioners.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/positioners/positioners.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/qmltest.pro b/tests/auto/qmltest/qmltest.pro index 52fd6bf9de..8ad1541cbc 100644 --- a/tests/auto/qmltest/qmltest.pro +++ b/tests/auto/qmltest/qmltest.pro @@ -1,14 +1,30 @@ -TEMPLATE=app -TARGET=tst_qmltest -CONFIG += qmltestcase -CONFIG += console -SOURCES += tst_qmltest.cpp - - -importFiles.files = borderimage buttonclick createbenchmark events qqmlbinding selftests - -importFiles.path = . -DEPLOYMENT += importFiles - -# Please do not make this test insignificant again, thanks. -# Just skip those unstable ones. See also QTBUG-33723. +TEMPLATE = subdirs +SUBDIRS += \ + animatedimage \ + animations \ + borderimage \ + buttonclick \ + createbenchmark \ + events \ + fontloader \ + gradient \ + image \ + itemgrabber \ + layout \ + listmodel \ + listview \ + objectmodel \ + pathview \ + pixel \ + positioners \ + qqmlbinding \ + qtbug46798 \ + rectangle \ + selftests \ + shadersource \ + stability \ + statemachine \ + text \ + textedit \ + textinput \ + window diff --git a/tests/auto/qmltest/qqmlbinding/qqmlbinding.pro b/tests/auto/qmltest/qqmlbinding/qqmlbinding.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/qqmlbinding/qqmlbinding.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/qtbug46798/qtbug46798.pro b/tests/auto/qmltest/qtbug46798/qtbug46798.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/qtbug46798/qtbug46798.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/rectangle/rectangle.pro b/tests/auto/qmltest/rectangle/rectangle.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/rectangle/rectangle.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/selftests/BLACKLIST b/tests/auto/qmltest/selftests/BLACKLIST new file mode 100644 index 0000000000..ffce42e4c0 --- /dev/null +++ b/tests/auto/qmltest/selftests/BLACKLIST @@ -0,0 +1,13 @@ +# Blacklist for testing +[SelfTests::test_blacklisted_fail] +* +[SelfTests::test_blacklistWithData:test2] +* +# 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/selftests.pro b/tests/auto/qmltest/selftests/selftests.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/selftests/selftests.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/selftests/tst_grabImage.qml b/tests/auto/qmltest/selftests/tst_grabImage.qml index 1748030f14..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/ ** @@ -35,7 +36,7 @@ TestCase { when: windowShown function test_equals() { - var rect = Qt.createQmlObject("import QtQuick 2.0; Rectangle { color: 'red'; width: 10; height: 10; }", testCase); + var rect = createTemporaryQmlObject("import QtQuick 2.0; Rectangle { color: 'red'; width: 10; height: 10; }", testCase); verify(rect); var oldImage = grabImage(rect); rect.width += 10; @@ -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/selftests/tst_selftests.qml b/tests/auto/qmltest/selftests/tst_selftests.qml index 439ea7a70d..5555876014 100644 --- a/tests/auto/qmltest/selftests/tst_selftests.qml +++ b/tests/auto/qmltest/selftests/tst_selftests.qml @@ -167,6 +167,16 @@ TestCase { caught = true } verify(caught) + + caught = false; + try { + testCase.verify(true, "foo", "bar") + } catch (e) { + compare(e.message, "QtQuickTest::fail") + compare(functions.failmsg, "More than two arguments given to verify(). Did you mean tryVerify() or tryCompare()?") + caught = true + } + verify(caught) } function test_compare() { diff --git a/tests/auto/qmltest/shadersource/BLACKLIST b/tests/auto/qmltest/shadersource/BLACKLIST new file mode 100644 index 0000000000..cc1e110153 --- /dev/null +++ b/tests/auto/qmltest/shadersource/BLACKLIST @@ -0,0 +1,3 @@ +# Blacklist for testing +[shadersource-dynamic-sourceobject::test_endresult] +linux diff --git a/tests/auto/qmltest/shadersource/shadersource.pro b/tests/auto/qmltest/shadersource/shadersource.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/shadersource/shadersource.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/stability/stability.pro b/tests/auto/qmltest/stability/stability.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/stability/stability.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/statemachine/statemachine.pro b/tests/auto/qmltest/statemachine/statemachine.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/statemachine/statemachine.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/text/text.pro b/tests/auto/qmltest/text/text.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/text/text.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/textedit/BLACKLIST b/tests/auto/qmltest/textedit/BLACKLIST new file mode 100644 index 0000000000..e06cba3e8f --- /dev/null +++ b/tests/auto/qmltest/textedit/BLACKLIST @@ -0,0 +1,6 @@ +# Blacklist for testing +[TextEdit::test_textentry] +osx-10.12 +[TextEdit::test_textentry_char] +osx-10.12 + diff --git a/tests/auto/qmltest/textedit/textedit.pro b/tests/auto/qmltest/textedit/textedit.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/textedit/textedit.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/textinput/textinput.pro b/tests/auto/qmltest/textinput/textinput.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/textinput/textinput.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase diff --git a/tests/auto/qmltest/tst_qmltest.cpp b/tests/auto/qmltest/tst_qmltest.cpp deleted file mode 100644 index 3387ce8ee9..0000000000 --- a/tests/auto/qmltest/tst_qmltest.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** 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$ -** -****************************************************************************/ - -#include <QtQuickTest/quicktest.h> -QUICK_TEST_MAIN(qmltest)
\ No newline at end of file diff --git a/tests/auto/qmltest/window/window.pro b/tests/auto/qmltest/window/window.pro new file mode 100644 index 0000000000..a7938e7003 --- /dev/null +++ b/tests/auto/qmltest/window/window.pro @@ -0,0 +1 @@ +CONFIG += qmltestcase |