summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2014-10-24 11:28:01 +0200
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2014-10-30 16:50:44 +0100
commit6811722011970ee66f69c8b50417ca5f66943111 (patch)
tree202291680bd3dcdab41358d9e238b6e302a5e440 /tests
parent89d67ca33fcd1dd19278d248007d8aef4097407b (diff)
downloadqtquickcontrols-6811722011970ee66f69c8b50417ca5f66943111.tar.gz
Revert "qquickrangemodel: don't emit signals before component is completed"
This reverts commit 774f2aa14e8742d77bb92968b06fab4dc35d79b4 that broke sliders (auto test for RangeModel included to prevent that from happening again) in the Qt Quick Enterprise Controls gallery. Some sliders with a hard-coded range [0..360] and value 240 ended up having a value of 0 at Component.onCompleted. Change-Id: Ib3024c51c0552ac06528ba47b08e1a33a5f48324 Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/rangemodel/bindings.qml67
-rw-r--r--tests/auto/controls/data/tst_rangemodel.qml19
2 files changed, 86 insertions, 0 deletions
diff --git a/tests/auto/controls/data/rangemodel/bindings.qml b/tests/auto/controls/data/rangemodel/bindings.qml
new file mode 100644
index 00000000..7ecdada8
--- /dev/null
+++ b/tests/auto/controls/data/rangemodel/bindings.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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
+
+Item {
+ property alias range1: range1
+ property alias range2: range2
+ property alias range3: range3
+ RangeModel {
+ id: range1
+ value: 50
+ minimumValue: 25
+ maximumValue: 75
+ }
+ RangeModel {
+ id: range2
+ value: range1.value
+ minimumValue: range1.minimumValue
+ maximumValue: range1.maximumValue
+ }
+ RangeModel {
+ id: range3
+ value: range2.value
+ minimumValue: range2.minimumValue
+ maximumValue: range2.maximumValue
+ }
+}
diff --git a/tests/auto/controls/data/tst_rangemodel.qml b/tests/auto/controls/data/tst_rangemodel.qml
index bbb0e3bf..b29a6749 100644
--- a/tests/auto/controls/data/tst_rangemodel.qml
+++ b/tests/auto/controls/data/tst_rangemodel.qml
@@ -164,4 +164,23 @@ TestCase {
compare(spy.count, 2)
compare(range.position, 100)
}
+
+ function test_bindings() {
+ var component = Qt.createComponent("rangemodel/bindings.qml")
+ compare(component.status, Component.Ready)
+ var object = component.createObject(testCase)
+ verify(object !== null, "created object is null")
+
+ compare(object.range1.value, 50)
+ compare(object.range1.minimumValue, 25)
+ compare(object.range1.maximumValue, 75)
+
+ compare(object.range2.value, 50)
+ compare(object.range2.minimumValue, 25)
+ compare(object.range2.maximumValue, 75)
+
+ compare(object.range3.value, 50)
+ compare(object.range3.minimumValue, 25)
+ compare(object.range3.maximumValue, 75)
+ }
}