summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-09-17 23:08:00 +0200
committerLiang Qi <liang.qi@qt.io>2016-09-18 22:11:24 +0200
commitd9aae9ff99d20b58487b0a48801864d13115363b (patch)
treee98089900164f7a1008e6fb59d1815dc9eab8d2c /tests
parent49bd4b76d08ec11d08105ca71e8dda4f8d459b5c (diff)
parentc2356328f88b044c8956fe7860c4c04fca4f2c30 (diff)
downloadqtquickcontrols-d9aae9ff99d20b58487b0a48801864d13115363b.tar.gz
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: src/controls/Private/qquickrangemodel.cpp src/controls/Private/qquickrangemodel_p.h src/controls/Private/qquickrangemodel_p_p.h src/layouts/qquicklayout.cpp tests/auto/controls/data/tst_rangemodel.qml Change-Id: I9c8f6326c6edf9ebb18dd538f76830e1b439ba8e
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/layout/Container.qml55
-rw-r--r--tests/auto/controls/data/layout/ContainerUser.qml53
-rw-r--r--tests/auto/controls/data/rangemodel/init.qml56
-rw-r--r--tests/auto/controls/data/tst_layout.qml11
-rw-r--r--tests/auto/controls/data/tst_rangemodel.qml8
-rw-r--r--tests/auto/controls/data/tst_scrollview.qml2
-rw-r--r--tests/auto/controls/data/tst_slider.qml40
7 files changed, 222 insertions, 3 deletions
diff --git a/tests/auto/controls/data/layout/Container.qml b/tests/auto/controls/data/layout/Container.qml
new file mode 100644
index 00000000..db3d68c4
--- /dev/null
+++ b/tests/auto/controls/data/layout/Container.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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.5
+import QtQuick.Layouts 1.2
+
+Item {
+ objectName: "qtbug51927-window"
+ visible: true
+
+ default property alias _contents: customContent.data
+
+ ColumnLayout {
+ id: customContent
+ objectName: "qtbug51927-columnLayout"
+ anchors.fill: parent
+ }
+}
diff --git a/tests/auto/controls/data/layout/ContainerUser.qml b/tests/auto/controls/data/layout/ContainerUser.qml
new file mode 100644
index 00000000..ff7ce622
--- /dev/null
+++ b/tests/auto/controls/data/layout/ContainerUser.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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.6
+import QtQuick.Window 2.2
+
+Container {
+ visible: true
+
+ Text {
+ objectName: "qtbug51927-text"
+ text: qsTr("Hello World")
+ anchors.centerIn: parent
+ renderType: Text.QtRendering
+ }
+}
diff --git a/tests/auto/controls/data/rangemodel/init.qml b/tests/auto/controls/data/rangemodel/init.qml
new file mode 100644
index 00000000..9d050143
--- /dev/null
+++ b/tests/auto/controls/data/rangemodel/init.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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 QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtTest 1.0
+
+RangeModel {
+ id: rangemodel
+ positionAtMinimum: 0
+ positionAtMaximum: 100
+ stepSize: 1
+
+ property QtObject spy: SignalSpy {
+ target: rangemodel
+ signalName: "valueChanged"
+ }
+}
diff --git a/tests/auto/controls/data/tst_layout.qml b/tests/auto/controls/data/tst_layout.qml
index f2a69047..e5ac7728 100644
--- a/tests/auto/controls/data/tst_layout.qml
+++ b/tests/auto/controls/data/tst_layout.qml
@@ -63,5 +63,16 @@ TestCase {
var object = Qt.createQmlObject('import QtQuick 2.2; import QtQuick.Layouts 1.0; QtObject { Layout.fillWidth: true }', testCase, '');
object.destroy()
}
+
+ function test_defaultPropertyAliasCrash() {
+ var containerUserComponent = Qt.createComponent("layout/ContainerUser.qml");
+ compare(containerUserComponent.status, Component.Ready);
+
+ var containerUser = containerUserComponent.createObject(testCase);
+ verify(containerUser);
+
+ // Shouldn't crash.
+ containerUser.destroy();
+ }
}
diff --git a/tests/auto/controls/data/tst_rangemodel.qml b/tests/auto/controls/data/tst_rangemodel.qml
index f489e4b5..fd0a8dbe 100644
--- a/tests/auto/controls/data/tst_rangemodel.qml
+++ b/tests/auto/controls/data/tst_rangemodel.qml
@@ -78,6 +78,14 @@ TestCase {
spy.clear()
}
+ function test_delayedinit() {
+ var component = Qt.createComponent("rangemodel/init.qml");
+ compare(component.status, Component.Ready)
+ var r = component.createObject(testCase, {minimumValue: 40, maximumValue: 90, value: 80});
+ compare(r.value, 80)
+ compare(r.spy.count, 1)
+ }
+
function test_setminimumvalue() {
spy.signalName = "minimumChanged"
compare(spy.count, 0)
diff --git a/tests/auto/controls/data/tst_scrollview.qml b/tests/auto/controls/data/tst_scrollview.qml
index 07d6525e..842fd6dc 100644
--- a/tests/auto/controls/data/tst_scrollview.qml
+++ b/tests/auto/controls/data/tst_scrollview.qml
@@ -143,7 +143,7 @@ TestCase {
var scrollView = dragFetchAppendComponent.createObject(container)
verify(scrollView !== null, "view created is null")
waitForRendering(scrollView)
- verify(scrollView.flickableItem.contentHeight === 60 * 20)
+ tryCompare(scrollView.flickableItem, "contentHeight", 60 * 20)
// After scrolling to the end, view should ask the model to fetch more
// data, content height should increase and scrollbar handle should move
diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml
index 48612215..1d7e92d2 100644
--- a/tests/auto/controls/data/tst_slider.qml
+++ b/tests/auto/controls/data/tst_slider.qml
@@ -48,11 +48,12 @@
**
****************************************************************************/
-import QtQuick 2.2
+import QtQuick 2.6
import QtTest 1.0
import QtQuickControlsTests 1.0
-import QtQuick.Controls 1.2
+import QtQuick.Controls 1.4
import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles 1.4
Item {
id: container
@@ -74,6 +75,12 @@ Item {
id: util
}
+ Component {
+ id: sliderComponent
+
+ Slider {}
+ }
+
function test_vertical() {
var slider = Qt.createQmlObject('import QtQuick.Controls 1.2; Slider {}', testCase, '');
verify(slider.height < slider.width)
@@ -371,5 +378,34 @@ Item {
control.destroy()
component.destroy()
}
+
+ Component {
+ id: namedHandleStyle
+
+ SliderStyle {
+ handle: Rectangle {
+ objectName: "sliderHandle"
+ implicitWidth: 20
+ implicitHeight: 20
+ color: "salmon"
+ }
+ }
+ }
+
+ function test_minimumValueLargerThanValue() {
+ var control = sliderComponent.createObject(container, { "style": namedHandleStyle, "minimumValue": 0, "maximumValue": 2, value: "minimumValue" });
+ verify(control);
+
+ var handle = findChild(control, "sliderHandle");
+ verify(handle);
+
+ // The handle should stay within the bounds of the slider when
+ // minimumValue is set to a value larger than "value".
+ control.minimumValue = 1;
+ compare(control.value, control.minimumValue);
+ compare(handle.mapToItem(null, 0, 0).x, 0)
+
+ control.destroy();
+ }
}
}