From 6ab374f0fd530c841470f93c8befb92f1f646470 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 26 Nov 2013 14:59:10 +0100 Subject: 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 --- tests/auto/controls/data/tst_combobox.qml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'tests') 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" -- cgit v1.2.3