summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@digia.com>2013-11-26 14:59:10 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-26 15:21:38 +0100
commit6ab374f0fd530c841470f93c8befb92f1f646470 (patch)
tree4811ff4f1d8eb383cf7e0f08f4892bfbb61e4c51 /tests
parentefc340f2504bf7faa3591e4b53af0000a963089e (diff)
downloadqtquickcontrols-6ab374f0fd530c841470f93c8befb92f1f646470.tar.gz
qtquickcontrols-6ab374f0fd530c841470f93c8befb92f1f646470.tar.bz2
qtquickcontrols-6ab374f0fd530c841470f93c8befb92f1f646470.zip
ComboBox: Call resolveTextValue() after any model change
Particularly if the nature of the model has changed (e.g., from null to array). Task-number: QTBUG-34936 Change-Id: If07690a8836dcd786ed7a32afda1e344d048d31f Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_combobox.qml16
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml
index 802d23e4..256e213e 100644
--- a/tests/auto/controls/data/tst_combobox.qml
+++ b/tests/auto/controls/data/tst_combobox.qml
@@ -118,13 +118,15 @@ TestCase {
}
function test_arraymodelwithtextrole() {
- // FIXME The use-case before this change should work.
- var comboBox = Qt.createQmlObject('import QtQuick.Controls 1.1 ; \
- ComboBox { \
- model: [ { "text": "Banana", "color": "Yellow"}, \
- { "text": "Apple", "color": "Green"}, \
- { "text": "Coconut", "color": "Brown"} ]; \
- textRole: "text" }', testCase, '');
+ var arrayModel = [
+ {text: 'Banana', color: 'Yellow'},
+ {text: 'Apple', color: 'Green'},
+ {text: 'Coconut', color: 'Brown'}
+ ];
+
+ var comboBox = Qt.createQmlObject('import QtQuick.Controls 1.1 ; ComboBox { }', testCase, '');
+ comboBox.textRole = "text"
+ comboBox.model = arrayModel
compare(comboBox.currentIndex, 0)
compare(comboBox.currentText, "Banana")
comboBox.textRole = "color"